|
@@ -1,31 +1,31 @@
|
|
|
// ThreeExtras.js - http://github.com/mrdoob/three.js
|
|
|
'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-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=e;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,j=a.faces,i=e.faces,k=a.faceVertexUvs[0],q=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);g.push(m)}n=0;for(r=i.length;n<r;n++){var g=
|
|
|
-i[n],p,t,s=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=s.length;h<m;h++)t=s[h].clone(),d&&d.multiplyVector3(t),p.vertexNormals.push(t);p.color.copy(g.color);h=0;for(m=v.length;h<m;h++)t=v[h],p.vertexColors.push(t.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,v=l[m],void 0===v&&(v=a.materials.length,
|
|
|
-l[m]=v,a.materials.push(h)),p.materialIndex=v);p.centroid.copy(g.centroid);c&&c.multiplyVector3(p.centroid);j.push(p)}n=0;for(r=q.length;n<r;n++){c=q[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(c=e.length;a<
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],q=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);g.push(m)}n=0;for(r=j.length;n<r;n++){var g=
|
|
|
+j[n],p,t,s=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=s.length;h<m;h++)t=s[h].clone(),d&&d.multiplyVector3(t),p.vertexNormals.push(t);p.color.copy(g.color);h=0;for(m=v.length;h<m;h++)t=v[h],p.vertexColors.push(t.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,v=l[m],void 0===v&&(v=a.materials.length,
|
|
|
+l[m]=v,a.materials.push(h)),p.materialIndex=v);p.centroid.copy(g.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}n=0;for(r=q.length;n<r;n++){c=q[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(c=e.length;a<
|
|
|
c;a++){for(var d=e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof THREE.Face3)return d=
|
|
|
b.vertices[a.a].position,f=b.vertices[a.b].position,e=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;e=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,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,
|
|
|
-e,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return i[f]>a?b(c,f-1):i[f]<a?b(f+1,d):f}return b(0,i.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,j=0,i=[],k,q,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,
|
|
|
-q,l)):d instanceof THREE.Face4&&(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2),j+=d._area,i[f]=j;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*j,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
|
|
|
+e,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,q,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,
|
|
|
+q,l)):d instanceof THREE.Face4&&(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2),i+=d._area,j[f]=i;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.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).makeTranslation(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],f=0,e=d.length;f<e;f++)if(1!==d[f].u&&(d[f].u-=Math.floor(d[f].u)),1!==d[f].v)d[f].v-=Math.floor(d[f].v)},triangulateQuads:function(a){var b,
|
|
|
-c,d,f,e=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){f=d.a;var j=d.b,i=d.c,k=d.d,q=new THREE.Face3,l=new THREE.Face3;q.color.copy(d.color);l.color.copy(d.color);q.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;q.a=f;q.b=j;q.c=k;l.a=j;l.b=i;l.c=k;4===d.vertexColors.length&&(q.vertexColors[0]=d.vertexColors[0].clone(),q.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
-q.vertexColors[2]=d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());e.push(q,l);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(q=a.faceVertexUvs[d][b],j=q[1],i=q[2],k=q[3],q=[q[0].clone(),j.clone(),k.clone()],j=[j.clone(),i.clone(),k.clone()],h[d].push(q,j));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(j=a.faceUvs[d][b],g[d].push(j,j))}else{e.push(d);d=0;for(f=
|
|
|
-a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d]);d=0;for(f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],i=a.vertices[e.d];b.push(g.clone());b.push(h.clone());
|
|
|
-b.push(j.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],b.push(g.clone()),b.push(h.clone()),b.push(j.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,j,i,k,q,l,n,r,m,p,t,s,v,o,x=[],y=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)y[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,i=a.vertices[e],k=a.vertices[g],
|
|
|
-q=a.vertices[h],n=i.position.distanceTo(k.position),r=k.position.distanceTo(q.position),l=i.position.distanceTo(q.position),n>b||r>b||l>b){j=a.vertices.length;v=f.clone();o=f.clone();n>=r&&n>=l?(i=i.clone(),i.position.lerpSelf(k.position,0.5),v.a=e,v.b=j,v.c=h,o.a=j,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),v.vertexNormals[1].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],
|
|
|
-0.5),v.vertexColors[1].copy(e),o.vertexColors[0].copy(e)),f=0):r>=n&&r>=l?(i=k.clone(),i.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=j,o.a=j,o.b=h,o.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e),o.vertexNormals[1].copy(f.vertexNormals[2]),o.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),
|
|
|
-o.vertexColors[0].copy(e),o.vertexColors[1].copy(f.vertexColors[2]),o.vertexColors[2].copy(f.vertexColors[0])),f=1):(i=i.clone(),i.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=j,o.a=j,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),o.vertexColors[0].copy(e)),f=2);x.push(v,
|
|
|
-o);a.vertices.push(i);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],o=i[0],h=i[1],v=i[2],0===f?(k=o.clone(),k.lerpSelf(h,0.5),i=[o.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===f?(k=h.clone(),k.lerpSelf(v,0.5),i=[o.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),o.clone()]):(k=o.clone(),k.lerpSelf(v,0.5),i=[o.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),y[e].push(i,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<
|
|
|
-g;e++)y[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,j=f.d,i=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[j],n=i.position.distanceTo(k.position),r=k.position.distanceTo(q.position),m=q.position.distanceTo(l.position),p=i.position.distanceTo(l.position),n>b||r>b||m>b||p>b){t=a.vertices.length;s=a.vertices.length+1;v=f.clone();o=f.clone();n>=r&&n>=m&&n>=p||m>=r&&m>=n&&m>=p?(n=i.clone(),n.position.lerpSelf(k.position,0.5),k=q.clone(),k.position.lerpSelf(l.position,0.5),v.a=
|
|
|
-e,v.b=t,v.c=s,v.d=j,o.a=t,o.b=g,o.c=h,o.d=s,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),v.vertexNormals[1].copy(e),v.vertexNormals[2].copy(g),o.vertexNormals[0].copy(e),o.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),v.vertexColors[1].copy(e),v.vertexColors[2].copy(g),
|
|
|
-o.vertexColors[0].copy(e),o.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.position.lerpSelf(q.position,0.5),k=l.clone(),k.position.lerpSelf(i.position,0.5),v.a=e,v.b=g,v.c=t,v.d=s,o.a=s,o.b=t,o.c=h,o.d=j,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),v.vertexNormals[2].copy(e),v.vertexNormals[3].copy(g),o.vertexNormals[0].copy(g),o.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),
|
|
|
-e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),v.vertexColors[2].copy(e),v.vertexColors[3].copy(g),o.vertexColors[0].copy(g),o.vertexColors[1].copy(e)),f=1);x.push(v,o);a.vertices.push(n,k);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],o=i[0],h=i[1],v=i[2],i=i[3],0===f?(k=o.clone(),k.lerpSelf(h,0.5),q=v.clone(),q.lerpSelf(i,0.5),o=[o.clone(),k.clone(),q.clone(),i.clone()],h=[k.clone(),h.clone(),v.clone(),
|
|
|
-q.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),q=i.clone(),q.lerpSelf(o,0.5),o=[o.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),v.clone(),i.clone()]),y[e].push(o,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}a.faces=x;a.faceVertexUvs=y}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+c,d,f,e=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,k=d.d,q=new THREE.Face3,l=new THREE.Face3;q.color.copy(d.color);l.color.copy(d.color);q.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;q.a=f;q.b=i;q.c=k;l.a=i;l.b=j;l.c=k;4===d.vertexColors.length&&(q.vertexColors[0]=d.vertexColors[0].clone(),q.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
+q.vertexColors[2]=d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());e.push(q,l);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(q=a.faceVertexUvs[d][b],i=q[1],j=q[2],k=q[3],q=[q[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(q,i));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);d=0;for(f=
|
|
|
+a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d]);d=0;for(f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());
|
|
|
+b.push(i.clone());b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,q,l,n,r,m,p,t,s,v,o,x=[],y=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)y[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],k=a.vertices[g],
|
|
|
+q=a.vertices[h],n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),l=j.position.distanceTo(q.position),n>b||r>b||l>b){i=a.vertices.length;v=f.clone();o=f.clone();n>=r&&n>=l?(j=j.clone(),j.position.lerpSelf(k.position,0.5),v.a=e,v.b=i,v.c=h,o.a=i,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),v.vertexNormals[1].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],
|
|
|
+0.5),v.vertexColors[1].copy(e),o.vertexColors[0].copy(e)),f=0):r>=n&&r>=l?(j=k.clone(),j.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=i,o.a=i,o.b=h,o.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e),o.vertexNormals[1].copy(f.vertexNormals[2]),o.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),
|
|
|
+o.vertexColors[0].copy(e),o.vertexColors[1].copy(f.vertexColors[2]),o.vertexColors[2].copy(f.vertexColors[0])),f=1):(j=j.clone(),j.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=i,o.a=i,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),o.vertexColors[0].copy(e)),f=2);x.push(v,
|
|
|
+o);a.vertices.push(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],0===f?(k=o.clone(),k.lerpSelf(h,0.5),j=[o.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===f?(k=h.clone(),k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),o.clone()]):(k=o.clone(),k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),y[e].push(j,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<
|
|
|
+g;e++)y[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[i],n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),m=q.position.distanceTo(l.position),p=j.position.distanceTo(l.position),n>b||r>b||m>b||p>b){t=a.vertices.length;s=a.vertices.length+1;v=f.clone();o=f.clone();n>=r&&n>=m&&n>=p||m>=r&&m>=n&&m>=p?(n=j.clone(),n.position.lerpSelf(k.position,0.5),k=q.clone(),k.position.lerpSelf(l.position,0.5),v.a=
|
|
|
+e,v.b=t,v.c=s,v.d=i,o.a=t,o.b=g,o.c=h,o.d=s,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),v.vertexNormals[1].copy(e),v.vertexNormals[2].copy(g),o.vertexNormals[0].copy(e),o.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),v.vertexColors[1].copy(e),v.vertexColors[2].copy(g),
|
|
|
+o.vertexColors[0].copy(e),o.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.position.lerpSelf(q.position,0.5),k=l.clone(),k.position.lerpSelf(j.position,0.5),v.a=e,v.b=g,v.c=t,v.d=s,o.a=s,o.b=t,o.c=h,o.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),v.vertexNormals[2].copy(e),v.vertexNormals[3].copy(g),o.vertexNormals[0].copy(g),o.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),
|
|
|
+e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),v.vertexColors[2].copy(e),v.vertexColors[3].copy(g),o.vertexColors[0].copy(g),o.vertexColors[1].copy(e)),f=1);x.push(v,o);a.vertices.push(n,k);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],j=j[3],0===f?(k=o.clone(),k.lerpSelf(h,0.5),q=v.clone(),q.lerpSelf(j,0.5),o=[o.clone(),k.clone(),q.clone(),j.clone()],h=[k.clone(),h.clone(),v.clone(),
|
|
|
+q.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),q=j.clone(),q.lerpSelf(o,0.5),o=[o.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),v.clone(),j.clone()]),y[e].push(o,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}a.faces=x;a.faceVertexUvs=y}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b),b=f.loadCount=0;for(d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;6===f.loadCount&&(e.needsUpdate=!0);c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return e},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,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,j=g.createImageData(d,f),i=j.data,k=0;k<d;k++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,p=[],t=[0,0,h[4*(q*d+k)]/255*b];p.push([-1,0,h[4*(q*d+r)]/255*b]);p.push([-1,-1,h[4*(l*d+r)]/255*b]);p.push([0,-1,h[4*(l*d+
|
|
|
+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,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,p=[],t=[0,0,h[4*(q*d+k)]/255*b];p.push([-1,0,h[4*(q*d+r)]/255*b]);p.push([-1,-1,h[4*(l*d+r)]/255*b]);p.push([0,-1,h[4*(l*d+
|
|
|
k)]/255*b]);p.push([1,-1,h[4*(l*d+m)]/255*b]);p.push([1,0,h[4*(q*d+m)]/255*b]);p.push([1,1,h[4*(n*d+m)]/255*b]);p.push([0,1,h[4*(n*d+k)]/255*b]);p.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=p.length;for(n=0;n<r;n++){var m=p[n],s=p[(n+1)%r],m=[m[0]-t[0],m[1]-t[1],m[2]-t[2]],s=[s[0]-t[0],s[1]-t[1],s[2]-t[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}p=[0,0,0];for(n=0;n<l.length;n++)p[0]+=l[n][0],p[1]+=l[n][1],p[2]+=l[n][2];p[0]/=l.length;p[1]/=l.length;p[2]/=l.length;t=4*
|
|
|
-(q*d+k);i[t]=255*((p[0]+1)/2)|0;i[t+1]=255*(p[1]+0.5)|0;i[t+2]=255*p[2]|0;i[t+3]=255}g.putImageData(j,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
|
|
|
+(q*d+k);j[t]=255*((p[0]+1)/2)|0;j[t+1]=255*(p[1]+0.5)|0;j[t+2]=255*p[2]|0;j[t+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
|
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},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,
|
|
@@ -44,7 +44,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
|
|
|
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=false;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=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),f,e=0;b.push(0);for(f=1;f<=a;f++){c=this.getPoint(f/a);e=e+c.distanceTo(d);b.push(e);d=c}return this.cacheArcLengths=b};
|
|
|
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,j;g<=h;){d=Math.floor(g+(h-g)/2);j=c[d]-e;if(j<0)g=d+1;else if(j>0)h=d-1;else{h=d;break}}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-e;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-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;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;
|
|
|
THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(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(){return this.v2.clone().subSelf(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){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};
|
|
@@ -61,10 +61,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};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(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return 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=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var e,g,h,j;j=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){e=a[g];if(e.x>b)b=e.x;else if(e.x<d)d=e.x;if(e.y>c)c=e.y;else if(e.y<c)f=e.y;j.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var e,g,h,i;i=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){e=a[g];if(e.x>b)b=e.x;else if(e.x<d)d=e.x;if(e.y>c)c=e.y;else if(e.y<c)f=e.y;i.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};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,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,j;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,i;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};
|
|
|
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
|
|
|
THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else this.matrixWorld.copy(this.matrix);
|
|
|
this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
|
|
@@ -75,37 +75,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.s
|
|
|
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,f,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);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){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,j,i,k,q,l,n,r,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];j=e[3];q=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
|
|
|
-n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,q,h);m=THREE.Shape.Utils.b2(m,r,l,j);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];j=e[5];q=e[0];l=e[1];i=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,q,i,h);m=THREE.Shape.Utils.b3(m,r,l,k,j);c.push(new THREE.Vector2(g,
|
|
|
-m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];j=e[1];i=e[2];q=e[3];l=!!e[5];k=e[4]-q;n=a*2;for(e=1;e<=n;e++){m=e/n;l||(m=1-m);m=q+m*k;g=h+i*Math.cos(m);m=j+i*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
|
|
|
-1,1);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,f,e){var g=this.getPoints(),h,j,i,k,q;h=0;for(j=g.length;h<j;h++){i=g[h];k=i.x;q=i.y;i.x=a*k+b*q+c;i.y=d*q+f*k+e}return g};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,j,k,q,l,n,r,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];q=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
|
|
|
+n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,q,h);m=THREE.Shape.Utils.b2(m,r,l,i);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];q=e[0];l=e[1];j=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,q,j,h);m=THREE.Shape.Utils.b3(m,r,l,k,i);c.push(new THREE.Vector2(g,
|
|
|
+m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];j=e[2];q=e[3];l=!!e[5];k=e[4]-q;n=a*2;for(e=1;e<=n;e++){m=e/n;l||(m=1-m);m=q+m*k;g=h+j*Math.cos(m);m=i+j*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
|
|
|
+1,1);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,f,e){var g=this.getPoints(),h,i,j,k,q;h=0;for(i=g.length;h<i;h++){j=g[h];k=j.x;q=j.y;j.x=a*k+b*q+c;j.y=d*q+f*k+e}return g};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!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,f,a=0;for(c=this.actions.length;a<c;a++){d=this.actions[a];f=d.args;d=d.action;d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f)}b.stroke();b.closePath();b.strokeStyle="red";
|
|
|
d=this.getPoints();a=0;for(c=d.length;a<c;a++){f=d[a];b.beginPath();b.arc(f.x,f.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&e.actions.length!=0){f.push(e);e=new THREE.Path}e[c].apply(e,d)}e.actions.length!=0&&f.push(e);if(f.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1){e=f[0];g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=f.length;a<
|
|
|
b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g.actions=e.actions;g.curves=e.curves;d.push(g);g=new THREE.Shape}else g.holes.push(e)}}else{a=0;for(b=f.length;a<b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves}else g.holes.push(e)}d.push(g)}return d};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.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(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(),f,e,g,h,j,i,k,q,l,n,r=[];for(j=0;j<b.length;j++){i=b[j];Array.prototype.push.apply(d,i);e=Number.POSITIVE_INFINITY;for(f=0;f<i.length;f++){l=i[f];n=[];for(q=0;q<c.length;q++){k=c[q];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=q}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;var m=[i[g],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var p=[i[g],i[e],c[h]];l=THREE.FontUtils.Triangulate.area(p);n=h;k=g;h=h+1;g=g+
|
|
|
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;m=[i[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);p=[i[g],i[e],c[h]];p=THREE.FontUtils.Triangulate.area(p);if(q+l>m+p){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1}q=c.slice(0,h);l=c.slice(h);n=i.slice(g);k=i.slice(0,g);e=[i[g],i[e],c[h]];r.push([i[g],c[h],c[f]]);r.push(e);c=q.concat(n).concat(k).concat(l)}return{shape:c,
|
|
|
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,j,i={};e=0;for(g=d.length;e<g;e++){j=d[e].x+":"+d[e].y;i[j]!==void 0&&console.log("Duplicate point",j);i[j]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}return c.concat(f)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,k,q,l,n,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];n=[];for(q=0;q<c.length;q++){k=c[q];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=q}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var p=[j[g],j[e],c[h]];l=THREE.FontUtils.Triangulate.area(p);n=h;k=g;h=h+1;g=g+
|
|
|
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);p=[j[g],j[e],c[h]];p=THREE.FontUtils.Triangulate.area(p);if(q+l>m+p){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1}q=c.slice(0,h);l=c.slice(h);n=j.slice(g);k=j.slice(0,g);e=[j[g],j[e],c[h]];r.push([j[g],c[h],c[f]]);r.push(e);c=q.concat(n).concat(k).concat(l)}return{shape:c,
|
|
|
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,j={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
|
|
|
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,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,f)}};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=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",e=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=f;THREE.FontUtils.style=e};
|
|
|
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!==true){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 j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var i=a.hierarchy[c].keys[d].morphTargets[j];h[i]=-1}a.hierarchy[c].usedMorphTargets=
|
|
|
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(i in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===i){k[i]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(k[i]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=
|
|
|
+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 j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=
|
|
|
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=true}},get:function(a){if(typeof a==="string"){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=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=true;f.matrixAutoUpdate=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
|
|
|
f instanceof THREE.Bone?f.skinMatrix:f.matrix}var e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;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=false;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,f,e,g,h,j,i,k=this.data.JIT.hierarchy,q,l;l=this.currentTime=this.currentTime+a*this.timeScale;q=this.currentTime=this.currentTime%this.data.length;i=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++){a=this.hierarchy[n];j=a.animationCache;if(this.JITCompile&&k[n][i]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][i];a.matrixAutoUpdate=
|
|
|
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[n][i];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;){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<q)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(q-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,k=this.data.JIT.hierarchy,q,l;l=this.currentTime=this.currentTime+a*this.timeScale;q=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++){a=this.hierarchy[n];i=a.animationCache;if(this.JITCompile&&k[n][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][j];a.matrixAutoUpdate=
|
|
|
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[n][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;){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<q)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(q-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
|
|
|
THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(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(f,e,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}}}}if(this.JITCompile&&k[0][i]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(n=0;n<this.hierarchy.length;n++)k[n][i]=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=[],f,e,g,h,j,i;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];j=a[c[2]];i=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],j[0],i[0],f,c,g);d[1]=this.interpolate(e[1],h[1],j[1],i[1],f,c,g);d[2]=this.interpolate(e[2],h[2],j[2],i[2],f,c,g);return d};
|
|
|
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(f,e,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}}}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(n=0;n<this.hierarchy.length;n++)k[n][j]=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=[],f,e,g,h,i,j;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],j[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],j[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],j[2],f,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+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(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.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;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 f=0;f<c.length;f++){var e=c[f],g=this.getNextKeyWith(e,a,0);g&&g.apply(e)}d.matrixAutoUpdate=
|
|
@@ -113,14 +113,14 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,e;for(c=0;c<d;c++){f=this.hierarchy[c];e=this.data.hierarchy[c];f.useQuaternion=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey=null;e.animationCache.nextKey=null;e.animationCache.originalMatrix=f instanceof THREE.Bone?
|
|
|
f.skinMatrix:f.matrix}f=this.data.hierarchy[c].keys;if(f.length){e.animationCache.prevKey=f[0];e.animationCache.nextKey=f[1];this.startTime=Math.min(f[0].time,this.startTime);this.endTime=Math.max(f[f.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((j=g<h)&&!this.loop){for(var a=0,i=this.hierarchy.length;a<i;a++){var k=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=k.length-1;f=
|
|
|
-this.hierarchy[a];if(k.length){for(k=0;k<e.length;k++){g=e[k];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
|
|
|
-true}else if(k.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(j&&this.loop){b=k[0];for(c=k[1];c.time<g;){b=c;c=k[b.index+1]}}else if(!j)for(var l=k.length-1;c.time<g&&c.index!==l;){b=c;c=k[b.index+1]}q.prevKey=b;q.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=k.length-1;f=
|
|
|
+this.hierarchy[a];if(k.length){for(k=0;k<e.length;k++){g=e[k];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
|
|
|
+true}else if(k.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=k[0];for(c=k[1];c.time<g;){b=c;c=k[b.index+1]}}else if(!i)for(var l=k.length-1;c.time<g&&c.index!==l;){b=c;c=k[b.index+1]}q.prevKey=b;q.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
for(a=0;a<this.hierarchy.length;a++)e[a][f]=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=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
|
|
|
THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new THREE.Vector3(-1,0,0));this.add(f);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,0,1);e.lookAt(new THREE.Vector3(0,1,0));this.add(e);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var j=new THREE.PerspectiveCamera(90,1,a,b);j.up.set(0,-1,0);j.lookAt(new THREE.Vector3(0,0,-1));this.add(j);var i=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.getRenderTarget=function(){return i};this.updateCubeMap=function(a,b){var c=i.generateMipmaps;i.generateMipmaps=false;i.activeCubeFace=0;a.render(b,d,i);i.activeCubeFace=1;a.render(b,f,i);i.activeCubeFace=
|
|
|
-2;a.render(b,e,i);i.activeCubeFace=3;a.render(b,g,i);i.activeCubeFace=4;a.render(b,h,i);i.generateMipmaps=c;i.activeCubeFace=5;a.render(b,j,i)}};THREE.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
|
|
|
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,l=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,f,c);c.activeCubeFace=
|
|
|
+2;a.render(b,e,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=l;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
|
|
|
THREE.CombinedCamera=function(a,b,c,d,f,e,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,e,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CombinedCamera;
|
|
|
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=true;this.inOrthographicMode=false};
|
|
|
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=false;this.inOrthographicMode=true};
|
|
@@ -155,74 +155,74 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
|
|
|
this.object.matrixWorldNeedsUpdate=true};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),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
|
|
|
c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,j=0,i=0,k=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
|
|
|
-a*this.lookSpeed;this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*i);this.object.translateY(b*k);if(g)this.roll=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()}f.copy(this.forward);
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,i=0,j=0,k=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
|
|
|
+a*this.lookSpeed;this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);if(g)this.roll=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()}f.copy(this.forward);
|
|
|
d.set(0,1,0);c.cross(d,f).normalize();d.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=true;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.position.x+this.object.matrix.n11*a;this.object.position.y=this.object.position.y+this.object.matrix.n21*a;this.object.position.z=this.object.position.z+this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.n12*a;this.object.position.y=this.object.position.y+
|
|
|
this.object.matrix.n22*a;this.object.position.z=this.object.position.z+this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.n13*a;this.object.position.y=this.object.position.y-this.object.matrix.n23*a;this.object.position.z=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()},false);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=
|
|
|
-1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=1;break;case 37:case 65:i=-1;break;case 40:case 83:j=-1;break;case 39:case 68:i=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:k=1;break;case 70:k=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=
|
|
|
-0;break;case 37:case 65:i=0;break;case 40:case 83:j=0;break;case 39:case 68:i=0;break;case 81:g=false;break;case 69:g=false;break;case 82:k=0;break;case 70:k=0}},false)};
|
|
|
+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()},false);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=
|
|
|
+1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:k=1;break;case 70:k=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=
|
|
|
+0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:k=0;break;case 70:k=0}},false)};
|
|
|
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
|
|
|
-this.target=new THREE.Vector3;var d=new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};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);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
|
|
|
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(k.y-i.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?i=k:i.y=i.y+(k.y-i.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=l.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
|
|
|
+this.target=new THREE.Vector3;var d=new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};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);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.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=a*c.rotateSpeed;
|
|
|
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=k:j.y=j.y+(k.y-j.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=l.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.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=l:q.addSelf(a.sub(l,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);g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);
|
|
|
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(n);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);i=k=c.getMouseOnScreen(a.clientX,a.clientY);q=
|
|
|
-l=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,
|
|
|
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(n);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=k=c.getMouseOnScreen(a.clientX,a.clientY);q=
|
|
|
+l=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):this.noPan||(q=l=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){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);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function j(a,b,c,g,h,j,l,k){var m,q=d||1,n=f||1,r=h/2,p=j/2,t=i.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";q=e||1}var s=q+1,v=n+1,F=h/q,M=j/n,N=new THREE.Vector3;N[m]=l>0?1:-1;for(h=0;h<v;h++)for(j=0;j<s;j++){var D=new THREE.Vector3;D[a]=(j*F-r)*c;D[b]=(h*M-p)*g;D[m]=l;i.vertices.push(new THREE.Vertex(D))}for(h=0;h<n;h++)for(j=0;j<
|
|
|
-q;j++){a=new THREE.Face4(j+s*h+t,j+s*(h+1)+t,j+1+s*(h+1)+t,j+1+s*h+t);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;i.faces.push(a);i.faceVertexUvs[0].push([new THREE.UV(j/q,h/n),new THREE.UV(j/q,(h+1)/n),new THREE.UV((j+1)/q,(h+1)/n),new THREE.UV((j+1)/q,h/n)])}}THREE.Geometry.call(this);var i=this,k=a/2,q=b/2,l=c/2,n,r,m,p,t,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;
|
|
|
-p=1;r=2;t=3;m=4;s=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&j("z","y",-1,-1,c,b,k,n);this.sides.nx&&j("z","y",1,-1,c,b,-k,p);this.sides.py&&j("x","z",1,1,a,c,q,r);this.sides.ny&&j("x","z",1,-1,a,c,-q,t);this.sides.pz&&j("x","y",1,-1,a,b,l,m);this.sides.nz&&j("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,l,i,k){var m,q=d||1,n=f||1,r=h/2,p=l/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";q=e||1}var s=q+1,v=n+1,F=h/q,M=l/n,N=new THREE.Vector3;N[m]=i>0?1:-1;for(h=0;h<v;h++)for(l=0;l<s;l++){var D=new THREE.Vector3;D[a]=(l*F-r)*c;D[b]=(h*M-p)*g;D[m]=i;j.vertices.push(new THREE.Vertex(D))}for(h=0;h<n;h++)for(l=0;l<
|
|
|
+q;l++){a=new THREE.Face4(l+s*h+t,l+s*(h+1)+t,l+1+s*(h+1)+t,l+1+s*h+t);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(l/q,h/n),new THREE.UV(l/q,(h+1)/n),new THREE.UV((l+1)/q,(h+1)/n),new THREE.UV((l+1)/q,h/n)])}}THREE.Geometry.call(this);var j=this,k=a/2,q=b/2,l=c/2,n,r,m,p,t,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;
|
|
|
+p=1;r=2;t=3;m=4;s=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,t);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,j,i=[],k=[];for(j=0;j<=f;j++){var q=[],l=[],n=j/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,p=r*Math.sin(m*Math.PI*2),t=-n*c+g,s=r*Math.cos(m*Math.PI*2);this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}i.push(q);k.push(l)}for(j=0;j<f;j++)for(h=0;h<d;h++){var c=i[j][h],q=i[j+1][h],
|
|
|
-l=i[j+1][h+1],n=i[j][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),t=this.vertices[n].position.clone().setY(0).normalize(),s=k[j][h].clone(),v=k[j+1][h].clone(),o=k[j+1][h+1].clone(),x=k[j][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,p,t]));this.faceVertexUvs[0].push([s,v,o,x])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
-0;h<d;h++){c=i[0][h];q=i[0][h+1];l=this.vertices.length-1;r=new THREE.Vector3(0,1,0);m=new THREE.Vector3(0,1,0);p=new THREE.Vector3(0,1,0);s=k[0][h].clone();v=k[0][h+1].clone();o=new THREE.UV(v.u,0);this.faces.push(new THREE.Face3(c,q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}if(!e&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++){c=i[j][h+1];q=i[j][h];l=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);p=new THREE.Vector3(0,
|
|
|
--1,0);s=k[j][h+1].clone();v=k[j][h].clone();o=new THREE.UV(v.u,1);this.faces.push(new THREE.Face3(c,q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,p=r*Math.sin(m*Math.PI*2),t=-n*c+g,s=r*Math.cos(m*Math.PI*2);this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(q);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],
|
|
|
+l=j[i+1][h+1],n=j[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),t=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),v=k[i+1][h].clone(),o=k[i+1][h+1].clone(),x=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,p,t]));this.faceVertexUvs[0].push([s,v,o,x])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
+0;h<d;h++){c=j[0][h];q=j[0][h+1];l=this.vertices.length-1;r=new THREE.Vector3(0,1,0);m=new THREE.Vector3(0,1,0);p=new THREE.Vector3(0,1,0);s=k[0][h].clone();v=k[0][h+1].clone();o=new THREE.UV(v.u,0);this.faces.push(new THREE.Face3(c,q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}if(!e&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++){c=j[i][h+1];q=j[i][h];l=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);p=new THREE.Vector3(0,
|
|
|
+-1,0);s=k[i][h+1].clone();v=k[i][h].clone();o=new THREE.UV(v.u,1);this.faces.push(new THREE.Face3(c,q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}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);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
-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,f=THREE.ExtrudeGeometry.__v3,g=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();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(D=c.length;--D>=0;){e=D;f=D-1;f<0&&(f=
|
|
|
-c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var i=F*g,j=F*(g+1),m=d+e+i,i=d+f+i,q=d+f+j,j=d+e+j,n=c,r=g,p=h,m=m+H,i=i+H,q=q+H,j=j+H;E.faces.push(new THREE.Face4(m,i,q,j,null,null,s));m=O.generateSideWallUV(E,a,n,b,m,i,q,j,r,p);E.faceVertexUvs[0].push(m)}}}function e(a,b,c){E.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c=c+H;d=d+H;e=e+H;E.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?O.generateBottomUV(E,a,b,c,d,e):O.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}
|
|
|
-var h=b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,i=b.bevelSize!==void 0?b.bevelSize:j-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,q=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,r=b.extrudePath,m,p=false,t=b.material,s=b.extrudeMaterial,v,o,x,y;if(r){m=r.getSpacedPoints(l);p=true;q=false;v=new THREE.TubeGeometry.FrenetFrames(r,l,false);o=new THREE.Vector3;x=new THREE.Vector3;y=new THREE.Vector3}if(!q)i=j=k=0;var z,u,w,E=
|
|
|
+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,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,l=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();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
|
|
|
+h.copy(b).addSelf(f);l.copy(c).addSelf(g);f=d.dot(g);g=l.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(D=c.length;--D>=0;){e=D;f=D-1;f<0&&(f=
|
|
|
+c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var j=F*g,i=F*(g+1),m=d+e+j,j=d+f+j,q=d+f+i,i=d+e+i,n=c,r=g,p=h,m=m+H,j=j+H,q=q+H,i=i+H;E.faces.push(new THREE.Face4(m,j,q,i,null,null,s));m=O.generateSideWallUV(E,a,n,b,m,j,q,i,r,p);E.faceVertexUvs[0].push(m)}}}function e(a,b,c){E.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c=c+H;d=d+H;e=e+H;E.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?O.generateBottomUV(E,a,b,c,d,e):O.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}
|
|
|
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,q=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,r=b.extrudePath,m,p=false,t=b.material,s=b.extrudeMaterial,v,o,x,y;if(r){m=r.getSpacedPoints(l);p=true;q=false;v=new THREE.TubeGeometry.FrenetFrames(r,l,false);o=new THREE.Vector3;x=new THREE.Vector3;y=new THREE.Vector3}if(!q)j=i=k=0;var z,u,w,E=
|
|
|
this,H=this.vertices.length;n&&a.addWrapPath(n);var r=a.extractPoints(),n=r.shape,I=r.holes;if(r=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();u=0;for(w=I.length;u<w;u++){z=I[u];THREE.Shape.Utils.isClockWise(z)&&(I[u]=z.reverse())}r=false}var J=THREE.Shape.Utils.triangulateShape(n,I),C=n;u=0;for(w=I.length;u<w;u++){z=I[u];n=n.concat(z)}var A,B,G,L,K,F=n.length,M,N=J.length,r=[],D=0;G=C.length;A=G-1;for(B=D+1;D<G;D++,A++,B++){A===G&&(A=0);B===G&&(B=0);r[D]=d(C[D],C[A],C[B])}var T=[],P,S=r.concat();
|
|
|
-u=0;for(w=I.length;u<w;u++){z=I[u];P=[];D=0;G=z.length;A=G-1;for(B=D+1;D<G;D++,A++,B++){A===G&&(A=0);B===G&&(B=0);P[D]=d(z[D],z[A],z[B])}T.push(P);S=S.concat(P)}for(A=0;A<k;A++){G=A/k;L=j*(1-G);B=i*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,-L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);e(K.x,K.y,-L)}}}B=i;for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[0]).multiplyScalar(K.x);o.copy(v.binormals[0]).multiplyScalar(K.y);
|
|
|
-y.copy(m[0]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,0)}for(G=1;G<=l;G++)for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[G]).multiplyScalar(K.x);o.copy(v.binormals[G]).multiplyScalar(K.y);y.copy(m[G]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,h/l*G)}for(A=k-1;A>=0;A--){G=A/k;L=j*(1-G);B=i*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,h+L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);p?e(K.x,
|
|
|
+u=0;for(w=I.length;u<w;u++){z=I[u];P=[];D=0;G=z.length;A=G-1;for(B=D+1;D<G;D++,A++,B++){A===G&&(A=0);B===G&&(B=0);P[D]=d(z[D],z[A],z[B])}T.push(P);S=S.concat(P)}for(A=0;A<k;A++){G=A/k;L=i*(1-G);B=j*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,-L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);e(K.x,K.y,-L)}}}B=j;for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[0]).multiplyScalar(K.x);o.copy(v.binormals[0]).multiplyScalar(K.y);
|
|
|
+y.copy(m[0]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,0)}for(G=1;G<=l;G++)for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[G]).multiplyScalar(K.x);o.copy(v.binormals[G]).multiplyScalar(K.y);y.copy(m[G]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,h/l*G)}for(A=k-1;A>=0;A--){G=A/k;L=i*(1-G);B=j*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,h+L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);p?e(K.x,
|
|
|
K.y+m[l-1].y,m[l-1].x+L):e(K.x,K.y,h+L)}}}var O=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(q){var a;a=F*0;for(D=0;D<N;D++){M=J[D];g(M[2]+a,M[1]+a,M[0]+a,true)}a=l+k*2;a=F*a;for(D=0;D<N;D++){M=J[D];g(M[0]+a,M[1]+a,M[2]+a,false)}}else{for(D=0;D<N;D++){M=J[D];g(M[2],M[1],M[0],true)}for(D=0;D<N;D++){M=J[D];g(M[0]+F*l,M[1]+F*l,M[2]+F*l,false)}}})();(function(){var a=0;f(C,a);a=a+C.length;u=0;for(w=I.length;u<w;u++){z=I[u];f(z,a);a=a+z.length}})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].position.x;f=a.vertices[f].position.y;c=a.vertices[e].position.x;e=a.vertices[e].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-f),new THREE.UV(c,1-e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].position.x,c=a.vertices[f].position.y,f=a.vertices[f].position.z,
|
|
|
-d=a.vertices[e].position.x,j=a.vertices[e].position.y,e=a.vertices[e].position.z,i=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return Math.abs(c-j)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(i,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(j,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+d=a.vertices[e].position.x,i=a.vertices[e].position.y,e=a.vertices[e].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return Math.abs(c-i)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],f=(new THREE.Matrix4).makeRotationZ(c/b),e=0;e<a.length;e++){d[e]=a[e].clone();this.vertices.push(new THREE.Vertex(d[e]))}for(var g=b+1,c=0;c<g;c++)for(e=0;e<d.length;e++){d[e]=f.multiplyVector3(d[e].clone());this.vertices.push(new THREE.Vertex(d[e]))}for(c=0;c<b;c++){d=0;for(f=a.length;d<f-1;d++){this.faces.push(new THREE.Face4(c*f+d,(c+1)%g*f+d,(c+1)%g*f+(d+1)%f,c*f+(d+1)%f));this.faceVertexUvs[0].push([new THREE.UV(1-
|
|
|
c/b,d/f),new THREE.UV(1-(c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/f)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,i=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*j-f,0,a*i-e)));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(k);f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,
|
|
|
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,0,a*j-e)));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(k);f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone());this.faces.push(f);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,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,i=[],k=[];for(j=0;j<=c;j++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=j/c,m=-a*Math.cos(d+n*f)*Math.sin(e+r*g),p=a*Math.cos(e+r*g),t=a*Math.sin(d+n*f)*Math.sin(e+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,p,t)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
|
|
|
-r))}i.push(q);k.push(l)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=i[j][h+1],f=i[j][h],e=i[j+1][h],g=i[j+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),m=k[j][h+1].clone(),p=k[j][h].clone(),t=k[j+1][h].clone(),s=k[j+1][h+1].clone();if(Math.abs(this.vertices[d].position.y)==a){this.faces.push(new THREE.Face3(d,e,g,[q,n,r]));this.faceVertexUvs[0].push([m,
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=-a*Math.cos(d+n*f)*Math.sin(e+r*g),p=a*Math.cos(e+r*g),t=a*Math.sin(d+n*f)*Math.sin(e+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,p,t)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
|
|
|
+r))}j.push(q);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),p=k[i][h].clone(),t=k[i+1][h].clone(),s=k[i+1][h+1].clone();if(Math.abs(this.vertices[d].position.y)==a){this.faces.push(new THREE.Face3(d,e,g,[q,n,r]));this.faceVertexUvs[0].push([m,
|
|
|
t,s])}else if(Math.abs(this.vertices[e].position.y)==a){this.faces.push(new THREE.Face3(d,f,e,[q,l,n]));this.faceVertexUvs[0].push([m,p,t])}else{this.faces.push(new THREE.Face4(d,f,e,g,[q,l,n,r]));this.faceVertexUvs[0].push([m,p,t,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=false;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,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[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,f){var e=[],g,h,j,i,k,q,l,n,r,m,p,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));i=b.length;for(a=0;a<i;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,k));f.moveTo(j,k);break;case "l":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,
|
|
|
-k));f.lineTo(j,k);break;case "q":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,j,k);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,v=THREE.Shape.Utils.b2(s,q,n,j),s=THREE.Shape.Utils.b2(s,l,r,k);e.push(new THREE.Vector2(v,s))}}break;case "b":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;p=b[a++]*-c;f.bezierCurveTo(j,k,n,r,m,p);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;v=THREE.Shape.Utils.b3(s,q,n,
|
|
|
-m,j);s=THREE.Shape.Utils.b3(s,l,r,p,k);e.push(new THREE.Vector2(v,s))}}}}}return{offset:t.ha*c,points:e,path:f}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],j,i,k;if(b(a)>0)for(i=0;i<f;i++)g[i]=i;else for(i=0;i<f;i++)g[i]=f-1-i;var q=2*f;for(i=f-1;f>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");break}j=i;f<=j&&(j=0);i=j+1;f<=i&&(i=0);k=i+1;f<=k&&(k=0);var l;a:{l=a;var n=j,r=i,m=k,p=f,t=g,s=void 0,v=void 0,o=void 0,x=void 0,y=void 0,
|
|
|
-z=void 0,u=void 0,w=void 0,E=void 0,v=l[t[n]].x,o=l[t[n]].y,x=l[t[r]].x,y=l[t[r]].y,z=l[t[m]].x,u=l[t[m]].y;if(1.0E-10>(x-v)*(u-o)-(y-o)*(z-v))l=false;else{for(s=0;s<p;s++)if(!(s==n||s==r||s==m)){var w=l[t[s]].x,E=l[t[s]].y,H=void 0,I=void 0,J=void 0,C=void 0,A=void 0,B=void 0,G=void 0,L=void 0,K=void 0,F=void 0,M=void 0,N=void 0,H=J=A=void 0,H=z-x,I=u-y,J=v-z,C=o-u,A=x-v,B=y-o,G=w-v,L=E-o,K=w-x,F=E-y,M=w-z,N=E-u,H=H*F-I*K,A=A*L-B*G,J=J*N-C*M;if(H>=0&&J>=0&&A>=0){l=false;break a}}l=true}}if(l){e.push([a[g[j]],
|
|
|
-a[g[i]],a[g[k]]]);h.push([g[j],g[i],g[k]]);j=i;for(k=i+1;k<f;j++,k++)g[j]=g[k];f--;q=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+0,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[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,f){var e=[],g,h,i,j,k,q,l,n,r,m,p,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,
|
|
|
+k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,i,k);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,v=THREE.Shape.Utils.b2(s,q,n,i),s=THREE.Shape.Utils.b2(s,l,r,k);e.push(new THREE.Vector2(v,s))}}break;case "b":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;p=b[a++]*-c;f.bezierCurveTo(i,k,n,r,m,p);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;v=THREE.Shape.Utils.b3(s,q,n,
|
|
|
+m,i);s=THREE.Shape.Utils.b3(s,l,r,p,k);e.push(new THREE.Vector2(v,s))}}}}}return{offset:t.ha*c,points:e,path:f}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var q=2*f;for(j=f-1;f>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,r=j,m=k,p=f,t=g,s=void 0,v=void 0,o=void 0,x=void 0,y=void 0,
|
|
|
+z=void 0,u=void 0,w=void 0,E=void 0,v=l[t[n]].x,o=l[t[n]].y,x=l[t[r]].x,y=l[t[r]].y,z=l[t[m]].x,u=l[t[m]].y;if(1.0E-10>(x-v)*(u-o)-(y-o)*(z-v))l=false;else{for(s=0;s<p;s++)if(!(s==n||s==r||s==m)){var w=l[t[s]].x,E=l[t[s]].y,H=void 0,I=void 0,J=void 0,C=void 0,A=void 0,B=void 0,G=void 0,L=void 0,K=void 0,F=void 0,M=void 0,N=void 0,H=J=A=void 0,H=z-x,I=u-y,J=v-z,C=o-u,A=x-v,B=y-o,G=w-v,L=E-o,K=w-x,F=E-y,M=w-z,N=E-u,H=H*F-I*K,A=A*L-B*G,J=J*N-C*M;if(H>=0&&J>=0&&A>=0){l=false;break a}}l=true}}if(l){e.push([a[g[i]],
|
|
|
+a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);i=j;for(k=j+1;k<f;i++,k++)g[i]=g[k];f--;q=2*f}}return d?h:e};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,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);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(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);j.normal.addSelf(b[f]);j.normal.addSelf(b[e]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
|
|
|
+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(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
|
this.faceVertexUvs[0].push([a[f].clone(),a[e].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,f,e,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;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=f||2;this.q=e||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,e);d.add(j,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(j*d.x+g*f.x);e.y=e.y+(j*d.y+g*f.y);e.z=e.z+(j*d.z+g*f.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 f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,j,i,k])}this.computeCentroids();
|
|
|
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=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,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*d.z+g*f.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 f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,j,i,k,q=new THREE.Vector3,l,n,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;r=b.binormals;this.tangents=l;this.normals=n;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
-k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;i=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);q.copy(k);q.x=q.x+(i*g.x+j*h.x);q.y=q.y+(i*g.y+j*h.y);q.z=q.z+(i*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(q.x,q.y,q.z)))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;q=(d+1)%this.segmentsRadius;
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,j,k,q=new THREE.Vector3,l,n,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;r=b.binormals;this.tangents=l;this.normals=n;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
+k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);q.copy(k);q.x=q.x+(j*g.x+i*h.x);q.y=q.y+(j*g.y+i*h.y);q.z=q.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(q.x,q.y,q.z)))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;q=(d+1)%this.segmentsRadius;
|
|
|
a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][q];q=this.grid[b][q];l=new THREE.UV(b/this.segments,d/this.segmentsRadius);n=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,q));this.faceVertexUvs[0].push([l,n,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,i,k,q;this.tangents=f;this.normals=e;this.binormals=g;for(i=0;i<b;i++){k=i/(b-1);f[i]=a.getTangentAt(k);f[i].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(f[0].x);k=Math.abs(f[0].y);q=Math.abs(f[0].z);if(i<=a){a=i;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}q<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
|
|
|
-e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(i=1;i<b;i++){e[i]=e[i-1].clone();g[i]=g[i-1].clone();h.cross(f[i-1],f[i]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(f[i-1].dot(f[i]));j.makeRotationAxis(h,d).multiplyVector3(e[i])}g[i].cross(f[i],e[i])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(i=1;i<b;i++){j.makeRotationAxis(f[i],d*i).multiplyVector3(e[i]);g[i].cross(f[i],e[i])}}};
|
|
|
-THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]);d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3);d.normal=d.centroid.clone().normalize();
|
|
|
-j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];c===void 0&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(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);for(var c=c||1,d=d||0,j=this,i=0,k=a.length;i<k;i++)f(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var q=[],a=this.vertices,i=0,k=b.length;i<k;i++)e(a[b[i][0]],a[b[i][1]],a[b[i][2]],d);this.mergeVertices();i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,k,q;this.tangents=f;this.normals=e;this.binormals=g;for(j=0;j<b;j++){k=j/(b-1);f[j]=a.getTangentAt(k);f[j].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(f[0].x);k=Math.abs(f[0].y);q=Math.abs(f[0].z);if(j<=a){a=j;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}q<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
|
|
|
+e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(j=1;j<b;j++){e[j]=e[j-1].clone();g[j]=g[j-1].clone();h.cross(f[j-1],f[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(f[j-1].dot(f[j]));i.makeRotationAxis(h,d).multiplyVector3(e[j])}g[j].cross(f[j],e[j])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(f[j],d*j).multiplyVector3(e[j]);g[j].cross(f[j],e[j])}}};
|
|
|
+THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]);d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3);d.normal=d.centroid.clone().normalize();
|
|
|
+i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];c===void 0&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(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);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
|
|
|
THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
|
|
@@ -238,50 +238,50 @@ this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.li
|
|
|
THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraHelper.__v.set(d,f,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
|
|
|
-1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};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(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,i){var j=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){j.vertexColors=[];for(var m,n,p,r=0;r<4;r++){p=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var o=0;o<p.length;o++){n=g.vertexColors[p[o]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/p.length;m.g=m.g/p.length;m.b=m.b/p.length;
|
|
|
-j.vertexColors[r]=m}}k.push(j);if(l.supportUVs){g=[e(a,""),e(c,i),e(d,i),e(f,i)];g[0]?g[1]?g[2]?g[3]?q.push(g):b("d :( ",f+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=v&&a<v+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
|
|
|
-b){J[a]===void 0&&(J[a]=[]);J[a].push(b)}function j(a,b,c){C[a]===void 0&&(C[a]={});C[a][b]=c}var i=[],k=[],q=[],l=this,n=a.vertices,r=a.faces,i=n.concat(),m=[],p={},t={},s={},v=n.length,o,x,y,z,u,w=a.faceVertexUvs[0],E;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,v);if(l.supportUVs){o=0;for(x=w.length;o<x;o++){y=0;for(z=w[o].length;y<z;y++){E=r[o]["abcd".charAt(y)];g(E,o,w[o][y])}}}if(w.length==0)l.supportUVs=false;o=0;for(u in s)o++;if(!o){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
-s,"vs",w.length);o=0;for(x=r.length;o<x;o++){u=r[o];m.push(u.centroid);i.push(new THREE.Vertex(u.centroid));if(l.supportUVs){w=new THREE.UV;if(u instanceof THREE.Face3){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v;w.u=w.u/3;w.v=w.v/3}else if(u instanceof THREE.Face4){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u+e(u.d,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v+e(u.d,o).v;w.u=w.u/4;w.v=w.v/4}g(v+o,"",w)}}b("-- added UVs for new Faces",s);x=function(a){function b(a,c){h[a]===void 0&&
|
|
|
-(h[a]=[]);h[a].push(c)}var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);E=0;var H,I,J={},C={};for(o in x){w=x[o];H=o.split("_");I=H[0];H=H[1];h(I,[I,H]);h(H,[I,H]);y=0;for(z=w.length;y<z;y++){u=w[y];j(I,u,o);j(H,u,o)}w.length<2&&(t[o]=true)}b("vertexEdgeMap",J,"vertexFaceMap",
|
|
|
-C);for(o in x){w=x[o];u=w[0];z=w[1];H=o.split("_");I=H[0];H=H[1];w=new THREE.Vector3;if(t[o]){w.addSelf(n[I].position);w.addSelf(n[H].position);w.multiplyScalar(0.5)}else{w.addSelf(m[u]);w.addSelf(m[z]);w.addSelf(n[I].position);w.addSelf(n[H].position);w.multiplyScalar(0.25)}p[o]=v+r.length+E;i.push(new THREE.Vertex(w));E++;if(l.supportUVs){w=new THREE.UV;w.u=e(I,u).u+e(H,u).u;w.v=e(I,u).v+e(H,u).v;w.u=w.u/2;w.v=w.v/2;g(p[o],u,w);if(!t[o]){w=new THREE.UV;w.u=e(I,z).u+e(H,z).u;w.v=e(I,z).v+e(H,z).v;
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,j){var i=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){i.vertexColors=[];for(var m,n,p,r=0;r<4;r++){p=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var o=0;o<p.length;o++){n=g.vertexColors[p[o]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/p.length;m.g=m.g/p.length;m.b=m.b/p.length;
|
|
|
+i.vertexColors[r]=m}}k.push(i);if(l.supportUVs){g=[e(a,""),e(c,j),e(d,j),e(f,j)];g[0]?g[1]?g[2]?g[3]?q.push(g):b("d :( ",f+":"+j):b("c :( ",d+":"+j):b("b :( ",c+":"+j):b("a :( ",a+":"+j)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=v&&a<v+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
|
|
|
+b){J[a]===void 0&&(J[a]=[]);J[a].push(b)}function i(a,b,c){C[a]===void 0&&(C[a]={});C[a][b]=c}var j=[],k=[],q=[],l=this,n=a.vertices,r=a.faces,j=n.concat(),m=[],p={},t={},s={},v=n.length,o,x,y,z,u,w=a.faceVertexUvs[0],E;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,v);if(l.supportUVs){o=0;for(x=w.length;o<x;o++){y=0;for(z=w[o].length;y<z;y++){E=r[o]["abcd".charAt(y)];g(E,o,w[o][y])}}}if(w.length==0)l.supportUVs=false;o=0;for(u in s)o++;if(!o){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
+s,"vs",w.length);o=0;for(x=r.length;o<x;o++){u=r[o];m.push(u.centroid);j.push(new THREE.Vertex(u.centroid));if(l.supportUVs){w=new THREE.UV;if(u instanceof THREE.Face3){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v;w.u=w.u/3;w.v=w.v/3}else if(u instanceof THREE.Face4){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u+e(u.d,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v+e(u.d,o).v;w.u=w.u/4;w.v=w.v/4}g(v+o,"",w)}}b("-- added UVs for new Faces",s);x=function(a){function b(a,c){h[a]===void 0&&
|
|
|
+(h[a]=[]);h[a].push(c)}var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);E=0;var H,I,J={},C={};for(o in x){w=x[o];H=o.split("_");I=H[0];H=H[1];h(I,[I,H]);h(H,[I,H]);y=0;for(z=w.length;y<z;y++){u=w[y];i(I,u,o);i(H,u,o)}w.length<2&&(t[o]=true)}b("vertexEdgeMap",J,"vertexFaceMap",
|
|
|
+C);for(o in x){w=x[o];u=w[0];z=w[1];H=o.split("_");I=H[0];H=H[1];w=new THREE.Vector3;if(t[o]){w.addSelf(n[I].position);w.addSelf(n[H].position);w.multiplyScalar(0.5)}else{w.addSelf(m[u]);w.addSelf(m[z]);w.addSelf(n[I].position);w.addSelf(n[H].position);w.multiplyScalar(0.25)}p[o]=v+r.length+E;j.push(new THREE.Vertex(w));E++;if(l.supportUVs){w=new THREE.UV;w.u=e(I,u).u+e(H,u).u;w.v=e(I,u).v+e(H,u).v;w.u=w.u/2;w.v=w.v/2;g(p[o],u,w);if(!t[o]){w=new THREE.UV;w.u=e(I,z).u+e(H,z).u;w.v=e(I,z).v+e(H,z).v;
|
|
|
w.u=w.u/2;w.v=w.v/2;g(p[o],z,w)}}}b("-- Step 2 done");var A,B;z=["123","12","2","23"];H=["123","23","3","31"];var G=["123","31","1","12"],L=["1234","12","2","23"],K=["1234","23","3","34"],F=["1234","34","4","41"],M=["1234","41","1","12"];o=0;for(x=m.length;o<x;o++){u=r[o];w=v+o;if(u instanceof THREE.Face3){E=f(u.a,u.b);I=f(u.b,u.c);A=f(u.c,u.a);d(w,p[E],u.b,p[I],u,z,o);d(w,p[I],u.c,p[A],u,H,o);d(w,p[A],u.a,p[E],u,G,o)}else if(u instanceof THREE.Face4){E=f(u.a,u.b);I=f(u.b,u.c);A=f(u.c,u.d);B=f(u.d,
|
|
|
u.a);d(w,p[E],u.b,p[I],u,L,o);d(w,p[I],u.c,p[A],u,K,o);d(w,p[A],u.d,p[B],u,F,o);d(w,p[B],u.a,p[E],u,M,o)}else b("face should be a face!",u)}p=new THREE.Vector3;u=new THREE.Vector3;o=0;for(x=n.length;o<x;o++)if(J[o]!==void 0){p.set(0,0,0);u.set(0,0,0);I=new THREE.Vector3(0,0,0);w=0;for(y in C[o]){p.addSelf(m[y]);w++}z=0;E=J[o].length;for(y=0;y<E;y++)t[f(J[o][y][0],J[o][y][1])]&&z++;if(z!=2){p.divideScalar(w);for(y=0;y<E;y++){w=J[o][y];w=n[w[0]].position.clone().addSelf(n[w[1]].position).divideScalar(2);
|
|
|
-u.addSelf(w)}u.divideScalar(E);I.addSelf(n[o].position);I.multiplyScalar(E-3);I.addSelf(p);I.addSelf(u.multiplyScalar(2));I.divideScalar(E);i[o].position=I}}a.vertices=i;a.faces=k;a.faceVertexUvs[0]=q;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(){}};
|
|
|
+u.addSelf(w)}u.divideScalar(E);I.addSelf(n[o].position);I.multiplyScalar(E-3);I.addSelf(p);I.addSelf(u.multiplyScalar(2));I.divideScalar(E);j[o].position=I}}a.vertices=j;a.faces=k;a.faceVertexUvs[0]=q;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:"anonymous",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(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++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},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 f(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=true};e.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
|
|
|
-d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,j="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
-if(a.shading){var k=a.shading.toLowerCase();k==="phong"?j="MeshPhongMaterial":k==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;
|
|
|
-if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(j.uniforms);k.tNormal.texture=i.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(i.map){k.tDiffuse.texture=i.map;k.enableDiffuse.value=true}if(i.specularMap){k.tSpecular.texture=i.specularMap;k.enableSpecular.value=true}if(i.lightMap){k.tAO.texture=i.lightMap;
|
|
|
-k.enableAO.value=true}k.uDiffuseColor.value.setHex(i.color);k.uSpecularColor.value.setHex(i.specular);k.uAmbientColor.value.setHex(i.ambient);k.uShininess.value=i.shininess;if(i.opacity!==void 0)k.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:true,fog:true})}else i=new THREE[j](i);if(a.DbgName!==void 0)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,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 f(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=true};e.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
|
|
|
+d;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
+if(a.shading){var k=a.shading.toLowerCase();k==="phong"?i="MeshPhongMaterial":k==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
|
|
|
+if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&e(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map){k.tDiffuse.texture=j.map;k.enableDiffuse.value=true}if(j.specularMap){k.tSpecular.texture=j.specularMap;k.enableSpecular.value=true}if(j.lightMap){k.tAO.texture=j.lightMap;
|
|
|
+k.enableAO.value=true}k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(j.opacity!==void 0)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};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){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&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,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){h==0&&(h=e.getResponseHeader("Content-Length"));f({total:h,loaded:e.responseText.length})}}else e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};
|
|
|
e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,j,i,k,q,l,n,r,m,p,t,s,v,o;function x(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];i=G[f*2];j=G[f*2+1];f=G[g*2];k=G[g*2+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
|
|
|
-k));g.push(m)}}function w(b,c){var d,e,f,g,h,i,j,k,l,m,q=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=q[d*4];f=q[d*4+1];g=q[d*4+2];h=q[d*4+3];i=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=C.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}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[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
|
|
|
-C.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function H(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[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];C.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function I(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var q=B[k*3],n=B[k*3+1];k=B[k*3+2];var p=B[l*3],
|
|
|
-r=B[l*3+1];l=B[l*3+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(B[j*3],B[j*3+1],B[j*3+2]),new THREE.Vector3(q,n,k),new THREE.Vector3(p,r,l)],null,i))}}function J(b,c,d,e){for(var f,g,h,i,j,k,l,m,q,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];q=d[e*4+3];j=n[e];var p=B[l*3],r=B[l*3+1];l=B[l*3+2];var o=B[m*3],t=B[m*3+1];m=B[m*3+2];var s=B[q*3],u=B[q*3+1];q=B[q*3+2];C.faces.push(new THREE.Face4(f,
|
|
|
-g,h,i,[new THREE.Vector3(B[k*3],B[k*3+1],B[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(o,t,m),new THREE.Vector3(s,u,q)],null,j))}}var C=this,A=0,B=[],G=[],L,K,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,A,12);c=y(a,A+12);y(a,A+13);y(a,A+14);y(a,A+15);f=y(a,A+16);j=y(a,A+17);i=y(a,A+18);k=y(a,A+19);q=z(a,A+20);l=z(a,A+20+4);n=z(a,A+20+8);b=z(a,A+20+12);r=
|
|
|
-z(a,A+20+16);m=z(a,A+20+20);p=z(a,A+20+24);t=z(a,A+20+28);s=z(a,A+20+32);v=z(a,A+20+36);o=z(a,A+20+40);A=A+c;c=f*3+k;F=f*4+k;L=b*c;K=r*(c+j*3);f=m*(c+i*3);k=p*(c+j*3+i*3);c=t*F;j=s*(F+j*4);i=v*(F+i*4);A=A+function(b){var b=new Float32Array(a,b,q*3),c,d,e,f;for(c=0;c<q;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)))}return q*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*
|
|
|
-3+1];f=b[c*3+2];B.push(d/127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(l*3);A=A+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(A);L=A+L+x(b*2);K=L+K+x(r*2);f=K+f+x(m*2);k=f+k+x(p*2);c=k+c+x(t*2);j=c+j+x(s*2);i=j+i+x(v*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;E(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);u(m,b)}})(K);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
-3,c=b+p*Uint32Array.BYTES_PER_ELEMENT*3;I(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);u(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;H(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);w(v,b)}})(j);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*4,c=b+o*Uint32Array.BYTES_PER_ELEMENT*4;J(o,a,b,c+o*Uint32Array.BYTES_PER_ELEMENT*4);w(o,c)}})(i);b&&E(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;I(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,q,l,n,r,m,p,t,s,v,o;function x(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];i=G[f*2+1];f=G[g*2];k=G[g*2+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));m.push(new THREE.UV(f,
|
|
|
+k));g.push(m)}}function w(b,c){var d,e,f,g,h,j,i,k,l,m,q=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=q[d*4];f=q[d*4+1];g=q[d*4+2];h=q[d*4+3];j=G[e*2];e=G[e*2+1];i=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=C.faceVertexUvs[0];var n=[];n.push(new THREE.UV(j,e));n.push(new THREE.UV(i,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
|
|
|
+C.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function H(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];C.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function I(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];l=d[e*3+2];j=m[e];var q=B[k*3],n=B[k*3+1];k=B[k*3+2];var p=B[l*3],
|
|
|
+r=B[l*3+1];l=B[l*3+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(B[i*3],B[i*3+1],B[i*3+2]),new THREE.Vector3(q,n,k),new THREE.Vector3(p,r,l)],null,j))}}function J(b,c,d,e){for(var f,g,h,j,i,k,l,m,q,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];q=d[e*4+3];i=n[e];var p=B[l*3],r=B[l*3+1];l=B[l*3+2];var o=B[m*3],t=B[m*3+1];m=B[m*3+2];var s=B[q*3],u=B[q*3+1];q=B[q*3+2];C.faces.push(new THREE.Face4(f,
|
|
|
+g,h,j,[new THREE.Vector3(B[k*3],B[k*3+1],B[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(o,t,m),new THREE.Vector3(s,u,q)],null,i))}}var C=this,A=0,B=[],G=[],L,K,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,A,12);c=y(a,A+12);y(a,A+13);y(a,A+14);y(a,A+15);f=y(a,A+16);i=y(a,A+17);j=y(a,A+18);k=y(a,A+19);q=z(a,A+20);l=z(a,A+20+4);n=z(a,A+20+8);b=z(a,A+20+12);r=
|
|
|
+z(a,A+20+16);m=z(a,A+20+20);p=z(a,A+20+24);t=z(a,A+20+28);s=z(a,A+20+32);v=z(a,A+20+36);o=z(a,A+20+40);A=A+c;c=f*3+k;F=f*4+k;L=b*c;K=r*(c+i*3);f=m*(c+j*3);k=p*(c+i*3+j*3);c=t*F;i=s*(F+i*4);j=v*(F+j*4);A=A+function(b){var b=new Float32Array(a,b,q*3),c,d,e,f;for(c=0;c<q;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)))}return q*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*
|
|
|
+3+1];f=b[c*3+2];B.push(d/127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(l*3);A=A+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(A);L=A+L+x(b*2);K=L+K+x(r*2);f=K+f+x(m*2);k=f+k+x(p*2);c=k+c+x(t*2);i=c+i+x(s*2);j=i+j+x(v*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;E(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);u(m,b)}})(K);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+3,c=b+p*Uint32Array.BYTES_PER_ELEMENT*3;I(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);u(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;H(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);w(v,b)}})(i);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*4,c=b+o*Uint32Array.BYTES_PER_ELEMENT*4;J(o,a,b,c+o*Uint32Array.BYTES_PER_ELEMENT*4);w(o,c)}})(j);b&&E(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;I(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
3)}})(L);t&&H(t,k,k+t*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;J(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,f){Q=a;d=d||na;if(f!==void 0){a=f.split("/");a.pop();oa=(a.length<1?".":a.join("/"))+"/"}if((a=Q.evaluate("//dae:asset",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ba=i.textContent.charAt(0)}}if(!R.convertUpAxis||ba===R.upAxis)X=null;else switch(ba){case "X":X=R.upAxis===
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,f){Q=a;d=d||na;if(f!==void 0){a=f.split("/");a.pop();oa=(a.length<1?".":a.join("/"))+"/"}if((a=Q.evaluate("//dae:asset",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var j=a.childNodes[f];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":ba=j.textContent.charAt(0)}}if(!R.convertUpAxis||ba===R.upAxis)X=null;else switch(ba){case "X":X=R.upAxis===
|
|
|
"Y"?"XtoY":"XtoZ";break;case "Y":X=R.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":X=R.upAxis==="X"?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",w,"material");ha=b("//dae:library_effects/dae:effect",C,"effect");W=b("//dae:library_geometries/dae:geometry",p,"geometry");ia=b(".//dae:library_cameras/dae:camera",F,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",B,"animation");
|
|
|
ja=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ca=[];da=[];if(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");U=ja[a.length>0?a:"visual_scene0"]}else U=null;$=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)$.add(e(U.nodes[a]));ka=[];c($);a={scene:$,morphs:ca,skins:da,animations:ka,dae:{images:aa,materials:ga,cameras:ia,effects:ha,geometries:W,controllers:V,animations:Y,
|
|
|
visualScenes:ja,scene:U}};d&&d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=U.getChildById(a.name,true),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};ka.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 f(a,b,c){var e,f=V[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 Y)for(var i=Y[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=U.getChildById(b.skeleton[0],true)||U.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,q,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(m=0;m<j.length;m++){l=j[m];q=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){q=n;break}if(q>=0){n=k.invBindMatrices[q];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==q&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
-l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++){l=h[j].weights[k];m=l.index;l=l.weight;q=a.vertices[m];m=i[m];g.x=q.position.x;g.y=q.position.y;g.z=q.position.z;h[j].skinningMatrix.multiplyVector3(g);m.position.x=m.position.x+g.x*l;m.position.y=m.position.y+g.y*l;m.position.z=m.position.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:i})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=V[a.controllers[g].url];
|
|
|
-switch(i.type){case "skin":if(W[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(V[i.skin.source]){d=i=V[i.skin.source];if(i.morph&&W[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(W[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=W[i.url],k={},l=[],q=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 r=ga[p.target],o=ha[r.instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;k[p.symbol]=q;l.push(o.material);p=o.material;p.name=r.name==null||r.name===""?r.id:r.name;q++}j=
|
|
|
-p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(q>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){f(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=V[c.url];j.skinInstanceController=c;j.name="skin_"+da.length;da.push(j)}else if(d!==void 0){h=i;k=d instanceof n?V[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++){q=W[k.targets[l]];if(q.mesh&&q.mesh.primitives&&q.mesh.primitives.length){q=q.mesh.primitives[0].geometry;q.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:q.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ca.length;ca.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=ia[a.cameras[g].url];
|
|
|
+!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 Y)for(var j=Y[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];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=U.getChildById(b.skeleton[0],true)||U.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,q,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
|
|
|
+for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++){l=i[m];q=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){q=n;break}if(q>=0){n=k.invBindMatrices[q];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==q&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
+l.sid+"'.";}}for(i=0;i<h.length;i++)if(h[i].type=="JOINT")for(k=0;k<h[i].weights.length;k++){l=h[i].weights[k];m=l.index;l=l.weight;q=a.vertices[m];m=j[m];g.x=q.position.x;g.y=q.position.y;g.z=q.position.z;h[i].skinningMatrix.multiplyVector3(g);m.position.x=m.position.x+g.x*l;m.position.y=m.position.y+g.y*l;m.position.z=m.position.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:j})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=V[a.controllers[g].url];
|
|
|
+switch(j.type){case "skin":if(W[j.skin.source]){var i=new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(V[j.skin.source]){d=j=V[j.skin.source];if(j.morph&&W[j.morph.source]){i=new m;i.url=j.morph.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i)}}break;case "morph":if(W[j.morph.source]){i=new m;i.url=j.morph.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);
|
|
|
+d=a.controllers[g]}console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=W[j.url],k={},l=[],q=0,p;if(j&&j.mesh&&j.mesh.primitives){if(b.name.length==0)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var r=ga[p.target],o=ha[r.instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;k[p.symbol]=q;l.push(o.material);p=o.material;p.name=r.name==null||r.name===""?r.id:r.name;q++}i=
|
|
|
+p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(q>1){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++){l=j.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){f(j,c);i.morphTargets=true;i=new THREE.SkinnedMesh(j,i);i.skeleton=c.skeleton;i.skinController=V[c.url];i.skinInstanceController=c;i.name="skin_"+da.length;da.push(i)}else if(d!==void 0){h=j;k=d instanceof n?V[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++){q=W[k.targets[l]];if(q.mesh&&q.mesh.primitives&&q.mesh.primitives.length){q=q.mesh.primitives[0].geometry;q.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:q.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=true;i=new THREE.Mesh(j,i);i.name="morph_"+ca.length;ca.push(i)}else i=new THREE.Mesh(j,i);a.geometries.length>1?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++){b=ia[a.cameras[g].url];
|
|
|
b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(R.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}for(g=0;g<a.nodes.length;g++)b.add(e(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 j(){this.weights=this.targets=this.source=this.method=null}function i(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url=
|
|
|
+null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url=
|
|
|
"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){s.call(this);this.vcount=[]}function o(){s.call(this);this.vcount=3}function x(){this.source="";this.stride=
|
|
|
this.count=0;this.params=[]}function y(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function u(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function E(){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 H(a,b){this.type=a;this.effect=b;this.material=null}function I(a){this.effect=a;this.format=this.init_from=
|
|
|
null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function C(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function A(){this.url=""}function B(){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 L(a){this.id="";this.animation=a;this.inputs=[];
|
|
@@ -290,19 +290,19 @@ this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.i
|
|
|
a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(R.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])}function ma(a){if(R.convertUpAxis)switch(a){case "X":switch(X){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(X){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(X){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var Q=null,$=null,U,na=null,Z={},aa={},
|
|
|
Y={},V={},W={},ga={},ha={},ia={},ka,ja,oa,ca,da,pa=THREE.SmoothShading,R={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},ba="Y",X=null,la=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(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 i).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.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 u).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.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 z).parse(d))}}return b};i.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=D(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new u).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};i.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 z).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()}}};i.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 z).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":d=T(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=
|
|
|
-e[l],q=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=q;break;case "WEIGHT":k.weight=b[m.source].data[q]}}i.push(k);g=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.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};k.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};k.prototype.parse=function(a){this.id=
|
|
|
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).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 u).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++){a=c[d];e=b[a.source];switch(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 z).parse(d))}}return b};j.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=D(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new u).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};j.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 z).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()}}};j.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 z).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":d=T(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},l=0;l<e.length;l++){var m=
|
|
|
+e[l],q=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=q;break;case "WEIGHT":k.weight=b[m.source].data[q]}}j.push(k);g=g+e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};k.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};k.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};k.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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return 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.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];
|
|
|
if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":this.cameras.push((new M).parse(b));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=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,N,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 l).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in Y)for(var e=Y[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++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var p=i.arrIndices.length;b<p;b++){var r=k,o=b,t=i.arrIndices[b];if(t>-1&&t<3){t=ma(["X","Y","Z"][t]);t={X:0,Y:1,Z:2}[t]}r[o]=t}}else k=ma(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(p=h.length;b<p;b++){for(var r=h[b],i=g.getData(j.type,b),o=null,t=0,s=d.length;t<s&&o==null;t++){var u=d[t];if(u.time===
|
|
|
-r)o=u;else if(u.time>r)break}if(!o){o=new K(r);t=-1;s=0;for(u=d.length;s<u&&t==-1;s++)d[s].time>=r&&(t=s);r=t;d.splice(r==-1?d.length:r,0,o)}o.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){o=d[b];if(!o.hasTarget(e)){h=d;f=o;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){p=h[j];if(p.hasTarget(g)){j=p;break a}}j=null}p=void 0;a:{for(k=k+1;k<h.length;k++){p=h[k];if(p.hasTarget(g))break a}p=
|
|
|
-null}if(j&&p){h=(f.time-j.time)/(p.time-j.time);j=j.getTarget(g);k=p.getTarget(g).data;p=j.data;i=void 0;if(j.type==="matrix")i=p;else if(p.length){i=[];for(r=0;r<p.length;++r)i[r]=p[r]+(k[r]-p[r])*h}else i=p+(k-p)*h;f.addTarget(g,j.transform,j.member,i)}}}}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)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");
|
|
|
+a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var j=this.channels[c],f=j.fullSid,g=j.sampler,h=g.input,i=this.getTransformBySid(j.sid),k;if(j.arrIndices){k=[];b=0;for(var p=j.arrIndices.length;b<p;b++){var r=k,o=b,t=j.arrIndices[b];if(t>-1&&t<3){t=ma(["X","Y","Z"][t]);t={X:0,Y:1,Z:2}[t]}r[o]=t}}else k=ma(j.member);if(i){a.indexOf(f)===-1&&a.push(f);b=0;for(p=h.length;b<p;b++){for(var r=h[b],j=g.getData(i.type,b),o=null,t=0,s=d.length;t<s&&o==null;t++){var u=d[t];if(u.time===
|
|
|
+r)o=u;else if(u.time>r)break}if(!o){o=new K(r);t=-1;s=0;for(u=d.length;s<u&&t==-1;s++)d[s].time>=r&&(t=s);r=t;d.splice(r==-1?d.length:r,0,o)}o.addTarget(f,i,k,j)}}else console.log('Could not find transform "'+j.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){o=d[b];if(!o.hasTarget(e)){h=d;f=o;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=i>=0?i:i+h.length;i>=0;i--){p=h[i];if(p.hasTarget(g)){i=p;break a}}i=null}p=void 0;a:{for(k=k+1;k<h.length;k++){p=h[k];if(p.hasTarget(g))break a}p=
|
|
|
+null}if(i&&p){h=(f.time-i.time)/(p.time-i.time);i=i.getTarget(g);k=p.getTarget(g).data;p=i.data;j=void 0;if(i.type==="matrix")j=p;else if(p.length){j=[];for(r=0;r<p.length;++r)j[r]=p[r]+(k[r]-p[r])*h}else j=p+(k-p)*h;f.addTarget(g,i.transform,i.member,j)}}}}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)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");
|
|
|
this.type=a.nodeName;this.data=D(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*la;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){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
|
|
|
case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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=
|
|
@@ -342,80 +342,80 @@ g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0
|
|
|
parse:a,setPreferredShading:function(a){pa=a},applySkin:f,geometries:W,options:R}};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){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
|
|
|
f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,j,i,k,q,l,n,r,m,p,t,s,v,o=a.faces;q=a.vertices;var x=a.normals,y=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]=[]}i=0;for(k=q.length;i<k;){l=new THREE.Vertex;l.position.x=q[i++]*b;l.position.y=q[i++]*b;l.position.z=q[i++]*b;d.vertices.push(l)}i=0;for(k=o.length;i<k;){b=
|
|
|
-o[i++];q=b&1;j=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(q){p=new THREE.Face4;p.a=o[i++];p.b=o[i++];p.c=o[i++];p.d=o[i++];q=4}else{p=new THREE.Face3;p.a=o[i++];p.b=o[i++];p.c=o[i++];q=3}if(j){j=o[i++];p.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<z;c++){t=a.uvs[c];r=o[i++];v=t[r*2];r=t[r*2+1];d.faceUvs[c][j]=new THREE.UV(v,r)}if(f)for(c=0;c<z;c++){t=a.uvs[c];s=[];for(f=0;f<q;f++){r=o[i++];v=t[r*2];r=t[r*2+1];s[f]=new THREE.UV(v,r)}d.faceVertexUvs[c][j]=s}if(n){n=o[i++]*3;f=new THREE.Vector3;
|
|
|
-f.x=x[n++];f.y=x[n++];f.z=x[n];p.normal=f}if(l)for(c=0;c<q;c++){n=o[i++]*3;f=new THREE.Vector3;f.x=x[n++];f.y=x[n++];f.z=x[n];p.vertexNormals.push(f)}if(m){l=o[i++];l=new THREE.Color(y[l]);p.color=l}if(b)for(c=0;c<q;c++){l=o[i++];l=new THREE.Color(y[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<
|
|
|
-c;b=b+2){f=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,j,i,k,q,l,n,r;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(i=r.length;j<i;j=j+3){k=r[j]*b;q=r[j+1]*b;l=r[j+2]*b;n.push(new THREE.Vertex(new THREE.Vector3(k,
|
|
|
-q,l)))}}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(j=k.length;b<j;b=b+3){q=new THREE.Color(16755200);q.setRGB(k[b],k[b+1],k[b+2]);i.push(q)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,q,l,n,r,m,p,t,s,v,o=a.faces;q=a.vertices;var x=a.normals,y=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]=[]}j=0;for(k=q.length;j<k;){l=new THREE.Vertex;l.position.x=q[j++]*b;l.position.y=q[j++]*b;l.position.z=q[j++]*b;d.vertices.push(l)}j=0;for(k=o.length;j<k;){b=
|
|
|
+o[j++];q=b&1;i=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(q){p=new THREE.Face4;p.a=o[j++];p.b=o[j++];p.c=o[j++];p.d=o[j++];q=4}else{p=new THREE.Face3;p.a=o[j++];p.b=o[j++];p.c=o[j++];q=3}if(i){i=o[j++];p.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<z;c++){t=a.uvs[c];r=o[j++];v=t[r*2];r=t[r*2+1];d.faceUvs[c][i]=new THREE.UV(v,r)}if(f)for(c=0;c<z;c++){t=a.uvs[c];s=[];for(f=0;f<q;f++){r=o[j++];v=t[r*2];r=t[r*2+1];s[f]=new THREE.UV(v,r)}d.faceVertexUvs[c][i]=s}if(n){n=o[j++]*3;f=new THREE.Vector3;
|
|
|
+f.x=x[n++];f.y=x[n++];f.z=x[n];p.normal=f}if(l)for(c=0;c<q;c++){n=o[j++]*3;f=new THREE.Vector3;f.x=x[n++];f.y=x[n++];f.z=x[n];p.vertexNormals.push(f)}if(m){l=o[j++];l=new THREE.Color(y[l]);p.color=l}if(b)for(c=0;c<q;c++){l=o[j++];l=new THREE.Color(y[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<
|
|
|
+c;b=b+2){f=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,k,q,l,n,r;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;i=0;for(j=r.length;i<j;i=i+3){k=r[i]*b;q=r[i+1]*b;l=r[i+2]*b;n.push(new THREE.Vertex(new THREE.Vector3(k,
|
|
|
+q,l)))}}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b=b+3){q=new THREE.Color(16755200);q.setRGB(k[b],k[b+1],k[b+2]);j.push(q)}}}})(f);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){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&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:i+"/"+a}function f(){var a;for(l in C.objects)if(!F.objects[l]){t=C.objects[l];if(t.geometry!==void 0){if(E=F.geometries[t.geometry]){a=false;H=F.materials[t.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&E.computeTangents();o=t.position;x=t.rotation;y=t.quaternion;z=t.scale;y=0;t.materials.length==0&&(H=new THREE.MeshFaceMaterial);t.materials.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function f(){var a;for(l in C.objects)if(!F.objects[l]){t=C.objects[l];if(t.geometry!==void 0){if(E=F.geometries[t.geometry]){a=false;H=F.materials[t.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&E.computeTangents();o=t.position;x=t.rotation;y=t.quaternion;z=t.scale;y=0;t.materials.length==0&&(H=new THREE.MeshFaceMaterial);t.materials.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,
|
|
|
H);a.name=l;a.position.set(o[0],o[1],o[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(x[0],x[1],x[2]);a.scale.set(z[0],z[1],z[2]);a.visible=t.visible;a.doubleSided=t.doubleSided;a.castShadow=t.castShadow;a.receiveShadow=t.receiveShadow;F.scene.add(a);F.objects[l]=a}}else{o=t.position;x=t.rotation;y=t.quaternion;z=t.scale;y=0;a=new THREE.Object3D;a.name=l;a.position.set(o[0],o[1],o[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(x[0],
|
|
|
-x[1],x[2]);a.scale.set(z[0],z[1],z[2]);a.visible=t.visible!==void 0?t.visible:false;F.scene.add(a);F.objects[l]=a;F.empties[l]=a}}}function e(a){return function(b){F.geometries[a]=b;f();B=B-1;j.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){j.callbackProgress({totalModels:L,totalTextures:K,loadedModels:L-B,loadedTextures:K-G},F);j.onLoadProgress();B==0&&G==0&&b(F)}var j=this,i=THREE.Loader.prototype.extractUrlBase(c),k,q,l,n,r,m,p,t,s,v,o,x,y,z,u,w,E,H,I,J,
|
|
|
-C,A,B,G,L,K,F;C=a;c=new THREE.BinaryLoader;A=new THREE.JSONLoader;G=B=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform){a=C.transform.position;s=C.transform.rotation;u=C.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);s&&F.scene.rotation.set(s[0],s[1],s[2]);u&&F.scene.scale.set(u[0],u[1],u[2]);if(a||s||u){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){G=G-1;h();j.onLoadComplete()};for(r in C.cameras){u=
|
|
|
+x[1],x[2]);a.scale.set(z[0],z[1],z[2]);a.visible=t.visible!==void 0?t.visible:false;F.scene.add(a);F.objects[l]=a;F.empties[l]=a}}}function e(a){return function(b){F.geometries[a]=b;f();B=B-1;i.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,totalTextures:K,loadedModels:L-B,loadedTextures:K-G},F);i.onLoadProgress();B==0&&G==0&&b(F)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,q,l,n,r,m,p,t,s,v,o,x,y,z,u,w,E,H,I,J,
|
|
|
+C,A,B,G,L,K,F;C=a;c=new THREE.BinaryLoader;A=new THREE.JSONLoader;G=B=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform){a=C.transform.position;s=C.transform.rotation;u=C.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);s&&F.scene.rotation.set(s[0],s[1],s[2]);u&&F.scene.scale.set(u[0],u[1],u[2]);if(a||s||u){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){G=G-1;h();i.onLoadComplete()};for(r in C.cameras){u=
|
|
|
C.cameras[r];u.type=="perspective"?I=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type=="ortho"&&(I=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));o=u.position;s=u.target;u=u.up;I.position.set(o[0],o[1],o[2]);I.target=new THREE.Vector3(s[0],s[1],s[2]);u&&I.up.set(u[0],u[1],u[2]);F.cameras[r]=I}for(n in C.lights){s=C.lights[n];r=s.color!==void 0?s.color:16777215;I=s.intensity!==void 0?s.intensity:1;if(s.type=="directional"){o=s.direction;v=new THREE.DirectionalLight(r,
|
|
|
I);v.position.set(o[0],o[1],o[2]);v.position.normalize()}else if(s.type=="point"){o=s.position;v=s.distance;v=new THREE.PointLight(r,I,v);v.position.set(o[0],o[1],o[2])}else s.type=="ambient"&&(v=new THREE.AmbientLight(r));F.scene.add(v);F.lights[n]=v}for(m in C.fogs){n=C.fogs[m];n.type=="linear"?J=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(J=new THREE.FogExp2(0,n.density));u=n.color;J.color.setRGB(u[0],u[1],u[2]);F.fogs[m]=J}if(F.cameras&&C.defaults.camera)F.currentCamera=F.cameras[C.defaults.camera];
|
|
|
-if(F.fogs&&C.defaults.fog)F.scene.fog=F.fogs[C.defaults.fog];u=C.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(u[0],u[1],u[2]);F.bgColorAlpha=C.defaults.bgalpha;for(k in C.geometries){m=C.geometries[k];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){B=B+1;j.onLoadStart()}}L=B;for(k in C.geometries){m=C.geometries[k];if(m.type=="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);F.geometries[k]=E}else if(m.type==
|
|
|
+if(F.fogs&&C.defaults.fog)F.scene.fog=F.fogs[C.defaults.fog];u=C.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(u[0],u[1],u[2]);F.bgColorAlpha=C.defaults.bgalpha;for(k in C.geometries){m=C.geometries[k];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){B=B+1;i.onLoadStart()}}L=B;for(k in C.geometries){m=C.geometries[k];if(m.type=="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);F.geometries[k]=E}else if(m.type==
|
|
|
"plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="cylinder"){E=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs);F.geometries[k]=E}else if(m.type=="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[k]=E}else if(m.type=="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,
|
|
|
-m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="ascii_mesh")A.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=C.embeds[m.id];m.metadata=C.metadata;m&&A.createModel(m,g(k),"")}}for(p in C.textures){k=C.textures[p];if(k.url instanceof Array){G=G+k.url.length;for(m=0;m<k.url.length;m++)j.onLoadStart()}else{G=G+1;j.onLoadStart()}}K=G;for(p in C.textures){k=C.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=
|
|
|
+m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="ascii_mesh")A.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=C.embeds[m.id];m.metadata=C.metadata;m&&A.createModel(m,g(k),"")}}for(p in C.textures){k=C.textures[p];if(k.url instanceof Array){G=G+k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else{G=G+1;i.onLoadStart()}}K=G;for(p in C.textures){k=C.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=
|
|
|
new THREE[k.mapping];if(k.url instanceof Array){m=[];for(J=0;J<k.url.length;J++)m[J]=d(k.url[J],C.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,C.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&
|
|
|
m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[k.wrap[0]]!==void 0)m.wrapS=J[k.wrap[0]];if(J[k.wrap[1]]!==void 0)m.wrapT=J[k.wrap[1]]}}F.textures[p]=m}for(q in C.materials){p=C.materials[q];for(w in p.parameters)if(w=="envMap"||w=="map"||w=="lightMap")p.parameters[w]=F.textures[p.parameters[w]];else if(w=="shading")p.parameters[w]=p.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")p.parameters[w]=
|
|
|
THREE[p.parameters[w]]?THREE[p.parameters[w]]:THREE.NormalBlending;else if(w=="combine")p.parameters[w]=p.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w=="vertexColors")if(p.parameters[w]=="face")p.parameters[w]=THREE.FaceColors;else if(p.parameters[w])p.parameters[w]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=true;if(p.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);
|
|
|
m=p.parameters.color;J=p.parameters.specular;c=p.parameters.ambient;A=p.parameters.shininess;k.tNormal.texture=F.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)k.uNormalScale.value=p.parameters.normalMapFactor;if(p.parameters.map){k.tDiffuse.texture=p.parameters.map;k.enableDiffuse.value=true}if(p.parameters.lightMap){k.tAO.texture=p.parameters.lightMap;k.enableAO.value=true}if(p.parameters.specularMap){k.tSpecular.texture=F.textures[p.parameters.specularMap];k.enableSpecular.value=
|
|
|
-true}k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(J);k.uAmbientColor.value.setHex(c);k.uShininess.value=A;if(p.parameters.opacity)k.uOpacity.value=p.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:true,fog:true})}else H=new THREE[p.type](p.parameters);F.materials[q]=H}f();j.callbackSync(F);h()};THREE.UTF8Loader=function(){};
|
|
|
+true}k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(J);k.uAmbientColor.value.setHex(c);k.uShininess.value=A;if(p.parameters.opacity)k.uOpacity.value=p.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:true,fog:true})}else H=new THREE[p.type](p.parameters);F.materials[q]=H}f();i.callbackSync(F);h()};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,e=c.offsetX!==void 0?c.offsetX:0,g=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,f,e,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
|
|
|
true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;f<8;f++){for(var e=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),e=e+(h>>1^-(h&1));c[8*g+f]=e}d=d+b}b=a.length-d;e=new Uint16Array(b);for(f=g=0;f<b;f++){h=a.charCodeAt(f+d);e[f]=g-h;h==0&&g++}return[c,e]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),i=[],k=[];(function(a,g,i){for(var j,k,p,t=a.length;i<t;i=i+g){j=a[i];k=a[i+1];p=a[i+2];j=j/16383*c;k=k/16383*c;p=p/16383*c;j=j+d;k=k+f;p=p+e;b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;k.push(d,1-e)}})(g[0],
|
|
|
-8,3);(function(a,b,c){for(var d,e,f,g=a.length;c<g;c=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;i.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,s,v,o,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;o=e;j=f;var y=i[e*3],z=i[e*3+1],u=i[e*3+2],w=i[f*3],E=i[f*3+1],H=i[f*3+2];s=new THREE.Vector3(i[d*3],i[d*3+1],i[d*3+2]);y=new THREE.Vector3(y,z,u);w=new THREE.Vector3(w,E,H);g.faces.push(new THREE.Face3(v,o,j,[s,y,w],null,0));g=k[d*2];d=k[d*2+1];j=k[e*
|
|
|
-2];s=k[e*2+1];v=k[f*2];o=k[f*2+1];f=b.faceVertexUvs[0];e=j;j=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,j));s.push(new THREE.UV(v,o));f.push(s)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,p,t=a.length;i<t;i=i+g){j=a[i];k=a[i+1];p=a[i+2];j=j/16383*c;k=k/16383*c;p=p/16383*c;j=j+d;k=k+f;p=p+e;b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;k.push(d,1-e)}})(g[0],
|
|
|
+8,3);(function(a,b,c){for(var d,e,f,g=a.length;c<g;c=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;j.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,i,s,v,o,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;o=e;i=f;var y=j[e*3],z=j[e*3+1],u=j[e*3+2],w=j[f*3],E=j[f*3+1],H=j[f*3+2];s=new THREE.Vector3(j[d*3],j[d*3+1],j[d*3+2]);y=new THREE.Vector3(y,z,u);w=new THREE.Vector3(w,E,H);g.faces.push(new THREE.Face3(v,o,i,[s,y,w],null,0));g=k[d*2];d=k[d*2+1];i=k[e*
|
|
|
+2];s=k[e*2+1];v=k[f*2];o=k[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(v,o));f.push(s)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};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,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)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:e,color:f,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-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+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
|
THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
|
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
|
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},f=this.geometry,e=0,g=f.morphTargets.length;e<g;e++){var h=f.morphTargets[e].name.match(b);if(h&&h.length>1){var j=h[1];d[j]||(d[j]={start:Infinity,end:-Infinity});h=d[j];if(e<h.start)h.start=e;if(e>h.end)h.end=e;c||(c=j)}}for(j in d){h=d[j];this.createAnimation(j,h.start,h.end,a)}this.firstAnimation=c};
|
|
|
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},f=this.geometry,e=0,g=f.morphTargets.length;e<g;e++){var h=f.morphTargets[e].name.match(b);if(h&&h.length>1){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(e<h.start)h.start=e;if(e>h.end)h.end=e;c||(c=i)}}for(i in d){h=d[i];this.createAnimation(i,h.start,h.end,a)}this.firstAnimation=c};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a]){a.direction=1;a.directionBackwards=false}};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a]){a.direction=-1;a.directionBackwards=true}};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c){c.fps=b;c.duration=(c.end-c.start)/c.fps}};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c){c.duration=b;c.fps=(c.end-c.start)/c.duration}};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
|
f),0,d.length-1),g=d.weight;if(e!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[e]=0;d.lastFrame=d.currentFrame;d.currentFrame=e}f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
|
|
|
-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,f,e,g,h,j,i,k,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
|
|
|
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();j=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,j);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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){i=false;k=a(THREE.ShaderFlares.lensFlare)}else{i=true;k=a(THREE.ShaderFlares.lensFlareVertexTexture)}q={};l={};q.vertex=b.getAttribLocation(k,"position");q.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
|
|
|
+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,f,e,g,h,i,j,k,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
|
|
|
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;k=a(THREE.ShaderFlares.lensFlare)}else{j=true;k=a(THREE.ShaderFlares.lensFlareVertexTexture)}q={};l={};q.vertex=b.getAttribLocation(k,"position");q.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
|
|
|
"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=false};this.render=function(a,d,f,t){var a=a.__webglFlares,s=a.length;if(s){var v=new THREE.Vector3,o=t/f,x=f*0.5,y=t*0.5,z=16/t,u=new THREE.Vector2(z*o,z),w=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),H=l,z=q;b.useProgram(k);if(!n){b.enableVertexAttribArray(q.vertex);b.enableVertexAttribArray(q.uv);n=true}b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var I,J,C,A,B;for(I=0;I<s;I++){z=16/t;u.set(z*o,z);A=a[I];v.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);w.copy(v);E.x=w.x*x+x;E.y=w.y*y+y;if(i||E.x>0&&E.x<f&&E.y>0&&E.y<t){b.activeTexture(b.TEXTURE1);
|
|
|
-b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,u.x,u.y);b.uniform3f(H.screenPosition,w.x,w.y,w.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,E.x-8,E.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var I,J,C,A,B;for(I=0;I<s;I++){z=16/t;u.set(z*o,z);A=a[I];v.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);w.copy(v);E.x=w.x*x+x;E.y=w.y*y+y;if(j||E.x>0&&E.x<f&&E.y>0&&E.y<t){b.activeTexture(b.TEXTURE1);
|
|
|
+b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,u.x,u.y);b.uniform3f(H.screenPosition,w.x,w.y,w.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,E.x-8,E.y-8,16,16,0);b.uniform1i(H.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);A.positionScreen.copy(w);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);J=0;for(C=A.lensFlares.length;J<C;J++){B=A.lensFlares[J];if(B.opacity>0.001&&B.scale>0.001){w.x=B.x;w.y=B.y;w.z=B.z;z=B.size*B.scale/t;u.x=z*o;u.y=z;b.uniform3f(H.screenPosition,w.x,w.y,w.z);b.uniform2f(H.scale,u.x,u.y);b.uniform1f(H.rotation,B.rotation);b.uniform1f(H.opacity,B.opacity);b.uniform3f(H.color,
|
|
|
B.color.r,B.color.g,B.color.b);c.setBlending(B.blending,B.blendEquation,B.blendSrc,B.blendDst);c.setTexture(B.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;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:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,i){var k,q,l,n,r,m,p,t,s,v=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(q=j.__lights.length;k<q;k++){l=j.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var o;if(l.shadowCascadeArray[r])o=l.shadowCascadeArray[r];else{s=l;p=r;o=new THREE.DirectionalLight;
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,q,l,n,r,m,p,t,s,v=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(q=i.__lights.length;k<q;k++){l=i.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var o;if(l.shadowCascadeArray[r])o=l.shadowCascadeArray[r];else{s=l;p=r;o=new THREE.DirectionalLight;
|
|
|
o.isVirtual=true;o.onlyShadow=true;o.castShadow=true;o.shadowCameraNear=s.shadowCameraNear;o.shadowCameraFar=s.shadowCameraFar;o.shadowCameraLeft=s.shadowCameraLeft;o.shadowCameraRight=s.shadowCameraRight;o.shadowCameraBottom=s.shadowCameraBottom;o.shadowCameraTop=s.shadowCameraTop;o.shadowCameraVisible=s.shadowCameraVisible;o.shadowDarkness=s.shadowDarkness;o.shadowBias=s.shadowCascadeBias[p];o.shadowMapWidth=s.shadowCascadeWidth[p];o.shadowMapHeight=s.shadowCascadeHeight[p];o.pointsWorld=[];o.pointsFrustum=
|
|
|
-[];t=o.pointsWorld;m=o.pointsFrustum;for(var x=0;x<8;x++){t[x]=new THREE.Vector3;m[x]=new THREE.Vector3}t=s.shadowCascadeNearZ[p];s=s.shadowCascadeFarZ[p];m[0].set(-1,-1,t);m[1].set(1,-1,t);m[2].set(-1,1,t);m[3].set(1,1,t);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);o.originalCamera=i;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(o);m.add(o.target);i.add(m);l.shadowCascadeArray[r]=o;console.log("Created virtualLight",o)}p=l;t=r;s=p.shadowCascadeArray[t];s.position.copy(p.position);
|
|
|
+[];t=o.pointsWorld;m=o.pointsFrustum;for(var x=0;x<8;x++){t[x]=new THREE.Vector3;m[x]=new THREE.Vector3}t=s.shadowCascadeNearZ[p];s=s.shadowCascadeFarZ[p];m[0].set(-1,-1,t);m[1].set(1,-1,t);m[2].set(-1,1,t);m[3].set(1,1,t);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);o.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(o);m.add(o.target);j.add(m);l.shadowCascadeArray[r]=o;console.log("Created virtualLight",o)}p=l;t=r;s=p.shadowCascadeArray[t];s.position.copy(p.position);
|
|
|
s.target.position.copy(p.target.position);s.lookAt(s.target);s.shadowCameraVisible=p.shadowCameraVisible;s.shadowDarkness=p.shadowDarkness;s.shadowBias=p.shadowCascadeBias[t];m=p.shadowCascadeNearZ[t];p=p.shadowCascadeFarZ[t];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=p;s[5].z=p;s[6].z=p;s[7].z=p;v[n]=o;n++}else{v[n]=l;n++}}k=0;for(q=v.length;k<q;k++){l=v[k];if(!l.shadowMap){l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight);l.shadowMatrix=new THREE.Matrix4}if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,
|
|
|
-l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(l.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&o.originalCamera==i){r=i;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){t=s[p];t.copy(m[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(t,
|
|
|
+l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&o.originalCamera==j){r=j;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){t=s[p];t.copy(m[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(t,
|
|
|
r);n.matrixWorldInverse.multiplyVector3(t);if(t.x<g.x)g.x=t.x;if(t.x>h.x)h.x=t.x;if(t.y<g.y)g.y=t.y;if(t.y>h.y)h.y=t.y;if(t.z<g.z)g.z=t.z;if(t.z>h.z)h.z=t.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
|
|
|
l.shadowCameraVisible&&l.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
|
|
|
-b.clear();s=j.__webglObjects;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;p.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);p.render=true}}l=0;for(n=s.length;l<n;l++){p=s[l];if(p.render){m=p.object;p=p.buffer;b.setObjectFaces(m);t=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
-d:c;p instanceof THREE.BufferGeometry?b.renderBufferDirect(r,j.__lights,null,t,p,m):b.renderBuffer(r,j.__lights,null,t,p,m)}}s=j.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;if(m.visible&&m.castShadow){m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray);m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);b.renderImmediateObject(r,j.__lights,null,c,m)}}}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,
|
|
|
+b.clear();s=i.__webglObjects;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;p.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);p.render=true}}l=0;for(n=s.length;l<n;l++){p=s[l];if(p.render){m=p.object;p=p.buffer;b.setObjectFaces(m);t=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
+d:c;p instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,t,p,m):b.renderBuffer(r,i.__lights,null,t,p,m)}}s=i.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;if(m.visible&&m.castShadow){m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray);m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);b.renderImmediateObject(r,i.__lights,null,c,m)}}}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,
|
|
|
k.b,q);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,j,i,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=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;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;j={};i={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
|
|
|
-"uvScale");i.rotation=b.getUniformLocation(h,"rotation");i.scale=b.getUniformLocation(h,"scale");i.alignment=b.getUniformLocation(h,"alignment");i.color=b.getUniformLocation(h,"color");i.map=b.getUniformLocation(h,"map");i.opacity=b.getUniformLocation(h,"opacity");i.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");i.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");i.screenPosition=b.getUniformLocation(h,"screenPosition");i.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var p=j,t=i,s=r/n,n=n*0.5,v=r*0.5,o=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(p.position);b.enableVertexAttribArray(p.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(p.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=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;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
|
|
|
+"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var p=i,t=j,s=r/n,n=n*0.5,v=r*0.5,o=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(p.position);b.enableVertexAttribArray(p.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(p.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
g);b.uniformMatrix4fv(t.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);for(var x,y=[],p=0;p<m;p++){x=d[p];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,x.matrixWorld,x._modelViewMatrixArray);x.z=-x._modelViewMatrix.n34}}d.sort(a);for(p=0;p<m;p++){x=d[p];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(t.useScreenCoordinates,
|
|
|
1);b.uniform3f(t.screenPosition,(x.position.x-n)/n,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(t.useScreenCoordinates,0);b.uniform1i(t.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(t.modelViewMatrix,false,x._modelViewMatrixArray)}f=x.map.image.width/(x.scaleByViewport?r:1);y[0]=f*s*x.scale.x;y[1]=f*x.scale.y;b.uniform2f(t.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(t.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(t.alignment,x.alignment.x,x.alignment.y);
|
|
|
b.uniform1f(t.opacity,x.opacity);b.uniform3f(t.color,x.color.r,x.color.g,x.color.b);b.uniform1f(t.rotation,x.rotation);b.uniform2fv(t.scale,y);if(x.mergeWith3D&&!o){b.enable(b.DEPTH_TEST);o=true}else if(!x.mergeWith3D&&o){b.disable(b.DEPTH_TEST);o=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;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:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,i,k,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
|
|
|
-h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();n=g.__webglObjects;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;k.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);k.render=true}}j=0;for(i=n.length;j<i;j++){k=n[j];if(k.render){l=k.object;k=k.buffer;b.setObjectFaces(l);q=l.customDepthMaterial?
|
|
|
-l.customDepthMaterial:l.geometry.morphTargets.length?d:c;k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,q,k,l):b.renderBuffer(h,g.__lights,null,q,k,l)}}n=g.__webglObjectsImmediate;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;if(l.visible&&l.castShadow){l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray);l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);b.renderImmediateObject(h,g.__lights,null,c,l)}}j=b.getClearColor();
|
|
|
-i=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,i);a.enable(a.BLEND)}};
|
|
|
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,j,i,k,q;f.matrixAutoUpdate=e.matrixAutoUpdate=false;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),r=new THREE.PerspectiveCamera(53,
|
|
|
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,k,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
|
|
|
+h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();n=g.__webglObjects;i=0;for(j=n.length;i<j;i++){k=n[i];l=k.object;k.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);k.render=true}}i=0;for(j=n.length;i<j;i++){k=n[i];if(k.render){l=k.object;k=k.buffer;b.setObjectFaces(l);q=l.customDepthMaterial?
|
|
|
+l.customDepthMaterial:l.geometry.morphTargets.length?d:c;k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,q,k,l):b.renderBuffer(h,g.__lights,null,q,k,l)}}n=g.__webglObjectsImmediate;i=0;for(j=n.length;i<j;i++){k=n[i];l=k.object;if(l.visible&&l.castShadow){l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray);l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);b.renderImmediateObject(h,g.__lights,null,c,l)}}i=b.getClearColor();
|
|
|
+j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;f.matrixAutoUpdate=e.matrixAutoUpdate=false;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),r=new THREE.PerspectiveCamera(53,
|
|
|
1,1,1E4);r.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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);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(j!==c.aspect||i!==c.near||k!==c.far||q!==c.fov){j=c.aspect;i=c.near;k=c.far;q=c.fov;var s=c.projectionMatrix.clone(),v=125/30*0.5,o=v*i/125,x=i*Math.tan(q*Math.PI/360),y;g.n14=v;h.n14=-v;v=-x*j+o;y=x*j+o;s.n11=2*i/(y-v);s.n13=(y+v)/(y-v);f.projectionMatrix.copy(s);
|
|
|
-v=-x*j-o;y=x*j-o;s.n11=2*i/(y-v);s.n13=(y+v)/(y-v);e.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,true);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,true);m.updateMatrixWorld();d.call(b,m,r)}});
|
|
|
+m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);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||j!==c.near||k!==c.far||q!==c.fov){i=c.aspect;j=c.near;k=c.far;q=c.fov;var s=c.projectionMatrix.clone(),v=125/30*0.5,o=v*j/125,x=j*Math.tan(q*Math.PI/360),y;g.n14=v;h.n14=-v;v=-x*i+o;y=x*i+o;s.n11=2*j/(y-v);s.n13=(y+v)/(y-v);f.projectionMatrix.copy(s);
|
|
|
+v=-x*i-o;y=x*i-o;s.n11=2*j/(y-v);s.n13=(y+v)/(y-v);e.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,true);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,true);m.updateMatrixWorld();d.call(b,m,r)}});
|
|
|
THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;var b=this,c=this.setSize,d=this.render,f,e,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&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;e=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,f,e);d.call(b,a,g);this.setViewport(f,0,f,e);d.call(b,a,h,false)}});
|
|
|
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}"},
|