|
@@ -1,28 +1,30 @@
|
|
|
// ThreeExtras.js - http://github.com/mrdoob/three.js
|
|
|
'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=(c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],q=g.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);f.push(m)}for(n=0,r=k.length;n<r;n++){var f=
|
|
|
-k[n],o,p,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?o=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(o=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));o.normal.copy(f.normal);d&&d.multiplyVector3(o.normal);h=0;for(m=s.length;h<m;h++)p=s[h].clone(),d&&d.multiplyVector3(p),o.vertexNormals.push(p);o.color.copy(f.color);h=0;for(m=t.length;h<m;h++)p=t[h],o.vertexColors.push(p.clone());if(void 0!==f.materialIndex){h=g.materials[f.materialIndex];m=h.id;t=l[m];if(void 0===t)t=a.materials.length,
|
|
|
-l[m]=t,a.materials.push(h);o.materialIndex=t}o.centroid.copy(f.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(n=0,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));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],q=g.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,s=h.length;n<s;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);f.push(m)}for(n=0,s=j.length;n<s;n++){var f=
|
|
|
+j[n],o,p,r=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?o=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(o=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));o.normal.copy(f.normal);d&&d.multiplyVector3(o.normal);h=0;for(m=r.length;h<m;h++)p=r[h].clone(),d&&d.multiplyVector3(p),o.vertexNormals.push(p);o.color.copy(f.color);h=0;for(m=t.length;h<m;h++)p=t[h],o.vertexColors.push(p.clone());if(void 0!==f.materialIndex){h=g.materials[f.materialIndex];m=h.id;t=l[m];if(void 0===t)t=a.materials.length,
|
|
|
+l[m]=t,a.materials.push(h);o.materialIndex=t}o.centroid.copy(f.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(n=0,s=q.length;n<s;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,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
|
|
|
g[a],e=[],f=0,h=d.length;f<h;f++)e.push(new THREE.UV(d[f].u,d[f].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
|
|
|
e=b.vertices[a.b].position,g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*
|
|
|
-(c+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,q,l,n;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,q=f[d.b].position,l=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,l);else if(d instanceof
|
|
|
-THREE.Face4)j=f[d.a].position,q=f[d.b].position,l=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];for(e=0;e<b;e++)f=THREE.GeometryUtils.random()*i,f=c(f),d[e]=THREE.GeometryUtils.randomPointInFace(g[f],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
+(c+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,j=[],k,q,l,n;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,q=f[d.b].position,l=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,l);else if(d instanceof
|
|
|
+THREE.Face4)k=f[d.a].position,q=f[d.b].position,l=f[d.c].position,n=f[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[e]=i}d=[];for(e=0;e<b;e++)f=THREE.GeometryUtils.random()*i,f=c(f),d[e]=THREE.GeometryUtils.randomPointInFace(g[f],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,g=d.length;e<g;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){for(var b=a.faces.length-1;0<=b;b--){var c=
|
|
|
a.faces[b];if(c instanceof THREE.Face4){var d=c.a,e=c.b,g=c.c,f=c.d,h=new THREE.Face3,i=new THREE.Face3;h.color.copy(c.color);i.color.copy(c.color);h.materialIndex=c.materialIndex;i.materialIndex=c.materialIndex;h.a=d;h.b=e;h.c=f;i.a=e;i.b=g;i.c=f;4===c.vertexColors.length&&(h.vertexColors[0]=c.vertexColors[0].clone(),h.vertexColors[1]=c.vertexColors[1].clone(),h.vertexColors[2]=c.vertexColors[3].clone(),i.vertexColors[0]=c.vertexColors[1].clone(),i.vertexColors[1]=c.vertexColors[2].clone(),i.vertexColors[2]=
|
|
|
c.vertexColors[3].clone());a.faces.splice(b,1,h,i);for(c=0;c<a.faceVertexUvs.length;c++)a.faceVertexUvs[c].length&&(f=a.faceVertexUvs[c][b],d=f[1],e=f[2],g=f[3],f=[f[0].clone(),d.clone(),g.clone()],d=[d.clone(),e.clone(),g.clone()],a.faceVertexUvs[c].splice(b,1,f,d));for(c=0;c<a.faceUvs.length;c++)a.faceUvs[c].length&&(d=a.faceUvs[c][b],a.faceUvs[c].splice(b,1,d,d))}}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 e=b.length,g=a.faces[c];if(g instanceof THREE.Face4){var f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],k=a.vertices[g.d];b.push(f.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());g.a=e;g.b=e+1;g.c=e+2;g.d=e+3}else f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],b.push(f.clone()),b.push(h.clone()),b.push(i.clone()),g.a=e,g.b=e+1,g.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,g,
|
|
|
-f,h,i,k,j,q,l,n,r,m,o,p,s,t;for(c=a.faces.length-1;0<=c;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(e=d.a,g=d.b,f=d.c,i=a.vertices[e],k=a.vertices[g],j=a.vertices[f],l=i.position.distanceTo(k.position),n=k.position.distanceTo(j.position),q=i.position.distanceTo(j.position),l>b||n>b||q>b){h=a.vertices.length;s=d.clone();t=d.clone();l>=n&&l>=q?(i=i.clone(),i.position.lerpSelf(k.position,0.5),s.a=e,s.b=h,s.c=f,t.a=h,t.b=g,t.c=f,3===d.vertexNormals.length&&(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[1],
|
|
|
-0.5),s.vertexNormals[1].copy(e),t.vertexNormals[0].copy(e)),d=0):n>=l&&n>=q?(i=k.clone(),i.position.lerpSelf(j.position,0.5),s.a=e,s.b=g,s.c=h,t.a=h,t.b=f,t.c=e,3===d.vertexNormals.length&&(e=d.vertexNormals[1].clone(),e.lerpSelf(d.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e),t.vertexNormals[1].copy(d.vertexNormals[2]),t.vertexNormals[2].copy(d.vertexNormals[0])),d=1):(i=i.clone(),i.position.lerpSelf(j.position,0.5),s.a=e,s.b=g,s.c=h,t.a=h,t.b=g,t.c=f,3===d.vertexNormals.length&&
|
|
|
-(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e)),d=2);a.faces.splice(c,1,s,t);a.vertices.push(i);for(e=0;e<a.faceVertexUvs.length;e++)a.faceVertexUvs[e].length&&(k=a.faceVertexUvs[e][c],i=k[0],g=k[1],f=k[2],0===d?(j=i.clone(),j.lerpSelf(g,0.5),k=[i.clone(),j.clone(),f.clone()],g=[j.clone(),g.clone(),f.clone()]):1===d?(j=g.clone(),j.lerpSelf(f,0.5),k=[i.clone(),g.clone(),j.clone()],g=[j.clone(),f.clone(),i.clone()]):(j=i.clone(),
|
|
|
-j.lerpSelf(f,0.5),k=[i.clone(),g.clone(),j.clone()],g=[j.clone(),g.clone(),f.clone()]),a.faceVertexUvs[e].splice(c,1,k,g))}}else if(e=d.a,g=d.b,f=d.c,h=d.d,i=a.vertices[e],k=a.vertices[g],j=a.vertices[f],q=a.vertices[h],l=i.position.distanceTo(k.position),n=k.position.distanceTo(j.position),r=j.position.distanceTo(q.position),m=i.position.distanceTo(q.position),l>b||n>b||r>b||m>b){o=a.vertices.length;p=a.vertices.length+1;s=d.clone();t=d.clone();l>=n&&l>=r&&l>=m||r>=n&&r>=l&&r>=m?(l=i.clone(),l.position.lerpSelf(k.position,
|
|
|
-0.5),k=j.clone(),k.position.lerpSelf(q.position,0.5),s.a=e,s.b=o,s.c=p,s.d=h,t.a=o,t.b=g,t.c=f,t.d=p,4===d.vertexNormals.length&&(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[1],0.5),g=d.vertexNormals[2].clone(),g.lerpSelf(d.vertexNormals[3],0.5),s.vertexNormals[1].copy(e),s.vertexNormals[2].copy(g),t.vertexNormals[0].copy(e),t.vertexNormals[3].copy(g)),d=0):(l=k.clone(),l.position.lerpSelf(j.position,0.5),k=q.clone(),k.position.lerpSelf(i.position,0.5),s.a=e,s.b=g,s.c=o,s.d=p,t.a=p,t.b=
|
|
|
-o,t.c=f,t.d=h,4===d.vertexNormals.length&&(e=d.vertexNormals[1].clone(),e.lerpSelf(d.vertexNormals[2],0.5),g=d.vertexNormals[3].clone(),g.lerpSelf(d.vertexNormals[0],0.5),s.vertexNormals[2].copy(e),s.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(e)),d=1);a.faces.splice(c,1,s,t);a.vertices.push(l);a.vertices.push(k);for(e=0;e<a.faceVertexUvs.length;e++)a.faceVertexUvs[e].length&&(k=a.faceVertexUvs[e][c],i=k[0],g=k[1],f=k[2],k=k[3],0===d?(j=i.clone(),j.lerpSelf(g,0.5),
|
|
|
-s=f.clone(),s.lerpSelf(k,0.5),i=[i.clone(),j.clone(),s.clone(),k.clone()],g=[j.clone(),g.clone(),f.clone(),s.clone()]):(j=g.clone(),j.lerpSelf(f,0.5),s=k.clone(),s.lerpSelf(i,0.5),i=[i.clone(),g.clone(),j.clone(),s.clone()],g=[s.clone(),j.clone(),f.clone(),k.clone()]),a.faceVertexUvs[e].splice(c,1,i,g))}}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+[],c=0,d=a.faces.length;c<d;c++){var e=b.length,g=a.faces[c];if(g instanceof THREE.Face4){var f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],j=a.vertices[g.d];b.push(f.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());g.a=e;g.b=e+1;g.c=e+2;g.d=e+3}else f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],b.push(f.clone()),b.push(h.clone()),b.push(i.clone()),g.a=e,g.b=e+1,g.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,g,
|
|
|
+f,h,i,j,k,q,l,n,s,m,o,p,r,t;for(c=a.faces.length-1;0<=c;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(e=d.a,g=d.b,f=d.c,i=a.vertices[e],j=a.vertices[g],k=a.vertices[f],l=i.position.distanceTo(j.position),n=j.position.distanceTo(k.position),q=i.position.distanceTo(k.position),l>b||n>b||q>b){h=a.vertices.length;r=d.clone();t=d.clone();l>=n&&l>=q?(i=i.clone(),i.position.lerpSelf(j.position,0.5),r.a=e,r.b=h,r.c=f,t.a=h,t.b=g,t.c=f,3===d.vertexNormals.length&&(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[1],
|
|
|
+0.5),r.vertexNormals[1].copy(e),t.vertexNormals[0].copy(e)),3===d.vertexColors.length&&(e=d.vertexColors[0].clone(),e.lerpSelf(d.vertexColors[1],0.5),r.vertexColors[1].copy(e),t.vertexColors[0].copy(e)),d=0):n>=l&&n>=q?(i=j.clone(),i.position.lerpSelf(k.position,0.5),r.a=e,r.b=g,r.c=h,t.a=h,t.b=f,t.c=e,3===d.vertexNormals.length&&(e=d.vertexNormals[1].clone(),e.lerpSelf(d.vertexNormals[2],0.5),r.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e),t.vertexNormals[1].copy(d.vertexNormals[2]),t.vertexNormals[2].copy(d.vertexNormals[0])),
|
|
|
+3===d.vertexColors.length&&(e=d.vertexColors[1].clone(),e.lerpSelf(d.vertexColors[2],0.5),r.vertexColors[2].copy(e),t.vertexColors[0].copy(e),t.vertexColors[1].copy(d.vertexColors[2]),t.vertexColors[2].copy(d.vertexColors[0])),d=1):(i=i.clone(),i.position.lerpSelf(k.position,0.5),r.a=e,r.b=g,r.c=h,t.a=h,t.b=g,t.c=f,3===d.vertexNormals.length&&(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[2],0.5),r.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e)),3===d.vertexColors.length&&(e=d.vertexColors[0].clone(),
|
|
|
+e.lerpSelf(d.vertexColors[2],0.5),r.vertexColors[2].copy(e),t.vertexColors[0].copy(e)),d=2);a.faces.splice(c,1,r,t);a.vertices.push(i);for(e=0;e<a.faceVertexUvs.length;e++)a.faceVertexUvs[e].length&&(t=a.faceVertexUvs[e][c],r=t[0],g=t[1],f=t[2],0===d?(i=r.clone(),i.lerpSelf(g,0.5),t=[r.clone(),i.clone(),f.clone()],g=[i.clone(),g.clone(),f.clone()]):1===d?(i=g.clone(),i.lerpSelf(f,0.5),t=[r.clone(),g.clone(),i.clone()],g=[i.clone(),f.clone(),r.clone()]):(i=r.clone(),i.lerpSelf(f,0.5),t=[r.clone(),
|
|
|
+g.clone(),i.clone()],g=[i.clone(),g.clone(),f.clone()]),a.faceVertexUvs[e].splice(c,1,t,g))}}else if(e=d.a,g=d.b,f=d.c,h=d.d,i=a.vertices[e],j=a.vertices[g],k=a.vertices[f],q=a.vertices[h],l=i.position.distanceTo(j.position),n=j.position.distanceTo(k.position),s=k.position.distanceTo(q.position),m=i.position.distanceTo(q.position),l>b||n>b||s>b||m>b){o=a.vertices.length;p=a.vertices.length+1;r=d.clone();t=d.clone();l>=n&&l>=s&&l>=m||s>=n&&s>=l&&s>=m?(l=i.clone(),l.position.lerpSelf(j.position,0.5),
|
|
|
+j=k.clone(),j.position.lerpSelf(q.position,0.5),r.a=e,r.b=o,r.c=p,r.d=h,t.a=o,t.b=g,t.c=f,t.d=p,4===d.vertexNormals.length&&(e=d.vertexNormals[0].clone(),e.lerpSelf(d.vertexNormals[1],0.5),g=d.vertexNormals[2].clone(),g.lerpSelf(d.vertexNormals[3],0.5),r.vertexNormals[1].copy(e),r.vertexNormals[2].copy(g),t.vertexNormals[0].copy(e),t.vertexNormals[3].copy(g)),4===d.vertexColors.length&&(e=d.vertexColors[0].clone(),e.lerpSelf(d.vertexColors[1],0.5),g=d.vertexColors[2].clone(),g.lerpSelf(d.vertexColors[3],
|
|
|
+0.5),r.vertexColors[1].copy(e),r.vertexColors[2].copy(g),t.vertexColors[0].copy(e),t.vertexColors[3].copy(g)),d=0):(l=j.clone(),l.position.lerpSelf(k.position,0.5),j=q.clone(),j.position.lerpSelf(i.position,0.5),r.a=e,r.b=g,r.c=o,r.d=p,t.a=p,t.b=o,t.c=f,t.d=h,4===d.vertexNormals.length&&(e=d.vertexNormals[1].clone(),e.lerpSelf(d.vertexNormals[2],0.5),g=d.vertexNormals[3].clone(),g.lerpSelf(d.vertexNormals[0],0.5),r.vertexNormals[2].copy(e),r.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(e)),
|
|
|
+4===d.vertexColors.length&&(e=d.vertexColors[1].clone(),e.lerpSelf(d.vertexColors[2],0.5),g=d.vertexColors[3].clone(),g.lerpSelf(d.vertexColors[0],0.5),r.vertexColors[2].copy(e),r.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(e)),d=1);a.faces.splice(c,1,r,t);a.vertices.push(l);a.vertices.push(j);for(e=0;e<a.faceVertexUvs.length;e++)a.faceVertexUvs[e].length&&(t=a.faceVertexUvs[e][c],r=t[0],g=t[1],f=t[2],t=t[3],0===d?(i=r.clone(),i.lerpSelf(g,0.5),j=f.clone(),j.lerpSelf(t,
|
|
|
+0.5),r=[r.clone(),i.clone(),j.clone(),t.clone()],g=[i.clone(),g.clone(),f.clone(),j.clone()]):(i=g.clone(),i.lerpSelf(f,0.5),j=t.clone(),j.lerpSelf(r,0.5),r=[r.clone(),g.clone(),i.clone(),j.clone()],g=[j.clone(),i.clone(),f.clone(),t.clone()]),a.faceVertexUvs[e].splice(c,1,r,g))}}};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,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return g},getNormalMap:function(a,
|
|
|
-b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var q=1;q<e;q++){var l=0>q-1?e-1:q-1,n=(q+1)%e,r=0>j-1?d-1:j-1,m=(j+1)%d,o=[],p=[0,0,h[4*(q*d+j)]/255*b];o.push([-1,0,h[4*(q*d+r)]/255*b]);o.push([-1,-1,h[4*(l*d+r)]/255*b]);o.push([0,-1,
|
|
|
-h[4*(l*d+j)]/255*b]);o.push([1,-1,h[4*(l*d+m)]/255*b]);o.push([1,0,h[4*(q*d+m)]/255*b]);o.push([1,1,h[4*(n*d+m)]/255*b]);o.push([0,1,h[4*(n*d+j)]/255*b]);o.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=o.length;for(n=0;n<r;n++){var m=o[n],s=o[(n+1)%r],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[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]]))}o=[0,0,0];for(n=0;n<l.length;n++)o[0]+=l[n][0],o[1]+=l[n][1],o[2]+=l[n][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
|
|
|
-p=4*(q*d+j);k[p]=255*((o[0]+1)/2)|0;k[p+1]=255*(o[1]+0.5)|0;k[p+2]=255*o[2]|0;k[p+3]=255}f.putImageData(i,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
|
|
|
+b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var q=1;q<e;q++){var l=0>q-1?e-1:q-1,n=(q+1)%e,s=0>k-1?d-1:k-1,m=(k+1)%d,o=[],p=[0,0,h[4*(q*d+k)]/255*b];o.push([-1,0,h[4*(q*d+s)]/255*b]);o.push([-1,-1,h[4*(l*d+s)]/255*b]);o.push([0,-1,
|
|
|
+h[4*(l*d+k)]/255*b]);o.push([1,-1,h[4*(l*d+m)]/255*b]);o.push([1,0,h[4*(q*d+m)]/255*b]);o.push([1,1,h[4*(n*d+m)]/255*b]);o.push([0,1,h[4*(n*d+k)]/255*b]);o.push([-1,1,h[4*(n*d+s)]/255*b]);l=[];s=o.length;for(n=0;n<s;n++){var m=o[n],r=o[(n+1)%s],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],r=[r[0]-p[0],r[1]-p[1],r[2]-p[2]];l.push(c([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}o=[0,0,0];for(n=0;n<l.length;n++)o[0]+=l[n][0],o[1]+=l[n][1],o[2]+=l[n][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
|
|
|
+p=4*(q*d+k);j[p]=255*((o[0]+1)/2)|0;j[p+1]=255*(o[1]+0.5)|0;j[p+2]=255*o[2]|0;j[p+3]=255}f.putImageData(i,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,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,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
|
(b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
|
|
@@ -74,37 +76,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=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,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,g);this.curves.push(h);h=h.getPoint(g?1:0);f.push(h.x);f.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:f})};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,g);this.curves.push(h);h=h.getPoint(g?1:0);f.push(h.x);f.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,q,l,n,r,m;for(d=0,e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];l=g[1];0<c.length?(f=c[c.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(g=1;g<=
|
|
|
-a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,r,l,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];l=g[1];k=g[2];j=g[3];0<c.length?(f=c[c.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,r,l,j,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;m=[new THREE.Vector2(f[f.length-
|
|
|
-2],f[f.length-1])];f=a*g[0].length;m=m.concat(g[0]);m=new THREE.SplineCurve(m);for(g=1;g<=f;g++)c.push(m.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];i=g[1];k=g[2];q=g[3];l=!!g[5];j=g[4]-q;n=2*a;for(g=1;g<=n;g++)m=g/n,l||(m=1-m),m=q+m*j,f=h+k*Math.cos(m),m=i+k*Math.sin(m),c.push(new THREE.Vector2(f,m))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&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,e,g){var f=this.getPoints(),h,i,k,j,q;for(h=0,i=f.length;h<i;h++)k=f[h],j=k.x,q=k.y,k.x=a*j+b*q+c,k.y=d*q+e*j+g;return f};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,j,k,q,l,n,s,m;for(d=0,e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];l=g[1];0<c.length?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(g=1;g<=
|
|
|
+a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,s,l,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];l=g[1];j=g[2];k=g[3];0<c.length?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,n,q,j,h),m=THREE.Shape.Utils.b3(m,s,l,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;m=[new THREE.Vector2(f[f.length-
|
|
|
+2],f[f.length-1])];f=a*g[0].length;m=m.concat(g[0]);m=new THREE.SplineCurve(m);for(g=1;g<=f;g++)c.push(m.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];i=g[1];j=g[2];q=g[3];l=!!g[5];k=g[4]-q;n=2*a;for(g=1;g<=n;g++)m=g/n,l||(m=1-m),m=q+m*k,f=h+j*Math.cos(m),m=i+j*Math.sin(m),c.push(new THREE.Vector2(f,m))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&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,e,g){var f=this.getPoints(),h,i,j,k,q;for(h=0,i=f.length;h<i;h++)j=f[h],k=j.x,q=j.y,j.x=a*k+b*q+c,j.y=d*q+e*k+g;return f};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
|
this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);0!=g.actions.length&&e.push(g);if(0==e.length)return[];var f;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return g=e[0],f=new THREE.Shape,f.actions=g.actions,f.curves=g.curves,d.push(f),d;if(a){f=new THREE.Shape;for(a=0,b=e.length;a<
|
|
|
b;a++)g=e[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(f.actions=g.actions,f.curves=g.curves,d.push(f),f=new THREE.Shape):f.holes.push(g)}else{for(a=0,b=e.length;a<b;a++)g=e[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(f&&d.push(f),f=new THREE.Shape,f.actions=g.actions,f.curves=g.curves):f.holes.push(g);d.push(f)}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.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,q,l,n,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){l=k[e];n=[];for(q=0;q<c.length;q++)j=c[q],j=l.distanceToSquared(j),n.push(j),j<g&&(g=j,f=e,h=q)}e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:k.length-1;var m=[k[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(m);var o=[k[f],k[g],c[h]];l=THREE.FontUtils.Triangulate.area(o);n=h;j=f;h+=1;f+=-1;0>
|
|
|
-h&&(h+=c.length);h%=c.length;0>f&&(f+=k.length);f%=k.length;e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:k.length-1;m=[k[f],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);o=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(o);q+l>m+o&&(h=n,f=j,0>h&&(h+=c.length),h%=c.length,0>f&&(f+=k.length),f%=k.length,e=0<=h-1?h-1:c.length-1,g=0<=f-1?f-1:k.length-1);q=c.slice(0,h);l=c.slice(h);n=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];r.push([k[f],c[h],c[e]]);r.push(g);c=q.concat(n).concat(j).concat(l)}return{shape:c,
|
|
|
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};for(g=0,f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=g;for(g=0,f=c.length;g<f;g++){h=c[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(g=0,f=e.length;g<f;g++){h=e[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,j,k,q,l,n,s=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){l=j[e];n=[];for(q=0;q<c.length;q++)k=c[q],k=l.distanceToSquared(k),n.push(k),k<g&&(g=k,f=e,h=q)}e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;var m=[j[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(m);var o=[j[f],j[g],c[h]];l=THREE.FontUtils.Triangulate.area(o);n=h;k=f;h+=1;f+=-1;0>
|
|
|
+h&&(h+=c.length);h%=c.length;0>f&&(f+=j.length);f%=j.length;e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;m=[j[f],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);o=[j[f],j[g],c[h]];o=THREE.FontUtils.Triangulate.area(o);q+l>m+o&&(h=n,f=k,0>h&&(h+=c.length),h%=c.length,0>f&&(f+=j.length),f%=j.length,e=0<=h-1?h-1:c.length-1,g=0<=f-1?f-1:j.length-1);q=c.slice(0,h);l=c.slice(h);n=j.slice(f);k=j.slice(0,f);g=[j[f],j[g],c[h]];s.push([j[f],c[h],c[e]]);s.push(g);c=q.concat(n).concat(k).concat(l)}return{shape:c,
|
|
|
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,j={};for(g=0,f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=g;for(g=0,f=c.length;g<f;g++){h=c[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(g=0,f=e.length;g<f;g++){h=e[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",g=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
|
|
|
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){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
|
|
|
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
|
|
|
-{};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var 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++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
|
|
|
1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
|
|
|
THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,q,l;l=this.currentTime+=a*this.timeScale;q=this.currentTime%=this.data.length;k=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++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==j[n][k])a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
-j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)f=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<q)}i.prevKey[c]=
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,j,k=this.data.JIT.hierarchy,q,l;l=this.currentTime+=a*this.timeScale;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==k[n][j])a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
+k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)f=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<q)}i.prevKey[c]=
|
|
|
f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-f.time)/(h.time-f.time);e=f[c];g=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
this.getPrevKeyWith("pos",n,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
|
-c)THREE.Quaternion.slerp(e,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&void 0===j[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
|
|
|
+c)THREE.Quaternion.slerp(e,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);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=[],e,g,f,h,i,j;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],j[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],j[2],e,c,f);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
@@ -112,9 +114,9 @@ d.matrixWorldNeedsUpdate=!0}}};
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;h=this.currentTime+=a*this.timeScale;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];if(j.length){for(j=
|
|
|
-0;j<g.length;j++)f=g[j],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,q=b.animationCache;if(this.JITCompile&&void 0!==g[a][e])d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&q)d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<f;)b=c,c=j[b.index+1]}else if(!i)for(var l=j.length-1;c.time<f&&c.index!==l;)b=c,c=j[b.index+1];q.prevKey=b;q.nextKey=c}c.time>=f?b.interpolate(c,f):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;h=this.currentTime+=a*this.timeScale;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
|
|
|
+0;k<g.length;k++)f=g[k],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<this.startTime)){a=0;for(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&&void 0!==g[a][e])d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);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<f;)b=c,c=k[b.index+1]}else if(!i)for(var l=k.length-1;c.time<f&&c.index!==l;)b=c,c=k[b.index+1];q.prevKey=b;q.nextKey=c}c.time>=f?b.interpolate(c,f):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
@@ -134,7 +136,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&
|
|
|
(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
|
this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,p=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)p=d*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),o=f.length,p=0;g=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<o-1;g++)p=d*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
|
new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
|
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=0<=a?a:a+f;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
@@ -152,71 +154,71 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=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*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,j=0,k=0,q=0,l=0,n=window.innerWidth/2,s=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*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);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:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
|
-new THREE.Vector3;var d=new THREE.Vector3,e=!1,g=-1,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
+new THREE.Vector3;var d=new THREE.Vector3,e=!1,g=-1,f=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("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(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(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);
|
|
|
+d.setFromAxisAngle(b,-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);
|
|
|
b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?q=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),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(c.target);
|
|
|
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(n),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),q=l=c.getMouseOnScreen(a.clientX,
|
|
|
-a.clientY),e=!1),-1!==g&&(0===g&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):2===g&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===g))g=a.button,0===g&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=l=
|
|
|
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(n),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),q=l=c.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY),e=!1),-1!==g&&(0===g&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===g&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===g))g=a.button,0===g&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=l=
|
|
|
c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),g=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===g&&(a.keyCode===c.keys[0]&&!c.noRotate?g=0:a.keyCode===c.keys[1]&&!c.noZoom?g=1:a.keyCode===c.keys[2]&&!c.noPan&&(g=2),-1!==g&&(e=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==g&&(g=-1)},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,l,j){var m,n=d||1,q=e||1,r=h/2,p=i/2,o=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",q=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",n=g||1;var s=n+1,t=q+1,E=h/n,B=i/q,M=new THREE.Vector3;M[m]=0<l?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var N=new THREE.Vector3;N[a]=(i*E-r)*c;N[b]=(h*B-p)*f;N[m]=l;k.vertices.push(new THREE.Vertex(N))}for(h=0;h<q;h++)for(i=0;i<n;i++)a=
|
|
|
-new THREE.Face4(i+s*h+o,i+s*(h+1)+o,i+1+s*(h+1)+o,i+1+s*h+o),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=j,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/n,h/q),new THREE.UV(i/n,(h+1)/q),new THREE.UV((i+1)/n,(h+1)/q),new THREE.UV((i+1)/n,h/q)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,l=c/2,n,r,m,o,p,s;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(f)}n=0;o=1;r=2;p=
|
|
|
-3;m=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,o);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);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=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,l,k){var m,n=d||1,q=e||1,s=h/2,p=i/2,o=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",q=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",n=g||1;var r=n+1,t=q+1,E=h/n,B=i/q,M=new THREE.Vector3;M[m]=0<l?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var N=new THREE.Vector3;N[a]=(i*E-s)*c;N[b]=(h*B-p)*f;N[m]=l;j.vertices.push(new THREE.Vertex(N))}for(h=0;h<q;h++)for(i=0;i<n;i++)a=
|
|
|
+new THREE.Face4(i+r*h+o,i+r*(h+1)+o,i+1+r*(h+1)+o,i+1+r*h+o),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/n,h/q),new THREE.UV(i/n,(h+1)/q),new THREE.UV((i+1)/n,(h+1)/q),new THREE.UV((i+1)/n,h/q)])}THREE.Geometry.call(this);var j=this,k=a/2,q=b/2,l=c/2,n,s,m,o,p,r;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(f)}n=0;o=1;s=2;p=
|
|
|
+3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,o);this.sides.py&&i("x","z",1,1,a,c,q,s);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var q=[],l=[],n=i/e,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,o=r*Math.sin(2*m*Math.PI),p=-n*c+f,s=r*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,p,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}k.push(q);j.push(l)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],
|
|
|
-l=k[i+1][h+1],n=k[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),v=j[i+1][h+1].clone(),u=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,o,p]));this.faceVertexUvs[0].push([s,t,v,u])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=
|
|
|
-0;h<d;h++)c=k[0][h],q=k[0][h+1],l=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,v])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],q=k[i][h],l=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
|
|
|
-0),s=j[i][h+1].clone(),t=j[i][h].clone(),v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,f=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var q=[],l=[],n=i/e,s=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,o=s*Math.sin(2*m*Math.PI),p=-n*c+f,r=s*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,p,r)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(q);k.push(l)}for(i=0;i<e;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],s=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),r=k[i][h].clone(),t=k[i+1][h].clone(),v=k[i+1][h+1].clone(),u=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[s,m,o,p]));this.faceVertexUvs[0].push([r,t,v,u])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=
|
|
|
+0;h<d;h++)c=j[0][h],q=j[0][h+1],l=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),r=k[0][h].clone(),t=k[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,l,[s,m,o])),this.faceVertexUvs[0].push([r,t,v])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],q=j[i][h],l=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
|
|
|
+0),r=k[i][h+1].clone(),t=k[i][h].clone(),v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,l,[s,m,o])),this.faceVertexUvs[0].push([r,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),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,f=THREE.ExtrudeGeometry.__v2,e=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);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);0===e&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(B=c.length;0<=--B;){e=B;f=B-1;0>f&&(f=c.length-1);
|
|
|
-for(var g=0,h=n+2*j,g=0;g<h;g++){var i=L*g,l=L*(g+1),k=d+e+i,i=d+f+i,m=d+f+l,l=d+e+l,q=c,r=g,p=h,k=k+A,i=i+A,m=m+A,l=l+A;y.faces.push(new THREE.Face4(k,i,m,l,null,null,v));k=N.generateSideWallUV(y,a,q,b,k,i,m,l,r,p);y.faceVertexUvs[0].push(k)}}}function g(a,b,c){y.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(c,d,f,e){c+=A;d+=A;f+=A;y.faces.push(new THREE.Face3(c,d,f,null,null,t));c=e?N.generateBottomUV(y,a,b,c,d,f):N.generateTopUV(y,a,b,c,d,f);y.faceVertexUvs[0].push(c)}var h=
|
|
|
-void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,j=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,r=b.bendPath,m=b.extrudePath,o,p=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial;if(m)o=m.getPoints(l),n=o.length,p=!0,q=!1;q||(k=i=j=0);var u,w,z,y=this,A=this.vertices.length;r&&a.addWrapPath(r);
|
|
|
-var r=s?a.extractAllSpacedPoints(l):a.extractAllPoints(l),l=r.shape,D=r.holes;if(r=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();for(w=0,z=D.length;w<z;w++)u=D[w],THREE.Shape.Utils.isClockWise(u)&&(D[w]=u.reverse());r=!1}var I=THREE.Shape.Utils.triangulateShape(l,D),J=l;for(w=0,z=D.length;w<z;w++)u=D[w],l=l.concat(u);var H,C,x,F,G,L=l.length,K,E=I.length,r=[],B=0;x=J.length;H=x-1;for(C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),r[B]=d(J[B],J[H],J[C]);var m=[],M,s=r.concat();for(w=0,z=D.length;w<
|
|
|
-z;w++){u=D[w];M=[];for(B=0,x=u.length,H=x-1,C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),M[B]=d(u[B],u[H],u[C]);m.push(M);s=s.concat(M)}for(H=0;H<j;H++){x=H/j;F=i*(1-x);C=k*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],r[B],C),g(G.x,G.y,-F);for(w=0,z=D.length;w<z;w++){u=D[w];M=m[w];for(B=0,x=u.length;B<x;B++)G=c(u[B],M[B],C),g(G.x,G.y,-F)}}C=k;for(B=0;B<L;B++)G=q?c(l[B],s[B],C):l[B],p?g(G.x,G.y+o[0].y,o[0].x):g(G.x,G.y,0);for(x=1;x<=n;x++)for(B=0;B<L;B++)G=q?c(l[B],s[B],C):l[B],p?g(G.x,
|
|
|
-G.y+o[x-1].y,o[x-1].x):g(G.x,G.y,h/n*x);for(H=j-1;0<=H;H--){x=H/j;F=i*(1-x);C=k*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],r[B],C),g(G.x,G.y,h+F);for(w=0,z=D.length;w<z;w++){u=D[w];M=m[w];for(B=0,x=u.length;B<x;B++)G=c(u[B],M[B],C),p?g(G.x,G.y+o[n-1].y,o[n-1].x+F):g(G.x,G.y,h+F)}}var N=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(q){var a;a=0*L;for(B=0;B<E;B++)K=I[B],f(K[2]+a,K[1]+a,K[0]+a,!0);a=n+2*j;a*=L;for(B=0;B<E;B++)K=I[B],f(K[0]+a,K[1]+a,K[2]+a,!1)}else{for(B=0;B<E;B++)K=
|
|
|
+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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,g;for(B=c.length;0<=--B;){e=B;g=B-1;0>g&&(g=c.length-1);
|
|
|
+for(var f=0,h=n+2*k,f=0;f<h;f++){var i=L*f,l=L*(f+1),j=d+e+i,i=d+g+i,m=d+g+l,l=d+e+l,q=c,s=f,p=h,j=j+A,i=i+A,m=m+A,l=l+A;y.faces.push(new THREE.Face4(j,i,m,l,null,null,v));j=N.generateSideWallUV(y,a,q,b,j,i,m,l,s,p);y.faceVertexUvs[0].push(j)}}}function g(a,b,c){y.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(c,d,e,f){c+=A;d+=A;e+=A;y.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?N.generateBottomUV(y,a,b,c,d,e):N.generateTopUV(y,a,b,c,d,e);y.faceVertexUvs[0].push(c)}var h=
|
|
|
+void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,s=b.bendPath,m=b.extrudePath,o,p=!1,r=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial;if(m)o=m.getPoints(l),n=o.length,p=!0,q=!1;q||(j=i=k=0);var u,w,z,y=this,A=this.vertices.length;s&&a.addWrapPath(s);
|
|
|
+var s=r?a.extractAllSpacedPoints(l):a.extractAllPoints(l),l=s.shape,D=s.holes;if(s=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();for(w=0,z=D.length;w<z;w++)u=D[w],THREE.Shape.Utils.isClockWise(u)&&(D[w]=u.reverse());s=!1}var I=THREE.Shape.Utils.triangulateShape(l,D),J=l;for(w=0,z=D.length;w<z;w++)u=D[w],l=l.concat(u);var H,C,x,F,G,L=l.length,K,E=I.length,s=[],B=0;x=J.length;H=x-1;for(C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),s[B]=d(J[B],J[H],J[C]);var m=[],M,r=s.concat();for(w=0,z=D.length;w<
|
|
|
+z;w++){u=D[w];M=[];for(B=0,x=u.length,H=x-1,C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),M[B]=d(u[B],u[H],u[C]);m.push(M);r=r.concat(M)}for(H=0;H<k;H++){x=H/k;F=i*(1-x);C=j*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],s[B],C),g(G.x,G.y,-F);for(w=0,z=D.length;w<z;w++){u=D[w];M=m[w];for(B=0,x=u.length;B<x;B++)G=c(u[B],M[B],C),g(G.x,G.y,-F)}}C=j;for(B=0;B<L;B++)G=q?c(l[B],r[B],C):l[B],p?g(G.x,G.y+o[0].y,o[0].x):g(G.x,G.y,0);for(x=1;x<=n;x++)for(B=0;B<L;B++)G=q?c(l[B],r[B],C):l[B],p?g(G.x,
|
|
|
+G.y+o[x-1].y,o[x-1].x):g(G.x,G.y,h/n*x);for(H=k-1;0<=H;H--){x=H/k;F=i*(1-x);C=j*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],s[B],C),g(G.x,G.y,h+F);for(w=0,z=D.length;w<z;w++){u=D[w];M=m[w];for(B=0,x=u.length;B<x;B++)G=c(u[B],M[B],C),p?g(G.x,G.y+o[n-1].y,o[n-1].x+F):g(G.x,G.y,h+F)}}var N=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(q){var a;a=0*L;for(B=0;B<E;B++)K=I[B],f(K[2]+a,K[1]+a,K[0]+a,!0);a=n+2*k;a*=L;for(B=0;B<E;B++)K=I[B],f(K[0]+a,K[1]+a,K[2]+a,!1)}else{for(B=0;B<E;B++)K=
|
|
|
I[B],f(K[2],K[1],K[0],!0);for(B=0;B<E;B++)K=I[B],f(K[0]+L*n,K[1]+L*n,K[2]+L*n,!1)}})();(function(){var a=0;e(J,a);a+=J.length;for(w=0,z=D.length;w<z;w++)u=D[w],e(u,a),a+=u.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,g){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[g].position.x;g=a.vertices[g].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-g)]},generateBottomUV:function(a,b,c,d,e,g){return this.generateTopUV(a,b,c,d,e,g)},generateSideWallUV:function(a,b,c,d,e,g,f,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
|
|
|
-d=a.vertices[g].position.x,i=a.vertices[g].position.y,g=a.vertices[g].position.z,k=a.vertices[f].position.x,j=a.vertices[f].position.y,f=a.vertices[f].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,g),new THREE.UV(k,f),new THREE.UV(q,a)]:[new THREE.UV(c,e),new THREE.UV(i,g),new THREE.UV(j,f),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+d=a.vertices[g].position.x,i=a.vertices[g].position.y,g=a.vertices[g].position.z,j=a.vertices[f].position.x,k=a.vertices[f].position.y,f=a.vertices[f].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,g),new THREE.UV(j,f),new THREE.UV(q,a)]:[new THREE.UV(c,e),new THREE.UV(i,g),new THREE.UV(k,f),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);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;0==i&&(g=d);
|
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
|
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
|
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,g=void 0!==g?g:0,f=void 0!==f?f:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],j=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=-a*Math.cos(d+n*e)*Math.sin(g+r*f),o=a*Math.cos(g+r*f),p=a*Math.sin(d+n*e)*Math.sin(g+r*f);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
|
|
|
-r))}k.push(q);j.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[e].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),r=this.vertices[f].position.clone().normalize(),m=j[i][h+1].clone(),o=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[q,n,r])),this.faceVertexUvs[0].push([m,
|
|
|
-p,s])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[q,l,n])),this.faceVertexUvs[0].push([m,o,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,l,n,r])),this.faceVertexUvs[0].push([m,o,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,g=void 0!==g?g:0,f=void 0!==f?f: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,s=i/c,m=-a*Math.cos(d+n*e)*Math.sin(g+s*f),o=a*Math.cos(g+s*f),p=a*Math.sin(d+n*e)*Math.sin(g+s*f);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
|
|
|
+s))}j.push(q);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],g=j[i+1][h],f=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[e].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),m=k[i][h+1].clone(),o=k[i][h].clone(),p=k[i+1][h].clone(),r=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[q,n,s])),this.faceVertexUvs[0].push([m,
|
|
|
+p,r])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[q,l,n])),this.faceVertexUvs[0].push([m,o,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,l,n,s])),this.faceVertexUvs[0].push([m,o,p,r]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=(""+a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,q,l,n,r,m,o,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(n,r,i,j);if(f=g[g.length-1]){q=f.x;l=f.y;for(f=1,h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,q,n,i),s=THREE.Shape.Utils.b2(s,l,r,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,n=b[a++]*c+d,r=b[a++]*-c,m=b[a++]*c+d,o=b[a++]*-c,e.bezierCurveTo(i,j,n,r,m,o),f=g[g.length-1]){q=f.x;l=f.y;for(f=1,h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,q,n,
|
|
|
-m,i),s=THREE.Shape.Utils.b3(s,l,r,o,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:e}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],i,k,j;if(0<b(a))for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var q=2*e;for(k=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var l;a:{l=a;var n=i,r=k,m=j,o=e,p=f,s=void 0,t=void 0,v=void 0,u=void 0,w=void 0,
|
|
|
-z=void 0,y=void 0,A=void 0,D=void 0,t=l[p[n]].x,v=l[p[n]].y,u=l[p[r]].x,w=l[p[r]].y,z=l[p[m]].x,y=l[p[m]].y;if(1.0E-10>(u-t)*(y-v)-(w-v)*(z-t))l=!1;else{for(s=0;s<o;s++)if(!(s==n||s==r||s==m)){var A=l[p[s]].x,D=l[p[s]].y,I=void 0,J=void 0,H=void 0,C=void 0,x=void 0,F=void 0,G=void 0,L=void 0,K=void 0,E=void 0,B=void 0,M=void 0,I=H=x=void 0,I=z-u,J=y-w,H=t-z,C=v-y,x=u-t,F=w-v,G=A-t,L=D-v,K=A-u,E=D-w,B=A-z,M=D-y,I=I*E-J*K,x=x*L-F*G,H=H*M-C*B;if(0<=I&&0<=H&&0<=x){l=!1;break a}}l=!0}}if(l){g.push([a[f[i]],
|
|
|
-a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);for(i=k,j=k+1;j<e;i++,j++)f[i]=f[j];e--;q=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+0,e=(""+a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,j,k,q,l,n,s,m,o,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(n,s,i,k);if(f=g[g.length-1]){q=f.x;l=f.y;for(f=1,h=this.divisions;f<=h;f++){var r=f/h,t=THREE.Shape.Utils.b2(r,q,n,i),r=THREE.Shape.Utils.b2(r,l,s,k);g.push(new THREE.Vector2(t,r))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,s=b[a++]*-c,m=b[a++]*c+d,o=b[a++]*-c,e.bezierCurveTo(i,k,n,s,m,o),f=g[g.length-1]){q=f.x;l=f.y;for(f=1,h=this.divisions;f<=h;f++)r=f/h,t=THREE.Shape.Utils.b3(r,q,n,
|
|
|
+m,i),r=THREE.Shape.Utils.b3(r,l,s,o,k),g.push(new THREE.Vector2(t,r))}}}return{offset:p.ha*c,points:g,path:e}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],i,j,k;if(0<b(a))for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var q=2*e;for(j=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var l;a:{l=a;var n=i,s=j,m=k,o=e,p=f,r=void 0,t=void 0,v=void 0,u=void 0,w=void 0,
|
|
|
+z=void 0,y=void 0,A=void 0,D=void 0,t=l[p[n]].x,v=l[p[n]].y,u=l[p[s]].x,w=l[p[s]].y,z=l[p[m]].x,y=l[p[m]].y;if(1.0E-10>(u-t)*(y-v)-(w-v)*(z-t))l=!1;else{for(r=0;r<o;r++)if(!(r==n||r==s||r==m)){var A=l[p[r]].x,D=l[p[r]].y,I=void 0,J=void 0,H=void 0,C=void 0,x=void 0,F=void 0,G=void 0,L=void 0,K=void 0,E=void 0,B=void 0,M=void 0,I=H=x=void 0,I=z-u,J=y-w,H=t-z,C=v-y,x=u-t,F=w-v,G=A-t,L=D-v,K=A-u,E=D-w,B=A-z,M=D-y,I=I*E-J*K,x=x*L-F*G,H=H*M-C*B;if(0<=I&&0<=H&&0<=x){l=!1;break a}}l=!0}}if(l){g.push([a[f[i]],
|
|
|
+a[f[j]],a[f[k]]]);h.push([f[i],f[j],f[k]]);for(i=j,k=j+1;k<e;i++,k++)f[i]=f[k];e--;q=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
|
this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,f,e){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*f*(2+c);b=0.5*f*(2+c)*b;f=0.5*e*f*Math.sin(a);return new THREE.Vector3(g,b,f)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
+THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,f=2*(b/this.segmentsT)*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
|
|
|
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,g));this.faceVertexUvs[0].push([f,i,k,j])}this.computeCentroids();this.computeFaceNormals();
|
|
|
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),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,e,g));this.faceVertexUvs[0].push([f,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,e){THREE.Geometry.call(this);this.radius=a||40;this.segments=b||64;this.segmentsRadius=c||8;this.grid=Array(this.segments);this.path=d;if(e)this.debug=new THREE.Object3D;for(var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,f,h,i,b=0;b<this.segments;++b){this.grid[b]=Array(this.segmentsRadius);f=b/(this.segments-1);g=this.path.getPointAt(f);c=this.path.getTangentAt(f);if(void 0===i&&(i=f-0.0010,0>i&&(i=0),i=this.path.getTangentAt(i),
|
|
|
-f+=0.0010,1<f&&(f=1),f=this.path.getTangentAt(f),e.sub(f,i).normalize(),d.cross(c,e),i=d,0==i.length())){f=Number.MAX_VALUE;h=Math.abs(c.x);var k=Math.abs(c.y),j=Math.abs(c.z);h<=f&&(f=h,i.set(1,0,0));k<=f&&(f=k,i.set(0,1,0));j<=f&&i.set(0,0,1)}e.cross(i,c).normalize();d.cross(c,e).normalize();i=d;this.debug&&this.debug.add(new THREE.ArrowHelper(e,g,2*a,16711680));for(c=0;c<this.segmentsRadius;++c)h=2*(c/this.segmentsRadius)*Math.PI,f=-this.radius*Math.cos(h),h=this.radius*Math.sin(h),k=g.clone(),
|
|
|
-k.x+=f*e.x+h*d.x,k.y+=f*e.y+h*d.y,k.z+=f*e.z+h*d.z,this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(k.x,k.y,k.z)))-1}for(b=0;b<this.segments-1;++b)for(c=0;c<this.segmentsRadius;++c)d=(b+1)%this.segments,e=(c+1)%this.segmentsRadius,a=this.grid[b][c],i=this.grid[d][c],d=this.grid[d][e],e=this.grid[b][e],g=new THREE.UV(b/this.segments,c/this.segmentsRadius),f=new THREE.UV((b+1)/this.segments,c/this.segmentsRadius),h=new THREE.UV((b+1)/this.segments,(c+1)/this.segmentsRadius),k=new THREE.UV(b/
|
|
|
-this.segments,(c+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(a,i,d,e)),this.faceVertexUvs[0].push([g,f,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
+f+=0.0010,1<f&&(f=1),f=this.path.getTangentAt(f),e.sub(f,i).normalize(),d.cross(c,e),i=d,0==i.length())){f=Number.MAX_VALUE;h=Math.abs(c.x);var j=Math.abs(c.y),k=Math.abs(c.z);h<=f&&(f=h,i.set(1,0,0));j<=f&&(f=j,i.set(0,1,0));k<=f&&i.set(0,0,1)}e.cross(i,c).normalize();d.cross(c,e).normalize();i=d;this.debug&&this.debug.add(new THREE.ArrowHelper(e,g,2*a,16711680));for(c=0;c<this.segmentsRadius;++c)h=2*(c/this.segmentsRadius)*Math.PI,f=-this.radius*Math.cos(h),h=this.radius*Math.sin(h),j=g.clone(),
|
|
|
+j.x+=f*e.x+h*d.x,j.y+=f*e.y+h*d.y,j.z+=f*e.z+h*d.z,this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(j.x,j.y,j.z)))-1}for(b=0;b<this.segments-1;++b)for(c=0;c<this.segmentsRadius;++c)d=(b+1)%this.segments,e=(c+1)%this.segmentsRadius,a=this.grid[b][c],i=this.grid[d][c],d=this.grid[d][e],e=this.grid[b][e],g=new THREE.UV(b/this.segments,c/this.segmentsRadius),f=new THREE.UV((b+1)/this.segments,c/this.segmentsRadius),h=new THREE.UV((b+1)/this.segments,(c+1)/this.segmentsRadius),j=new THREE.UV(b/
|
|
|
+this.segments,(c+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(a,i,d,e)),this.faceVertexUvs[0].push([g,f,h,j]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(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 g(a,b,c,d){1>d?(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)])):(d-=1,g(a,f(a,b),f(a,c),d),g(f(a,b),b,f(b,c),d),g(f(a,c),f(b,c),c,d),g(f(a,b),f(b,c),f(a,c),d))}function f(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];void 0===c&&(q[a.index][b.index]=q[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
|
|
|
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,k=0,j=a.length;k<j;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var q=[],a=this.vertices,k=0,j=b.length;k<j;k++)g(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(j=this.vertices.length;k<j;k++)this.vertices[k].position.multiplyScalar(c);this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;
|
|
|
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)e(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++)g(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.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)};THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
|
|
@@ -231,79 +233,79 @@ this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THR
|
|
|
THREE.CameraHelper.prototype.update=function(a){function b(a,b,g,f){THREE.CameraHelper.__v.set(b,g,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(g=a.length;b<g;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
|
|
|
1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,n,q=0;4>q;q++){n=i[q];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[q]=k}}e.push(j);(!f.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},l=[],n,r,m,o,p,s=a.faceVertexUvs[0];for(n=0,r=s.length;n<r;n++)for(m=0,o=s[n].length;m<o;m++)p=d[n]["abcd".charAt(m)],l[p]||(l[p]=s[n][m]);var t;for(n=0,r=d.length;n<r;n++)if(p=d[n],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&0!=l.length){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=l[p.a].u+l[p.b].u+l[p.c].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
|
|
|
-l[p.a].u+l[p.b].u+l[p.c].u+l[p.d].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v+l[p.d].v,t.u/=4,t.v/=4;l.push(t)}r=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};for(d=0,f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var v=0,s=h.length,u,w,z={},y={},A=function(a,
|
|
|
-b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},D=function(a,b){void 0===y[a]&&(y[a]={});y[a][b]=null};for(n in r){t=r[n];u=n.split("_");w=u[0];u=u[1];A(w,[w,u]);A(u,[w,u]);for(m=0,o=t.length;m<o;m++)p=t[m],D(w,p,n),D(u,p,n);2>t.length&&(q[n]=!0)}for(n in r)if(t=r[n],p=t[0],t=t[1],u=n.split("_"),w=u[0],u=u[1],o=new THREE.Vector3,q[n]?(o.addSelf(h[w].position),o.addSelf(h[u].position),o.multiplyScalar(0.5)):(o.addSelf(k[p]),o.addSelf(k[t]),o.addSelf(h[w].position),o.addSelf(h[u].position),o.multiplyScalar(0.25)),
|
|
|
-j[n]=s+d.length+v,i.push(new THREE.Vertex(o)),v++,f.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[u].u,t.v=l[w].v+l[u].v,t.u/=2,t.v/=2,l.push(t);var I,J;u=["123","12","2","23"];o=["123","23","3","31"];var A=["123","31","1","12"],D=["1234","12","2","23"],H=["1234","23","3","34"],C=["1234","34","4","41"],x=["1234","41","1","12"];for(n=0,r=k.length;n<r;n++)p=d[n],t=s+n,p instanceof THREE.Face3?(v=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.a),b(t,j[v],p.b,j[w],p,u),b(t,j[w],p.c,j[I],p,o),b(t,j[I],p.a,j[v],
|
|
|
-p,A)):p instanceof THREE.Face4?(v=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.d),J=c(p.d,p.a),b(t,j[v],p.b,j[w],p,D),b(t,j[w],p.c,j[I],p,H),b(t,j[I],p.d,j[J],p,C),b(t,j[J],p.a,j[v],p,x)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void 0!==z[n]){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in y[n])i.addSelf(k[m]),t++;v=0;s=z[n].length;for(m=0;m<s;m++)q[c(z[n][m][0],z[n][m][1])]&&v++;if(2!=v){i.divideScalar(t);for(m=0;m<
|
|
|
-s;m++)t=z[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,m,n,q=0;4>q;q++){n=i[q];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-1],j.r+=m.r,j.g+=m.g,j.b+=m.b;j.r/=n.length;j.g/=n.length;j.b/=n.length;k.vertexColors[q]=j}}e.push(k);(!f.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},q={},l=[],n,s,m,o,p,r=a.faceVertexUvs[0];for(n=0,s=r.length;n<s;n++)for(m=0,o=r[n].length;m<o;m++)p=d[n]["abcd".charAt(m)],l[p]||(l[p]=r[n][m]);var t;for(n=0,s=d.length;n<s;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&0!=l.length){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=l[p.a].u+l[p.b].u+l[p.c].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
|
|
|
+l[p.a].u+l[p.b].u+l[p.c].u+l[p.d].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v+l[p.d].v,t.u/=4,t.v/=4;l.push(t)}s=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,r=h.length,u,w,z={},y={},A=function(a,
|
|
|
+b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},D=function(a,b){void 0===y[a]&&(y[a]={});y[a][b]=null};for(n in s){t=s[n];u=n.split("_");w=u[0];u=u[1];A(w,[w,u]);A(u,[w,u]);for(m=0,o=t.length;m<o;m++)p=t[m],D(w,p,n),D(u,p,n);2>t.length&&(q[n]=!0)}for(n in s)if(t=s[n],p=t[0],t=t[1],u=n.split("_"),w=u[0],u=u[1],o=new THREE.Vector3,q[n]?(o.addSelf(h[w].position),o.addSelf(h[u].position),o.multiplyScalar(0.5)):(o.addSelf(j[p]),o.addSelf(j[t]),o.addSelf(h[w].position),o.addSelf(h[u].position),o.multiplyScalar(0.25)),
|
|
|
+k[n]=r+d.length+v,i.push(new THREE.Vertex(o)),v++,f.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[u].u,t.v=l[w].v+l[u].v,t.u/=2,t.v/=2,l.push(t);var I,J;u=["123","12","2","23"];o=["123","23","3","31"];var A=["123","31","1","12"],D=["1234","12","2","23"],H=["1234","23","3","34"],C=["1234","34","4","41"],x=["1234","41","1","12"];for(n=0,s=j.length;n<s;n++)p=d[n],t=r+n,p instanceof THREE.Face3?(v=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.a),b(t,k[v],p.b,k[w],p,u),b(t,k[w],p.c,k[I],p,o),b(t,k[I],p.a,k[v],
|
|
|
+p,A)):p instanceof THREE.Face4?(v=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.d),J=c(p.d,p.a),b(t,k[v],p.b,k[w],p,D),b(t,k[w],p.c,k[I],p,H),b(t,k[I],p.d,k[J],p,C),b(t,k[J],p.a,k[v],p,x)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,s=h.length;n<s;n++)if(void 0!==z[n]){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in y[n])i.addSelf(j[m]),t++;v=0;r=z[n].length;for(m=0;m<r;m++)q[c(z[n][m][0],z[n][m][1])]&&v++;if(2!=v){i.divideScalar(t);for(m=0;m<
|
|
|
+r;m++)t=z[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),k.addSelf(t);k.divideScalar(r);p.addSelf(h[n].position);p.multiplyScalar(r-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(r);d[n].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"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(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
|
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=!0};f.crossOrigin=h.crossOrigin;f.src=b}function g(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
|
|
|
-if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
|
|
|
-("Phong"==a.shading?i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)k.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)k.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)k.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)k.transparent=a.transparent;if(void 0!==a.depthTest)k.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=
|
|
|
-THREE.VertexColors;if(a.colorDiffuse)k.color=f(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=f(a.colorSpecular);if(a.colorAmbient)k.ambient=f(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&g(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(k,"normalMap",
|
|
|
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(i.uniforms);j.tNormal.texture=k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map)j.tDiffuse.texture=k.map,j.enableDiffuse.value=!0;if(k.specularMap)j.tSpecular.texture=k.specularMap,j.enableSpecular.value=!0;if(k.lightMap)j.tAO.texture=
|
|
|
-k.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(void 0!==k.opacity)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:j,lights:!0,fog:!0})}else k=new THREE[i](k);if(void 0!==a.DbgName)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function g(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
|
|
|
+if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
|
|
|
+("Phong"==a.shading?i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)j.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)j.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)j.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
|
|
|
+THREE.VertexColors;if(a.colorDiffuse)j.color=f(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=f(a.colorSpecular);if(a.colorAmbient)j.ambient=f(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&g(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(j,"normalMap",
|
|
|
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var 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=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=
|
|
|
+j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(void 0!==a.DbgName)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),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var h=JSON.parse(f.responseText);a.loadAjaxBuffers(h,c,e,d,g)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+f.status+"]")};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){4==g.readyState?200==g.status||0==g.status?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+f+"] ["+g.status+"]"):3==g.readyState?e&&(0==h&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):2==g.readyState&&(h=g.getResponseHeader("Content-Length"))};
|
|
|
g.open("GET",f,!0);g.responseType="arraybuffer";g.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,j,q,l,n,r,m,o,p,s,t,v;function u(a){return a%4?4-a%4:0}function w(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function y(b,c){var d,e,f,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=G[2*e];e=G[2*e+1];i=G[2*f];k=G[2*f+1];f=G[2*g];j=G[2*g+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,k));m.push(new THREE.UV(f,
|
|
|
-j));g.push(m)}}function A(b,c){var d,e,f,g,h,i,k,j,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=G[2*e];e=G[2*e+1];k=G[2*f];l=G[2*f+1];j=G[2*g];m=G[2*g+1];g=G[2*h];f=G[2*h+1];h=C.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(k,l));q.push(new THREE.UV(j,m));q.push(new THREE.UV(g,f));h.push(q)}}function D(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
-C.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=k[d],C.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,k,j,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[3*e];g=c[3*e+1];h=c[3*e+2];k=d[3*e];j=d[3*e+1];l=d[3*e+2];i=m[e];var n=F[3*j],q=F[3*j+1];j=F[3*j+2];var p=F[3*l],o=
|
|
|
-F[3*l+1];l=F[3*l+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(F[3*k],F[3*k+1],F[3*k+2]),new THREE.Vector3(n,q,j),new THREE.Vector3(p,o,l)],null,i))}}function H(b,c,d,e){for(var f,g,h,i,k,j,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];j=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];k=q[e];var p=F[3*l],o=F[3*l+1];l=F[3*l+2];var r=F[3*m],s=F[3*m+1];m=F[3*m+2];var t=F[3*n],u=F[3*n+1];n=F[3*n+2];C.faces.push(new THREE.Face4(f,
|
|
|
-g,h,i,[new THREE.Vector3(F[3*j],F[3*j+1],F[3*j+2]),new THREE.Vector3(p,o,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,k))}}var C=this,x=0,F=[],G=[],L,K,E;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+=String.fromCharCode(a[b+e]);return d})(a,x,12);c=w(a,x+12);w(a,x+13);w(a,x+14);w(a,x+15);e=w(a,x+16);i=w(a,x+17);k=w(a,x+18);j=w(a,x+19);q=z(a,x+20);l=z(a,x+20+4);n=z(a,x+20+8);b=z(a,x+20+12);r=
|
|
|
-z(a,x+20+16);m=z(a,x+20+20);o=z(a,x+20+24);p=z(a,x+20+28);s=z(a,x+20+32);t=z(a,x+20+36);v=z(a,x+20+40);x+=c;c=3*e+j;E=4*e+j;L=b*c;K=r*(c+3*i);e=m*(c+3*k);j=o*(c+3*i+3*k);c=p*E;i=s*(E+4*i);k=t*(E+4*k);x+=function(b){var b=new Float32Array(a,b,3*q),c,d,e,f;for(c=0;c<q;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*q*Float32Array.BYTES_PER_ELEMENT}(x);x+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],
|
|
|
-f=b[3*c+2],F.push(d/127,e/127,f/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(x);x+=u(3*l);x+=function(b){if(n){var b=new Float32Array(a,b,2*n),c,d,e;for(c=0;c<n;c++)d=b[2*c],e=b[2*c+1],G.push(d,e)}return 2*n*Float32Array.BYTES_PER_ELEMENT}(x);L=x+L+u(2*b);K=L+K+u(2*r);e=K+e+u(2*m);j=e+j+u(2*o);c=j+c+u(2*p);i=c+i+u(2*s);k=i+k+u(2*t);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;D(m,a,b+3*m*Uint32Array.BYTES_PER_ELEMENT);y(m,b)}})(K);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
-c=b+3*o*Uint32Array.BYTES_PER_ELEMENT;J(o,a,b,c+3*o*Uint32Array.BYTES_PER_ELEMENT);y(o,c)}})(e);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;I(t,a,b+4*t*Uint32Array.BYTES_PER_ELEMENT);A(t,b)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;H(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);A(v,c)}})(k);b&&D(b,x,x+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,b+3*r*Uint32Array.BYTES_PER_ELEMENT)}})(L);
|
|
|
-p&&I(p,j,j+4*p*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;H(s,a,b,b+4*s*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,k,q,l,n,s,m,o,p,r,t,v;function u(a){return a%4?4-a%4:0}function w(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function y(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[3*d];f=l[3*d+1];g=l[3*d+2];h=G[2*e];e=G[2*e+1];i=G[2*f];j=G[2*f+1];f=G[2*g];k=G[2*g+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 A(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=G[2*e];e=G[2*e+1];j=G[2*f];l=G[2*f+1];k=G[2*g];m=G[2*g+1];g=G[2*h];f=G[2*h+1];h=C.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,l));q.push(new THREE.UV(k,m));q.push(new THREE.UV(g,f));h.push(q)}}function D(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
+C.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],C.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,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[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=F[3*k],q=F[3*k+1];k=F[3*k+2];var p=F[3*l],o=
|
|
|
+F[3*l+1];l=F[3*l+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(F[3*j],F[3*j+1],F[3*j+2]),new THREE.Vector3(n,q,k),new THREE.Vector3(p,o,l)],null,i))}}function H(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=q[e];var p=F[3*l],o=F[3*l+1];l=F[3*l+2];var s=F[3*m],r=F[3*m+1];m=F[3*m+2];var t=F[3*n],u=F[3*n+1];n=F[3*n+2];C.faces.push(new THREE.Face4(f,
|
|
|
+g,h,i,[new THREE.Vector3(F[3*k],F[3*k+1],F[3*k+2]),new THREE.Vector3(p,o,l),new THREE.Vector3(s,r,m),new THREE.Vector3(t,u,n)],null,j))}}var C=this,x=0,F=[],G=[],L,K,E;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+=String.fromCharCode(a[b+e]);return d})(a,x,12);c=w(a,x+12);w(a,x+13);w(a,x+14);w(a,x+15);e=w(a,x+16);i=w(a,x+17);j=w(a,x+18);k=w(a,x+19);q=z(a,x+20);l=z(a,x+20+4);n=z(a,x+20+8);b=z(a,x+20+12);s=
|
|
|
+z(a,x+20+16);m=z(a,x+20+20);o=z(a,x+20+24);p=z(a,x+20+28);r=z(a,x+20+32);t=z(a,x+20+36);v=z(a,x+20+40);x+=c;c=3*e+k;E=4*e+k;L=b*c;K=s*(c+3*i);e=m*(c+3*j);k=o*(c+3*i+3*j);c=p*E;i=r*(E+4*i);j=t*(E+4*j);x+=function(b){var b=new Float32Array(a,b,3*q),c,d,e,f;for(c=0;c<q;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*q*Float32Array.BYTES_PER_ELEMENT}(x);x+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],
|
|
|
+f=b[3*c+2],F.push(d/127,e/127,f/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(x);x+=u(3*l);x+=function(b){if(n){var b=new Float32Array(a,b,2*n),c,d,e;for(c=0;c<n;c++)d=b[2*c],e=b[2*c+1],G.push(d,e)}return 2*n*Float32Array.BYTES_PER_ELEMENT}(x);L=x+L+u(2*b);K=L+K+u(2*s);e=K+e+u(2*m);k=e+k+u(2*o);c=k+c+u(2*p);i=c+i+u(2*r);j=i+j+u(2*t);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;D(m,a,b+3*m*Uint32Array.BYTES_PER_ELEMENT);y(m,b)}})(K);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
+c=b+3*o*Uint32Array.BYTES_PER_ELEMENT;J(o,a,b,c+3*o*Uint32Array.BYTES_PER_ELEMENT);y(o,c)}})(e);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;I(t,a,b+4*t*Uint32Array.BYTES_PER_ELEMENT);A(t,b)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;H(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);A(v,c)}})(j);b&&D(b,x,x+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT;J(s,a,b,b+3*s*Uint32Array.BYTES_PER_ELEMENT)}})(L);
|
|
|
+p&&I(p,k,k+4*p*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(r){var b=a+4*r*Uint32Array.BYTES_PER_ELEMENT;H(r,a,b,b+4*r*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||la;void 0!==e&&(a=e.split("/"),a.pop(),ma=(1>a.length?".":a.join("/"))+"/");if((a=P.evaluate("//dae:asset",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":$=i.textContent.charAt(0)}}if(!Q.convertUpAxis||$===Q.upAxis)U=null;else switch($){case "X":U="Y"===Q.upAxis?
|
|
|
"XtoY":"XtoZ";break;case "Y":U="X"===Q.upAxis?"YtoX":"YtoZ";break;case "Z":U="X"===Q.upAxis?"ZtoX":"ZtoY"}ea=b("//dae:library_images/dae:image",f,"image");fa=b("//dae:library_materials/dae:material",y,"material");ga=b("//dae:library_effects/dae:effect",H,"effect");T=b("//dae:library_geometries/dae:geometry",o,"geometry");ha=b(".//dae:library_cameras/dae:camera",K,"camera");S=b("//dae:library_controllers/dae:controller",h,"controller");V=b("//dae:library_animations/dae:animation",x,"animation");ia=
|
|
|
-b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");aa=[];ba=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),R=ia[0<a.length?a:"visual_scene0"]):R=null;Z=new THREE.Object3D;for(a=0;a<R.nodes.length;a++)Z.add(g(R.nodes[a]));ja=[];c(Z);a={scene:Z,morphs:aa,skins:ba,animations:ja,dae:{images:ea,materials:fa,cameras:ha,effects:ga,geometries:T,controllers:S,animations:V,visualScenes:ia,
|
|
|
+b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");aa=[];ba=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),R=ia[0<a.length?a:"visual_scene0"]):R=null;Z=new THREE.Object3D;for(a=0;a<R.nodes.length;a++)Z.add(g(R.nodes[a]));ja=[];c(Z);a={scene:Z,morphs:aa,skins:ba,animations:ja,dae:{images:ea,materials:fa,cameras:ha,effects:ga,geometries:T,controllers:S,animations:V,visualScenes:ia,
|
|
|
scene:R}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=R.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ja.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
|
|
|
{hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,f=S[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 V)for(var i=V[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=R.getChildById(b.skeleton[0],!0)||R.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,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++)if(l=j[m],n=-1,"JOINT"==l.type){for(var q=0;q<k.joints.length;q++)if(l.sid==k.joints[q]){n=q;break}if(0<=n){q=k.invBindMatrices[n];l.invBindMatrix=q;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,q);l.weights=[];for(q=0;q<k.weights.length;q++)for(var p=0;p<k.weights[q].length;p++){var o=k.weights[q][p];o.joint==n&&l.weights.push(o)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=S[a.controllers[f].url];switch(i.type){case "skin":if(T[i.skin.source]){var j=
|
|
|
new m;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(S[i.skin.source]&&(d=i=S[i.skin.source],i.morph&&T[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(T[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=T[i.url],k={},l=[],q=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var o=fa[p.target],r=ga[o.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=q;l.push(r.material);p=r.material;p.name=null==o.name||""===o.name?o.id:o.name;q++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
|
|
|
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=T[i.url],k={},l=[],q=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var o=fa[p.target],s=ga[o.instance_effect.url].shader;s.material.opacity=!s.material.opacity?1:s.material.opacity;k[p.symbol]=q;l.push(s.material);p=s.material;p.name=null==o.name||""===o.name?o.id:o.name;q++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
|
|
|
if(1<q){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(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=S[c.url],j.skinInstanceController=c,j.name="skin_"+ba.length,ba.push(j);else if(void 0!==d){h=i;k=d instanceof n?S[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(q=T[k.targets[l]],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=!0;j=new THREE.Mesh(i,j);j.name="morph_"+aa.length;aa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(f=0;f<a.cameras.length;f++)b=ha[a.cameras[f].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
|
|
|
-f=a.matrix.decompose();b.position=f[0];b.quaternion=f[1];b.useQuaternion=!0;b.scale=f[2];Q.centerGeometry&&b.geometry&&(f=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(f.multiplySelf(b.scale)),b.position.subSelf(f));for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source=
|
|
|
-"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function 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 o(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function y(){this.name=
|
|
|
+f=a.matrix.decompose();b.position=f[0];b.quaternion=f[1];b.useQuaternion=!0;b.scale=f[2];Q.centerGeometry&&b.geometry&&(f=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(f.multiplySelf(b.scale)),b.position.subSelf(f));for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function 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 s(){this.target=this.symbol=""}function m(){this.url=
|
|
|
+"";this.instance_material=[]}function o(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function y(){this.name=
|
|
|
this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function D(a,b){this.type=a;this.effect=b;this.material=null}function 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 H(){this.name=this.id="";this.sampler=this.surface=this.shader=
|
|
|
null}function C(){this.url=""}function x(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function L(a){this.targets=[];this.time=a}function K(){this.name=this.id=""}function E(){this.url=
|
|
|
""}function B(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function M(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function N(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function Y(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(Q.convertUpAxis&&$!==Q.upAxis)switch(U){case "XtoY":var c=
|
|
|
a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ca(a,b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function da(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=
|
|
|
b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,Z=null,R,la=null,X={},ea={},V={},S={},T={},fa={},ga={},ha={},ja,ia,ma,aa,ba,na=THREE.SmoothShading,
|
|
|
-Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",U=null,ka=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);
|
|
|
+Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",U=null,ka=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new 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(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],
|
|
|
-a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
|
|
|
-if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=M(f.textContent);this.bindShapeMatrix=da(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==
|
|
|
-d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(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],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=
|
|
|
-n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
+a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};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(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=M(f.textContent);this.bindShapeMatrix=da(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==
|
|
|
+d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(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],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=
|
|
|
+n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);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.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new 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=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
|
|
|
""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};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="JOINT"==this.type?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++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));
|
|
|
break;case "instance_camera":this.cameras.push((new E).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=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,B,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 V)for(var e=V[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g=
|
|
|
-"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var p=i[b],o=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===p)r=u;else if(u.time>p)break}if(!r){r=
|
|
|
-new L(p);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=p&&(s=t);p=s;d.splice(-1==p?d.length:p,0,r)}r.addTarget(f,j,g,o)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
|
|
|
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var p=i[b],o=h.getData(j.type,b),s;s=null;for(var r=0,t=d.length;r<t&&null==s;r++){var u=d[r];if(u.time===p)s=u;else if(u.time>p)break}if(!s){s=
|
|
|
+new L(p);r=-1;t=0;for(u=d.length;t<u&&-1==r;t++)d[t].time>=p&&(r=t);p=r;d.splice(-1==p?d.length:p,0,s)}s.addTarget(f,j,g,o)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
|
|
|
i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;o=void 0;if(k.length){o=[];for(p=0;p<k.length;++p)o[p]=k[p]+(j[p]-k[p])*h}else o=k+(j-k)*h;f.addTarget(g,i.transform,i.member,o)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.convert();
|
|
|
return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=da(this.data);break;case "rotate":this.angle=this.data[3]*ka;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
|
|
|
break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};l.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
|
|
|
a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ka;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ka}}};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",
|
|
|
-c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
-P.evaluate(".//dae:instance_material",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==X[d]&&(X[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new u).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=X[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ca(a,
|
|
|
+c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
+P.evaluate(".//dae:instance_material",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==X[d]&&(X[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new u).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(c))}}this.geometry3js=new THREE.Geometry;a=X[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ca(a,
|
|
|
b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};p.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,q=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+
|
|
|
-1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":q.push(h.set)}}for(;c<f.length;){var o=[],r=[],p={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=X[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":r.push(ca(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
|
|
|
-1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=X[h.source];j=k.accessor.params.length;h=0;for(i=o.length;h<i;h++)r.push(ca(k.data,o[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(o[0],o[1],o[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],r,s.length?s:new THREE.Color));else if(4<m&&Q.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=
|
|
|
-0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<q.length;e++)o=p[q[e]],o=4<m?[o[0],o[h+1],o[h+2]]:4===m?[o[0],o[1],o[2],o[3]]:[o[0],o[1],o[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(o)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
|
|
|
+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":q.push(h.set)}}for(;c<f.length;){var o=[],s=[],p={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=X[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":s.push(ca(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+
|
|
|
+1],k.data[j+2]))}e=null;d=[];if(0==s.length)if(h=this.vertices.input.NORMAL){k=X[h.source];j=k.accessor.params.length;h=0;for(i=o.length;h<i;h++)s.push(ca(k.data,o[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(o[0],o[1],o[2],s,r.length?r:new THREE.Color));else if(4===m)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],s,r.length?r:new THREE.Color));else if(4<m&&Q.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[s[0],s[e++],s[e]],r))}if(d.length){h=
|
|
|
+0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<q.length;e++)o=p[q[e]],o=4<m?[o[0],o[h+1],o[h+2]]:4===m?[o[0],o[1],o[2],o[3]]:[o[0],o[1],o[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(o)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};r.prototype=new t;r.prototype.constructor=r;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
|
|
|
a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new w).parse(a.childNodes[b]));break;case "vcount":this.vcount=N(c.textContent);break;case "p":this.p=N(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=
|
|
|
W(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
"");this.set=W(a,"set",-1);this.offset=W(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=Y(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
@@ -330,46 +332,46 @@ d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else
|
|
|
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,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(200===g.status||0===g.status){if(g.responseText){var h=JSON.parse(g.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+"] ["+g.status+"]");else g.readyState===g.LOADING?e&&(0===f&&(f=g.getResponseHeader("Content-Length")),
|
|
|
e({total:f,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,k,j,q,l,n,r,m,o,p,s,t,v=a.faces;q=a.vertices;var u=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<j;)l=new THREE.Vertex,l.position.x=q[k++]*b,l.position.y=q[k++]*b,l.position.z=q[k++]*b,d.vertices.push(l);k=0;for(j=v.length;k<j;){b=
|
|
|
-v[k++];q=b&1;i=b&2;c=b&4;e=b&8;n=b&16;l=b&32;m=b&64;b&=128;q?(o=new THREE.Face4,o.a=v[k++],o.b=v[k++],o.c=v[k++],o.d=v[k++],q=4):(o=new THREE.Face3,o.a=v[k++],o.b=v[k++],o.c=v[k++],q=3);if(i)i=v[k++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)p=a.uvs[c],r=v[k++],t=p[2*r],r=p[2*r+1],d.faceUvs[c][i]=new THREE.UV(t,r);if(e)for(c=0;c<z;c++){p=a.uvs[c];s=[];for(e=0;e<q;e++)r=v[k++],t=p[2*r],r=p[2*r+1],s[e]=new THREE.UV(t,r);d.faceVertexUvs[c][i]=s}if(n)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],
|
|
|
-e.y=u[n++],e.z=u[n],o.normal=e;if(l)for(c=0;c<q;c++)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],o.vertexNormals.push(e);if(m)l=v[k++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<q;c++)l=v[k++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
|
|
|
-c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,k,j,q,l,n,r;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;for(i=0,k=r.length;i<k;i+=3)j=r[i]*b,q=r[i+1]*b,l=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,q,
|
|
|
-l)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;for(b=0,i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,k,q,l,n,s,m,o,p,r,t,v=a.faces;q=a.vertices;var u=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];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=v.length;j<k;){b=
|
|
|
+v[j++];q=b&1;i=b&2;c=b&4;e=b&8;n=b&16;l=b&32;m=b&64;b&=128;q?(o=new THREE.Face4,o.a=v[j++],o.b=v[j++],o.c=v[j++],o.d=v[j++],q=4):(o=new THREE.Face3,o.a=v[j++],o.b=v[j++],o.c=v[j++],q=3);if(i)i=v[j++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)p=a.uvs[c],s=v[j++],t=p[2*s],s=p[2*s+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(e)for(c=0;c<z;c++){p=a.uvs[c];r=[];for(e=0;e<q;e++)s=v[j++],t=p[2*s],s=p[2*s+1],r[e]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(n)n=3*v[j++],e=new THREE.Vector3,e.x=u[n++],
|
|
|
+e.y=u[n++],e.z=u[n],o.normal=e;if(l)for(c=0;c<q;c++)n=3*v[j++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],o.vertexNormals.push(e);if(m)l=v[j++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<q;c++)l=v[j++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
|
|
|
+c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,j,k,q,l,n,s;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;s=a.morphTargets[c].vertices;for(i=0,j=s.length;i<j;i+=3)k=s[i]*b,q=s[i+1]*b,l=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,q,
|
|
|
+l)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(k[b],k[b+1],k[b+2]),j.push(q)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);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"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(l in C.objects)if(!E.objects[l])if(p=C.objects[l],void 0!==p.geometry){if(D=E.geometries[p.geometry]){a=!1;I=E.materials[p.materials[0]];(a=I instanceof THREE.ShaderMaterial)&&D.computeTangents();v=p.position;u=p.rotation;w=p.quaternion;z=p.scale;w=0;0==p.materials.length&&(I=new THREE.MeshFaceMaterial);1<p.materials.length&&(I=new THREE.MeshFaceMaterial);a=new THREE.Mesh(D,
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(l in C.objects)if(!E.objects[l])if(p=C.objects[l],void 0!==p.geometry){if(D=E.geometries[p.geometry]){a=!1;I=E.materials[p.materials[0]];(a=I instanceof THREE.ShaderMaterial)&&D.computeTangents();v=p.position;u=p.rotation;w=p.quaternion;z=p.scale;w=0;0==p.materials.length&&(I=new THREE.MeshFaceMaterial);1<p.materials.length&&(I=new THREE.MeshFaceMaterial);a=new THREE.Mesh(D,
|
|
|
I);a.name=l;a.position.set(v[0],v[1],v[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]);a.scale.set(z[0],z[1],z[2]);a.visible=p.visible;E.scene.add(a);E.objects[l]=a;if(p.castsShadow){var b=new THREE.ShadowVolume(D);E.scene.add(b);b.position=a.position;b.rotation=a.rotation;b.scale=a.scale}p.trigger&&"none"!=p.trigger.toLowerCase()&&(b={type:p.trigger,object:p},E.triggers[a.name]=b)}}else v=p.position,u=p.rotation,w=p.quaternion,z=p.scale,w=0,a=new THREE.Object3D,
|
|
|
a.name=l,a.position.set(v[0],v[1],v[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==p.visible?p.visible:!1,E.scene.add(a),E.objects[l]=a,E.empties[l]=a,p.trigger&&"none"!=p.trigger.toLowerCase()&&(b={type:p.trigger,object:p},E.triggers[a.name]=b)}function g(a){return function(b){E.geometries[a]=b;e();F-=1;i.onLoadComplete();h()}}function f(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,
|
|
|
-totalTextures:K,loadedModels:L-F,loadedTextures:K-G},E);i.onLoadProgress();0==F&&0==G&&b(E)}var i=this,k=THREE.Loader.prototype.extractUrlBase(c),j,q,l,n,r,m,o,p,s,t,v,u,w,z,y,A,D,I,J,H,C,x,F,G,L,K,E;C=a;c=new THREE.BinaryLoader;x=new THREE.JSONLoader;G=F=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};if(C.transform)a=C.transform.position,s=C.transform.rotation,y=C.transform.scale,a&&E.scene.position.set(a[0],a[1],
|
|
|
-a[2]),s&&E.scene.rotation.set(s[0],s[1],s[2]),y&&E.scene.scale.set(y[0],y[1],y[2]),(a||s||y)&&E.scene.updateMatrix();a=function(){G-=1;h();i.onLoadComplete()};for(r in C.cameras)y=C.cameras[r],"perspective"==y.type?J=new THREE.PerspectiveCamera(y.fov,y.aspect,y.near,y.far):"ortho"==y.type&&(J=new THREE.OrthographicCamera(y.left,y.right,y.top,y.bottom,y.near,y.far)),v=y.position,s=y.target,y=y.up,J.position.set(v[0],v[1],v[2]),J.target=new THREE.Vector3(s[0],s[1],s[2]),y&&J.up.set(y[0],y[1],y[2]),
|
|
|
-E.cameras[r]=J;for(n in C.lights)s=C.lights[n],r=void 0!==s.color?s.color:16777215,J=void 0!==s.intensity?s.intensity:1,"directional"==s.type?(v=s.direction,t=new THREE.DirectionalLight(r,J),t.position.set(v[0],v[1],v[2]),t.position.normalize()):"point"==s.type?(v=s.position,t=s.distance,t=new THREE.PointLight(r,J,t),t.position.set(v[0],v[1],v[2])):"ambient"==s.type&&(t=new THREE.AmbientLight(r)),E.scene.add(t),E.lights[n]=t;for(m in C.fogs)n=C.fogs[m],"linear"==n.type?H=new THREE.Fog(0,n.near,n.far):
|
|
|
-"exp2"==n.type&&(H=new THREE.FogExp2(0,n.density)),y=n.color,H.color.setRGB(y[0],y[1],y[2]),E.fogs[m]=H;if(E.cameras&&C.defaults.camera)E.currentCamera=E.cameras[C.defaults.camera];if(E.fogs&&C.defaults.fog)E.scene.fog=E.fogs[C.defaults.fog];y=C.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(y[0],y[1],y[2]);E.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries)if(m=C.geometries[j],"bin_mesh"==m.type||"ascii_mesh"==m.type)F+=1,i.onLoadStart();L=F;for(j in C.geometries)if(m=C.geometries[j],
|
|
|
-"cube"==m.type)D=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),E.geometries[j]=D;else if("plane"==m.type)D=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),E.geometries[j]=D;else if("sphere"==m.type)D=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),E.geometries[j]=D;else if("cylinder"==m.type)D=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),E.geometries[j]=
|
|
|
-D;else if("torus"==m.type)D=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),E.geometries[j]=D;else if("icosahedron"==m.type)D=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),E.geometries[j]=D;else if("bin_mesh"==m.type)c.load(d(m.url,C.urlBaseType),g(j));else if("ascii_mesh"==m.type)x.load(d(m.url,C.urlBaseType),g(j));else if("embedded_mesh"==m.type)m=C.embeds[m.id],m.metadata=C.metadata,m&&x.createModel(m,f(j),"");for(o in C.textures)if(j=C.textures[o],j.url instanceof Array){G+=
|
|
|
-j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();K=G;for(o in C.textures){j=C.textures[o];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(H=0;H<j.url.length;H++)m[H]=d(j.url[H],C.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,C.urlBaseType),j.mapping,a);if(void 0!=THREE[j.minFilter])m.minFilter=THREE[j.minFilter];if(void 0!=THREE[j.magFilter])m.magFilter=
|
|
|
-THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(1!=j.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=j.repeat[1])m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){H={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==H[j.wrap[0]])m.wrapS=H[j.wrap[0]];if(void 0!==H[j.wrap[1]])m.wrapT=H[j.wrap[1]]}}E.textures[o]=m}for(q in C.materials){o=C.materials[q];for(A in o.parameters)if("envMap"==A||"map"==A||"lightMap"==A)o.parameters[A]=
|
|
|
+totalTextures:K,loadedModels:L-F,loadedTextures:K-G},E);i.onLoadProgress();0==F&&0==G&&b(E)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,q,l,n,s,m,o,p,r,t,v,u,w,z,y,A,D,I,J,H,C,x,F,G,L,K,E;C=a;c=new THREE.BinaryLoader;x=new THREE.JSONLoader;G=F=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};if(C.transform)a=C.transform.position,r=C.transform.rotation,y=C.transform.scale,a&&E.scene.position.set(a[0],a[1],
|
|
|
+a[2]),r&&E.scene.rotation.set(r[0],r[1],r[2]),y&&E.scene.scale.set(y[0],y[1],y[2]),(a||r||y)&&E.scene.updateMatrix();a=function(){G-=1;h();i.onLoadComplete()};for(s in C.cameras)y=C.cameras[s],"perspective"==y.type?J=new THREE.PerspectiveCamera(y.fov,y.aspect,y.near,y.far):"ortho"==y.type&&(J=new THREE.OrthographicCamera(y.left,y.right,y.top,y.bottom,y.near,y.far)),v=y.position,r=y.target,y=y.up,J.position.set(v[0],v[1],v[2]),J.target=new THREE.Vector3(r[0],r[1],r[2]),y&&J.up.set(y[0],y[1],y[2]),
|
|
|
+E.cameras[s]=J;for(n in C.lights)r=C.lights[n],s=void 0!==r.color?r.color:16777215,J=void 0!==r.intensity?r.intensity:1,"directional"==r.type?(v=r.direction,t=new THREE.DirectionalLight(s,J),t.position.set(v[0],v[1],v[2]),t.position.normalize()):"point"==r.type?(v=r.position,t=r.distance,t=new THREE.PointLight(s,J,t),t.position.set(v[0],v[1],v[2])):"ambient"==r.type&&(t=new THREE.AmbientLight(s)),E.scene.add(t),E.lights[n]=t;for(m in C.fogs)n=C.fogs[m],"linear"==n.type?H=new THREE.Fog(0,n.near,n.far):
|
|
|
+"exp2"==n.type&&(H=new THREE.FogExp2(0,n.density)),y=n.color,H.color.setRGB(y[0],y[1],y[2]),E.fogs[m]=H;if(E.cameras&&C.defaults.camera)E.currentCamera=E.cameras[C.defaults.camera];if(E.fogs&&C.defaults.fog)E.scene.fog=E.fogs[C.defaults.fog];y=C.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(y[0],y[1],y[2]);E.bgColorAlpha=C.defaults.bgalpha;for(k in C.geometries)if(m=C.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)F+=1,i.onLoadStart();L=F;for(k in C.geometries)if(m=C.geometries[k],
|
|
|
+"cube"==m.type)D=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),E.geometries[k]=D;else if("plane"==m.type)D=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=D;else if("sphere"==m.type)D=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=D;else if("cylinder"==m.type)D=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),E.geometries[k]=
|
|
|
+D;else if("torus"==m.type)D=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),E.geometries[k]=D;else if("icosahedron"==m.type)D=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),E.geometries[k]=D;else if("bin_mesh"==m.type)c.load(d(m.url,C.urlBaseType),g(k));else if("ascii_mesh"==m.type)x.load(d(m.url,C.urlBaseType),g(k));else if("embedded_mesh"==m.type)m=C.embeds[m.id],m.metadata=C.metadata,m&&x.createModel(m,f(k),"");for(o in C.textures)if(k=C.textures[o],k.url instanceof Array){G+=
|
|
|
+k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();K=G;for(o in C.textures){k=C.textures[o];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(H=0;H<k.url.length;H++)m[H]=d(k.url[H],C.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,C.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=
|
|
|
+THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){H={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==H[k.wrap[0]])m.wrapS=H[k.wrap[0]];if(void 0!==H[k.wrap[1]])m.wrapT=H[k.wrap[1]]}}E.textures[o]=m}for(q in C.materials){o=C.materials[q];for(A in o.parameters)if("envMap"==A||"map"==A||"lightMap"==A)o.parameters[A]=
|
|
|
E.textures[o.parameters[A]];else if("shading"==A)o.parameters[A]="flat"==o.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)o.parameters[A]=THREE[o.parameters[A]]?THREE[o.parameters[A]]:THREE.NormalBlending;else if("combine"==A)o.parameters[A]="MixOperation"==o.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==A)if("face"==o.parameters[A])o.parameters[A]=THREE.FaceColors;else if(o.parameters[A])o.parameters[A]=THREE.VertexColors;if(void 0!==
|
|
|
-o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(a.uniforms);m=o.parameters.color;H=o.parameters.specular;c=o.parameters.ambient;x=o.parameters.shininess;j.tNormal.texture=E.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)j.uNormalScale.value=o.parameters.normalMapFactor;if(o.parameters.map)j.tDiffuse.texture=o.parameters.map,j.enableDiffuse.value=!0;if(o.parameters.lightMap)j.tAO.texture=
|
|
|
-o.parameters.lightMap,j.enableAO.value=!0;if(o.parameters.specularMap)j.tSpecular.texture=E.textures[o.parameters.specularMap],j.enableSpecular.value=!0;j.uDiffuseColor.value.setHex(m);j.uSpecularColor.value.setHex(H);j.uAmbientColor.value.setHex(c);j.uShininess.value=x;if(o.parameters.opacity)j.uOpacity.value=o.parameters.opacity;I=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:j,lights:!0,fog:!0})}else I=new THREE[o.type](o.parameters);E.materials[q]=
|
|
|
+o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);m=o.parameters.color;H=o.parameters.specular;c=o.parameters.ambient;x=o.parameters.shininess;k.tNormal.texture=E.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)k.uNormalScale.value=o.parameters.normalMapFactor;if(o.parameters.map)k.tDiffuse.texture=o.parameters.map,k.enableDiffuse.value=!0;if(o.parameters.lightMap)k.tAO.texture=
|
|
|
+o.parameters.lightMap,k.enableAO.value=!0;if(o.parameters.specularMap)k.tSpecular.texture=E.textures[o.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(H);k.uAmbientColor.value.setHex(c);k.uShininess.value=x;if(o.parameters.opacity)k.uOpacity.value=o.parameters.opacity;I=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else I=new THREE[o.type](o.parameters);E.materials[q]=
|
|
|
I}e();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,g=void 0!==c.offsetX?c.offsetX:0,f=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,g,f,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
|
|
|
!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d),g=g+(h>>1^-(h&1));c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,0==h&&f++;return[c,g]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,o,p=a.length;i<p;i+=f)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=e,o+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,s,t,v,u=a.length;for(c=0;c<u;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;v=e;i=f;var w=k[3*e],z=k[3*e+1],y=k[3*e+2],A=k[3*f],D=k[3*f+1],I=k[3*f+2];s=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);w=new THREE.Vector3(w,z,y);A=new THREE.Vector3(A,D,I);g.faces.push(new THREE.Face3(t,v,i,[s,w,A],null,0));g=j[2*d];d=j[2*d+1];i=j[2*e];s=j[2*e+1];t=j[2*
|
|
|
-f];v=j[2*f+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,v));f.push(s)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,i){for(var j,k,o,p=a.length;i<p;i+=f)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=e,o+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,r,t,v,u=a.length;for(c=0;c<u;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;v=e;i=f;var w=j[3*e],z=j[3*e+1],y=j[3*e+2],A=j[3*f],D=j[3*f+1],I=j[3*f+2];r=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);w=new THREE.Vector3(w,z,y);A=new THREE.Vector3(A,D,I);g.faces.push(new THREE.Face3(t,v,i,[r,w,A],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];r=k[2*e+1];t=k[2*
|
|
|
+f];v=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,v));f.push(r)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
|
-this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+3*this.yd;
|
|
|
-e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+3*this.zd;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,q=i+this.yd,l=i+this.zd,n=g+this.yd+this.zd,r=i+this.yd+this.zd,m=0,o=this.field[g],p=this.field[i],s=this.field[k],t=this.field[q],v=this.field[j],u=this.field[l],w=this.field[n],z=this.field[r];o<f&&(m|=1);p<f&&(m|=2);s<f&&(m|=8);t<f&&(m|=4);v<f&&(m|=16);u<f&&(m|=32);w<f&&(m|=128);z<f&&(m|=64);var y=THREE.edgeTable[m];if(0===y)return 0;var A=this.delta,D=a+
|
|
|
-A,I=b+A,A=e+A;y&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,o,p));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(3*i,this.vlist,this.nlist,3,f,D,b,e,p,t));y&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(3*k,this.vlist,this.nlist,6,f,a,I,e,s,t));y&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,o,s));y&16&&(this.compNorm(j),this.compNorm(l),this.VIntX(3*j,this.vlist,this.nlist,12,f,a,b,A,v,u));y&32&&(this.compNorm(l),
|
|
|
-this.compNorm(r),this.VIntY(3*l,this.vlist,this.nlist,15,f,D,b,A,u,z));y&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(3*n,this.vlist,this.nlist,18,f,a,I,A,w,z));y&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(3*j,this.vlist,this.nlist,21,f,a,b,A,v,w));y&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,o,v));y&512&&(this.compNorm(i),this.compNorm(l),this.VIntZ(3*i,this.vlist,this.nlist,27,f,D,b,e,p,u));y&1024&&(this.compNorm(q),this.compNorm(r),this.VIntZ(3*
|
|
|
-q,this.vlist,this.nlist,30,f,D,I,e,t,z));y&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(3*k,this.vlist,this.nlist,33,f,a,I,e,s,w));m<<=4;for(f=g=0;-1!=THREE.triTable[m+f];)a=m+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
+this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,j,k,q){f=(f-k)/(q-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,j,k,q){f=(f-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=j;b=a+3*this.yd;
|
|
|
+e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,j,k,q){f=(f-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+f*this.delta;b=a+3*this.zd;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,q=i+this.yd,l=i+this.zd,n=g+this.yd+this.zd,s=i+this.yd+this.zd,m=0,o=this.field[g],p=this.field[i],r=this.field[j],t=this.field[q],v=this.field[k],u=this.field[l],w=this.field[n],z=this.field[s];o<f&&(m|=1);p<f&&(m|=2);r<f&&(m|=8);t<f&&(m|=4);v<f&&(m|=16);u<f&&(m|=32);w<f&&(m|=128);z<f&&(m|=64);var y=THREE.edgeTable[m];if(0===y)return 0;var A=this.delta,D=a+
|
|
|
+A,I=b+A,A=e+A;y&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,o,p));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(3*i,this.vlist,this.nlist,3,f,D,b,e,p,t));y&4&&(this.compNorm(j),this.compNorm(q),this.VIntX(3*j,this.vlist,this.nlist,6,f,a,I,e,r,t));y&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,o,r));y&16&&(this.compNorm(k),this.compNorm(l),this.VIntX(3*k,this.vlist,this.nlist,12,f,a,b,A,v,u));y&32&&(this.compNorm(l),
|
|
|
+this.compNorm(s),this.VIntY(3*l,this.vlist,this.nlist,15,f,D,b,A,u,z));y&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(3*n,this.vlist,this.nlist,18,f,a,I,A,w,z));y&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,21,f,a,b,A,v,w));y&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,o,v));y&512&&(this.compNorm(i),this.compNorm(l),this.VIntZ(3*i,this.vlist,this.nlist,27,f,D,b,e,p,u));y&1024&&(this.compNorm(q),this.compNorm(s),this.VIntZ(3*
|
|
|
+q,this.vlist,this.nlist,30,f,D,I,e,t,z));y&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(3*j,this.vlist,this.nlist,33,f,a,I,e,r,w));m<<=4;for(f=g=0;-1!=THREE.triTable[m+f];)a=m+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,q=Math.floor(i-h);1>q&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var l=Math.floor(k-h);1>l&&(l=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);1>n&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
-1);for(var r,m,o,p,s,t,v,j=q;j<i;j++){o=this.size2*j;s=j/this.size-e;t=s*s;for(q=l;q<k;q++){m=o+this.size*q;r=q/this.size-b;v=r*r;for(r=n;r<h;r++)p=r/this.size-a,p=g/(1.0E-6+p*p+v+t)-f,0<p&&(this.field[m+r]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,q=this.zd,l=this.field,n=k*Math.sqrt(a/b);n>k&&(n=k);for(e=0;e<n;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)l[q*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,
|
|
|
-l=this.zd,n=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(g=0;g<r;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=g*q;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)n[l*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,l=this.zd,n=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(f=0;f<r;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=l*f;for(g=0;g<j;g++){k=i+g*q;for(e=0;e<j;e++)n[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
-function(a){this.begin();var b,e,g,f,h,i,k,j,q,l=this.size-2;for(f=1;f<l;f++){q=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<l;g++){j=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<l;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,q,l,n;for(f=0;f<g.count;f++)l=3*f,j=l+1,n=l+2,h=g.positionArray[l],i=g.positionArray[j],k=
|
|
|
-g.positionArray[n],q=new THREE.Vector3(h,i,k),h=g.normalArray[l],i=g.normalArray[j],k=g.normalArray[n],l=new THREE.Vector3(h,i,k),l.normalize(),j=new THREE.Vertex(q),b.vertices.push(j),e.push(l);q=g.count/3;for(f=0;f<q;f++)l=3*(a+f),j=l+1,n=l+2,h=e[l],i=e[j],k=e[n],l=new THREE.Face3(l,j,n,[h,i,k]),b.faces.push(l);a+=q;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,j=b*this.size,k=a*this.size,q=Math.floor(i-h);1>q&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var l=Math.floor(j-h);1>l&&(l=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);1>n&&(n=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
|
|
|
+1);for(var s,m,o,p,r,t,v,k=q;k<i;k++){o=this.size2*k;r=k/this.size-e;t=r*r;for(q=l;q<j;q++){m=o+this.size*q;s=q/this.size-b;v=s*s;for(s=n;s<h;s++)p=s/this.size-a,p=g/(1.0E-6+p*p+v+t)-f,0<p&&(this.field[m+s]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,j=this.size,k=this.yd,q=this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(e=0;e<n;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<j;g++){i=e+g*k;for(f=0;f<j;f++)l[q*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,j,k=this.size,q=this.yd,
|
|
|
+l=this.zd,n=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(g=0;g<s;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=g*q;for(e=0;e<k;e++){j=i+e;for(f=0;f<k;f++)n[l*f+j]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,j,k=this.size,q=this.yd,l=this.zd,n=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(f=0;f<s;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=l*f;for(g=0;g<k;g++){j=i+g*q;for(e=0;e<k;e++)n[j+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
+function(a){this.begin();var b,e,g,f,h,i,j,k,q,l=this.size-2;for(f=1;f<l;f++){q=this.size2*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<l;g++){k=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<l;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,j,k,q,l,n;for(f=0;f<g.count;f++)l=3*f,k=l+1,n=l+2,h=g.positionArray[l],i=g.positionArray[k],j=
|
|
|
+g.positionArray[n],q=new THREE.Vector3(h,i,j),h=g.normalArray[l],i=g.normalArray[k],j=g.normalArray[n],l=new THREE.Vector3(h,i,j),l.normalize(),k=new THREE.Vertex(q),b.vertices.push(k),e.push(l);q=g.count/3;for(f=0;f<q;f++)l=3*(a+f),k=l+1,n=l+2,h=e[l],i=e[k],j=e[n],l=new THREE.Face3(l,k,n,[h,i,j]),b.faces.push(l);a+=q;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -404,43 +406,43 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
|
|
|
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];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
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 e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var g=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),f=d.weight;
|
|
|
if(g!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*f,this.morphTargetInfluences[g]=0,d.lastFrame=d.currentFrame,d.currentFrame=g;e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*f;this.morphTargetInfluences[d.lastFrame]=(1-e)*f}}};
|
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,f,h,i,k,j,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=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;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,f,h,i,j,k,q,l,n;this.init=function(s){b=s.context;c=s;d=new Float32Array(16);e=new Uint16Array(6);s=0;d[s++]=-1;d[s++]=-1;d[s++]=0;d[s++]=0;d[s++]=1;d[s++]=-1;d[s++]=1;d[s++]=
|
|
|
+0;d[s++]=1;d[s++]=1;d[s++]=1;d[s++]=1;d[s++]=-1;d[s++]=1;d[s++]=0;d[s++]=1;s=0;e[s++]=0;e[s++]=1;e[s++]=2;e[s++]=0;e[s++]=2;e[s++]=3;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));q={};l={};q.vertex=b.getAttribLocation(j,"position");q.uv=b.getAttribLocation(j,"uv");l.renderType=b.getUniformLocation(j,"renderType");l.map=b.getUniformLocation(j,"map");l.occlusionMap=b.getUniformLocation(j,"occlusionMap");l.opacity=b.getUniformLocation(j,"opacity");l.color=b.getUniformLocation(j,
|
|
|
-"color");l.scale=b.getUniformLocation(j,"scale");l.rotation=b.getUniformLocation(j,"rotation");l.screenPosition=b.getUniformLocation(j,"screenPosition");n=!1};this.render=function(a,d,e,p){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,v=p/e,u=0.5*e,w=0.5*p,z=16/p,y=new THREE.Vector2(z*v,z),A=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),I=l,z=q;b.useProgram(j);n||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),n=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.disable(b.CULL_FACE);b.depthMask(!1);var J,H,C,x,F;for(J=0;J<s;J++)if(z=16/p,y.set(z*v,z),x=a[J],t.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),D.x=A.x*u+u,D.y=A.y*w+w,k||0<D.x&&D.x<e&&0<D.y&&D.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,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=!1};this.render=function(a,d,e,p){var a=a.__webglFlares,r=a.length;if(r){var t=new THREE.Vector3,v=p/e,u=0.5*e,w=0.5*p,z=16/p,y=new THREE.Vector2(z*v,z),A=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),I=l,z=q;b.useProgram(k);n||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),n=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.disable(b.CULL_FACE);b.depthMask(!1);var J,H,C,x,F;for(J=0;J<r;J++)if(z=16/p,y.set(z*v,z),x=a[J],t.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),D.x=A.x*u+u,D.y=A.y*w+w,j||0<D.x&&D.x<e&&0<D.y&&D.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,D.x-8,D.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,y.x,y.y);b.uniform3f(I.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,D.x-8,D.y-8,16,16,0);b.uniform1i(I.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);x.positionScreen.copy(A);x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(H=0,C=x.lensFlares.length;H<C;H++)if(F=x.lensFlares[H],0.0010<F.opacity&&0.0010<F.scale)A.x=F.x,A.y=F.y,A.z=F.z,z=F.size*F.scale/p,y.x=z*v,y.y=z,b.uniform3f(I.screenPosition,A.x,A.y,A.z),b.uniform2f(I.scale,y.x,y.y),b.uniform1f(I.rotation,F.rotation),b.uniform1f(I.opacity,F.opacity),b.uniform3f(I.color,F.color.r,F.color.g,F.color.b),
|
|
|
c.setBlending(F.blending),c.setTexture(F.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4,f=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:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
|
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var j,q,l,n,r,m,o,p,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(j=0,q=i.__lights.length;j<q;j++)if(l=i.__lights[j],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var v;if(l.shadowCascadeArray[r])v=l.shadowCascadeArray[r];else{s=l;o=r;v=new THREE.DirectionalLight;v.isVirtual=
|
|
|
-!0;v.onlyShadow=!0;v.castShadow=!0;v.shadowCameraNear=s.shadowCameraNear;v.shadowCameraFar=s.shadowCameraFar;v.shadowCameraLeft=s.shadowCameraLeft;v.shadowCameraRight=s.shadowCameraRight;v.shadowCameraBottom=s.shadowCameraBottom;v.shadowCameraTop=s.shadowCameraTop;v.shadowCameraVisible=s.shadowCameraVisible;v.shadowDarkness=s.shadowDarkness;v.shadowBias=s.shadowCascadeBias[o];v.shadowMapWidth=s.shadowCascadeWidth[o];v.shadowMapHeight=s.shadowCascadeHeight[o];v.pointsWorld=[];v.pointsFrustum=[];p=
|
|
|
-v.pointsWorld;m=v.pointsFrustum;for(var u=0;8>u;u++)p[u]=new THREE.Vector3,m[u]=new THREE.Vector3;p=s.shadowCascadeNearZ[o];s=s.shadowCascadeFarZ[o];m[0].set(-1,-1,p);m[1].set(1,-1,p);m[2].set(-1,1,p);m[3].set(1,1,p);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);v.originalCamera=k;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(v);m.add(v.target);k.add(m);l.shadowCascadeArray[r]=v;console.log("Created virtualLight",v)}o=l;p=r;s=o.shadowCascadeArray[p];s.position.copy(o.position);
|
|
|
-s.target.position.copy(o.target.position);s.lookAt(s.target);s.shadowCameraVisible=o.shadowCameraVisible;s.shadowDarkness=o.shadowDarkness;s.shadowBias=o.shadowCascadeBias[p];m=o.shadowCascadeNearZ[p];o=o.shadowCascadeFarZ[p];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=o;s[5].z=o;s[6].z=o;s[7].z=o;t[n]=v;n++}else t[n]=l,n++;for(j=0,q=t.length;j<q;j++){l=t[j];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,q,l,n,s,m,o,p,r,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,q=i.__lights.length;k<q;k++)if(l=i.__lights[k],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(s=0;s<l.shadowCascadeCount;s++){var v;if(l.shadowCascadeArray[s])v=l.shadowCascadeArray[s];else{r=l;o=s;v=new THREE.DirectionalLight;v.isVirtual=
|
|
|
+!0;v.onlyShadow=!0;v.castShadow=!0;v.shadowCameraNear=r.shadowCameraNear;v.shadowCameraFar=r.shadowCameraFar;v.shadowCameraLeft=r.shadowCameraLeft;v.shadowCameraRight=r.shadowCameraRight;v.shadowCameraBottom=r.shadowCameraBottom;v.shadowCameraTop=r.shadowCameraTop;v.shadowCameraVisible=r.shadowCameraVisible;v.shadowDarkness=r.shadowDarkness;v.shadowBias=r.shadowCascadeBias[o];v.shadowMapWidth=r.shadowCascadeWidth[o];v.shadowMapHeight=r.shadowCascadeHeight[o];v.pointsWorld=[];v.pointsFrustum=[];p=
|
|
|
+v.pointsWorld;m=v.pointsFrustum;for(var u=0;8>u;u++)p[u]=new THREE.Vector3,m[u]=new THREE.Vector3;p=r.shadowCascadeNearZ[o];r=r.shadowCascadeFarZ[o];m[0].set(-1,-1,p);m[1].set(1,-1,p);m[2].set(-1,1,p);m[3].set(1,1,p);m[4].set(-1,-1,r);m[5].set(1,-1,r);m[6].set(-1,1,r);m[7].set(1,1,r);v.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(v);m.add(v.target);j.add(m);l.shadowCascadeArray[s]=v;console.log("Created virtualLight",v)}o=l;p=s;r=o.shadowCascadeArray[p];r.position.copy(o.position);
|
|
|
+r.target.position.copy(o.target.position);r.lookAt(r.target);r.shadowCameraVisible=o.shadowCameraVisible;r.shadowDarkness=o.shadowDarkness;r.shadowBias=o.shadowCascadeBias[p];m=o.shadowCascadeNearZ[p];o=o.shadowCascadeFarZ[p];r=r.pointsFrustum;r[0].z=m;r[1].z=m;r[2].z=m;r[3].z=m;r[4].z=o;r[5].z=o;r[6].z=o;r[7].z=o;t[n]=v;n++}else t[n]=l,n++;for(k=0,q=t.length;k<q;k++){l=t[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}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&&v.originalCamera==k){r=k;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;f.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=s[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
|
|
|
-r);n.matrixWorldInverse.multiplyVector3(p);if(p.x<f.x)f.x=p.x;if(p.x>h.x)h.x=p.x;if(p.y<f.y)f.y=p.y;if(p.y>h.y)h.y=p.y;if(p.z<f.z)f.z=p.z;if(p.z>h.z)h.z=p.z}n.left=f.x;n.right=h.x;n.top=h.y;n.bottom=f.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(l.shadowCamera);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);g.multiply(r.projectionMatrix,r.matrixWorldInverse);e.setFromMatrix(g);
|
|
|
-b.setRenderTarget(n);b.clear();s=i.__webglObjects;for(l=0,n=s.length;l<n;l++)if(o=s[l],m=o.object,o.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),o.render=!0;for(l=0,n=s.length;l<n;l++)if(o=s[l],o.render)m=o.object,o=o.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
-d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,p,o,m):b.renderBuffer(r,i.__lights,null,p,o,m);s=i.__webglObjectsImmediate;for(l=0,n=s.length;l<n;l++)o=s[l],m=o.object,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))}j=b.getClearColor();q=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,
|
|
|
+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&&v.originalCamera==j){s=j;n=l.shadowCamera;m=l.pointsFrustum;r=l.pointsWorld;f.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=r[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
|
|
|
+s);n.matrixWorldInverse.multiplyVector3(p);if(p.x<f.x)f.x=p.x;if(p.x>h.x)h.x=p.x;if(p.y<f.y)f.y=p.y;if(p.y>h.y)h.y=p.y;if(p.z<f.z)f.z=p.z;if(p.z>h.z)h.z=p.z}n.left=f.x;n.right=h.x;n.top=h.y;n.bottom=f.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;s=l.shadowCamera;s.position.copy(l.matrixWorld.getPosition());s.lookAt(l.target.matrixWorld.getPosition());s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
|
|
|
+l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);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(s.projectionMatrix);m.multiplySelf(s.matrixWorldInverse);if(!s._viewMatrixArray)s._viewMatrixArray=new Float32Array(16);if(!s._projectionMatrixArray)s._projectionMatrixArray=new Float32Array(16);s.matrixWorldInverse.flattenToArray(s._viewMatrixArray);s.projectionMatrix.flattenToArray(s._projectionMatrixArray);g.multiply(s.projectionMatrix,s.matrixWorldInverse);e.setFromMatrix(g);
|
|
|
+b.setRenderTarget(n);b.clear();r=i.__webglObjects;for(l=0,n=r.length;l<n;l++)if(o=r[l],m=o.object,o.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),o.render=!0;for(l=0,n=r.length;l<n;l++)if(o=r[l],o.render)m=o.object,o=o.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
+d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(s,i.__lights,null,p,o,m):b.renderBuffer(s,i.__lights,null,p,o,m);r=i.__webglObjectsImmediate;for(l=0,n=r.length;l<n;l++)o=r[l],m=o.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(s,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,e,g,f,h,i,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,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={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
|
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=!1};this.render=function(d,e,n,r){var d=d.__webglSprites,m=d.length;if(m){var o=i,p=k,s=r/n,n=0.5*n,t=0.5*r,v=!0;b.useProgram(h);j||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.uniformMatrix4fv(p.projectionMatrix,
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,f,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(s,a.vertexShader);b.compileShader(n);b.compileShader(s);b.attachShader(l,n);b.attachShader(l,s);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=!1};this.render=function(d,e,n,s){var d=d.__webglSprites,m=d.length;if(m){var o=i,p=j,r=s/n,n=0.5*n,t=0.5*s,v=!0;b.useProgram(h);k||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.uniformMatrix4fv(p.projectionMatrix,
|
|
|
!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var u,w=[],o=0;o<m;o++)if(u=d[o],u.visible&&0!==u.opacity)u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,u.matrixWorld,u._modelViewMatrixArray),u.z=-u._modelViewMatrix.n34);d.sort(a);for(o=0;o<m;o++)u=d[o],u.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width&&(u.useScreenCoordinates?(b.uniform1i(p.useScreenCoordinates,1),b.uniform3f(p.screenPosition,(u.position.x-
|
|
|
-n)/n,(t-u.position.y)/t,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(p.useScreenCoordinates,0),b.uniform1i(p.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(p.modelViewMatrix,!1,u._modelViewMatrixArray)),e=u.map.image.width/(u.scaleByViewport?r:1),w[0]=e*s*u.scale.x,w[1]=e*u.scale.y,b.uniform2f(p.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(p.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(p.alignment,u.alignment.x,u.alignment.y),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,
|
|
|
+n)/n,(t-u.position.y)/t,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(p.useScreenCoordinates,0),b.uniform1i(p.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(p.modelViewMatrix,!1,u._modelViewMatrixArray)),e=u.map.image.width/(u.scaleByViewport?s:1),w[0]=e*r*u.scale.x,w[1]=e*u.scale.y,b.uniform2f(p.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(p.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(p.alignment,u.alignment.x,u.alignment.y),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,
|
|
|
u.color.r,u.color.g,u.color.b),b.uniform1f(p.rotation,u.rotation),b.uniform2fv(p.scale,w),u.mergeWith3D&&!v?(b.enable(b.DEPTH_TEST),v=!0):!u.mergeWith3D&&v&&(b.disable(b.DEPTH_TEST),v=!1),c.setBlending(u.blending),c.setTexture(u.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
|
-b){this.enabled&&this.update(a,b)};this.update=function(f,h){var i,k,j,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&f.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);g.multiply(h.projectionMatrix,
|
|
|
-h.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();n=f.__webglObjects;for(i=0,k=n.length;i<k;i++)if(j=n[i],l=j.object,j.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),j.render=!0;for(i=0,k=n.length;i<k;i++)if(j=n[i],j.render)l=j.object,j=j.buffer,b.setObjectFaces(l),q=l.customDepthMaterial?
|
|
|
-l.customDepthMaterial:l.geometry.morphTargets.length?d:c,j instanceof THREE.BufferGeometry?b.renderBufferDirect(h,f.__lights,null,q,j,l):b.renderBuffer(h,f.__lights,null,q,j,l);n=f.__webglObjectsImmediate;for(i=0,k=n.length;i<k;i++)j=n[i],l=j.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,f.__lights,null,c,l));i=b.getClearColor();
|
|
|
-k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND)}};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},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;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),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||k!==c.near||j!==c.far||q!==c.fov){i=c.aspect;k=c.near;j=c.far;q=c.fov;var s=c.projectionMatrix.clone(),t=0.5*(125/30),v=t*k/125,u=k*Math.tan(q*Math.PI/360),w;f.n14=t;h.n14=-t;t=-u*i+v;w=u*i+v;s.n11=2*k/(w-t);s.n13=(w+t)/(w-t);e.projectionMatrix.copy(s);t=-u*i-v;w=u*i-v;s.n11=
|
|
|
-2*k/(w-t);s.n13=(w+t)/(w-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,l,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,n,!0);m.updateMatrixWorld();d.call(b,m,r)}};
|
|
|
+b){this.enabled&&this.update(a,b)};this.update=function(f,h){var i,j,k,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&f.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);g.multiply(h.projectionMatrix,
|
|
|
+h.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();n=f.__webglObjects;for(i=0,j=n.length;i<j;i++)if(k=n[i],l=k.object,k.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),k.render=!0;for(i=0,j=n.length;i<j;i++)if(k=n[i],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,f.__lights,null,q,k,l):b.renderBuffer(h,f.__lights,null,q,k,l);n=f.__webglObjectsImmediate;for(i=0,j=n.length;i<j;i++)k=n[i],l=k.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,f.__lights,null,c,l));i=b.getClearColor();
|
|
|
+j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);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 r=c.projectionMatrix.clone(),t=0.5*(125/30),v=t*j/125,u=j*Math.tan(q*Math.PI/360),w;f.n14=t;h.n14=-t;t=-u*i+v;w=u*i+v;r.n11=2*j/(w-t);r.n13=(w+t)/(w-t);e.projectionMatrix.copy(r);t=-u*i-v;w=u*i-v;r.n11=
|
|
|
+2*j/(w-t);r.n13=(w+t)/(w-t);g.projectionMatrix.copy(r)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,l,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,n,!0);m.updateMatrixWorld();d.call(b,m,s)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
|
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|