|
@@ -17,8 +17,8 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
|
|
|
a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
|
|
|
this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
|
|
|
setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
|
|
|
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],k=d[9],l=d[2],o=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(k));if(Math.abs(k)<
|
|
|
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-l,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-k,i);this.y=Math.atan2(-l,
|
|
|
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],o=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(j));if(Math.abs(j)<
|
|
|
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-l,e);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}}else if(b==="ZYX"){this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-j,i);this.y=Math.atan2(-l,
|
|
|
e)}else{this.x=0;this.y=Math.atan2(l,d)}}else if(b==="XZY"){this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,i);this.y=Math.atan2(g,e)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}else if(b===
|
|
|
"YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
|
|
|
a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
|
|
@@ -26,46 +26,46 @@ b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===t
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
|
|
|
this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
|
|
|
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
|
|
|
-k)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+k-1)/2);return this}};
|
|
|
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>j)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
|
|
|
+j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
|
|
|
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
|
-THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],k=c[7],l=c[8],o=c[9],m=c[10],p=c[11],r=c[12],n=c[13],q=c[14],c=c[15];b[0].set(f-a,k-g,p-l,c-r);b[1].set(f+a,k+g,p+l,c+r);b[2].set(f+d,k+h,p+o,c+n);b[3].set(f-d,k-h,p-o,c-n);b[4].set(f-e,k-i,p-m,c-q);b[5].set(f+e,k+i,p+m,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
|
|
|
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],o=c[9],m=c[10],p=c[11],r=c[12],n=c[13],q=c[14],c=c[15];b[0].set(f-a,j-g,p-l,c-r);b[1].set(f+a,j+g,p+l,c+r);b[2].set(f+d,j+h,p+o,c+n);b[3].set(f-d,j-h,p-o,c-n);b[4].set(f-e,j-i,p-m,c-q);b[5].set(f+e,j+i,p+m,c+q);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;e<6;e++){b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s,u,w,t=function(a,b,c){r.sub(c,a);s=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(s));
|
|
|
-return w=c.distanceTo(u)},x,F,C,z,v,H,I,N,R=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(n);C=r.dot(q);z=n.dot(n);v=n.dot(q);H=1/(x*z-F*F);I=(z*C-F*v)*H;N=(x*v-F*C)*H;return I>=0&&N>=0&&I+N<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var j=0,n=a.children.length;j<n;j++)Array.prototype.push.apply(d,this.intersectObject(a.children[j],b));if(a instanceof THREE.Particle){w=t(this.origin,this.direction,a.matrixWorld.getPosition());
|
|
|
-if(w>a.scale.x)return[];c={distance:w,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){j=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());j=a.geometry.boundingSphere.radius*Math.max(j.x,Math.max(j.y,j.z));w=t(this.origin,this.direction,a.matrixWorld.getPosition());if(w>j)return d;var r,q,s=a.geometry,u=s.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);j=0;for(n=s.faces.length;j<
|
|
|
-n;j++){c=s.faces[j];i.copy(this.origin);k.copy(this.direction);v=a.matrixWorld;l=v.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=k.dot(o);if(!(Math.abs(r)<Y)){q=o.dot(l)/r;if(!(q<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){m.add(i,k.multiplyScalar(q));w=i.distanceTo(m);if(!(w<this.near)&&!(w>this.far))if(c instanceof THREE.Face3){e=v.multiplyVector3(e.copy(u[c.a]));f=v.multiplyVector3(f.copy(u[c.b]));g=v.multiplyVector3(g.copy(u[c.c]));
|
|
|
+THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s,u,w,t=function(a,b,c){r.sub(c,a);s=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(s));
|
|
|
+return w=c.distanceTo(u)},x,F,C,z,v,H,I,N,R=function(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);x=r.dot(r);F=r.dot(n);C=r.dot(q);z=n.dot(n);v=n.dot(q);H=1/(x*z-F*F);I=(z*C-F*v)*H;N=(x*v-F*C)*H;return I>=0&&N>=0&&I+N<1},Y=1.0E-4;this.setPrecision=function(a){Y=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var k=0,n=a.children.length;k<n;k++)Array.prototype.push.apply(d,this.intersectObject(a.children[k],b));if(a instanceof THREE.Particle){w=t(this.origin,this.direction,a.matrixWorld.getPosition());
|
|
|
+if(w>a.scale.x)return[];c={distance:w,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){k=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());k=a.geometry.boundingSphere.radius*Math.max(k.x,Math.max(k.y,k.z));w=t(this.origin,this.direction,a.matrixWorld.getPosition());if(w>k)return d;var r,q,s=a.geometry,u=s.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);k=0;for(n=s.faces.length;k<
|
|
|
+n;k++){c=s.faces[k];i.copy(this.origin);j.copy(this.direction);v=a.matrixWorld;l=v.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=j.dot(o);if(!(Math.abs(r)<Y)){q=o.dot(l)/r;if(!(q<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){m.add(i,j.multiplyScalar(q));w=i.distanceTo(m);if(!(w<this.near)&&!(w>this.far))if(c instanceof THREE.Face3){e=v.multiplyVector3(e.copy(u[c.a]));f=v.multiplyVector3(f.copy(u[c.b]));g=v.multiplyVector3(g.copy(u[c.c]));
|
|
|
if(R(m,e,f,g)){c={distance:w,point:m.clone(),face:c,object:a};d.push(c)}}else if(c instanceof THREE.Face4){e=v.multiplyVector3(e.copy(u[c.a]));f=v.multiplyVector3(f.copy(u[c.b]));g=v.multiplyVector3(g.copy(u[c.c]));h=v.multiplyVector3(h.copy(u[c.d]));if(R(m,e,f,h)||R(m,f,g,h)){c={distance:w,point:m.clone(),face:c,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(p);
|
|
|
return c}};
|
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h===true){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:
|
|
|
g;d=d>f?d:f;e=e>g?e:g}a()};this.add3Points=function(f,g,l,o,m,p){if(h===true){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>m?f:m:l>m?l:m;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h===true){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();
|
|
|
c=c<f.getTop()?c:f.getTop();d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*k;return this},
|
|
|
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,o,m,p,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,k||0,l!==void 0?l:1,o||0,m||0,p||0,r||0,n!==void 0?n:1)};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,l,o,m,p,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=k;q[10]=l;q[14]=o;q[3]=m;q[7]=p;q[11]=r;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],o=c[9],m=c[13],p=c[2],r=c[6],n=c[10],q=c[14],s=c[3],u=c[7],w=c[11],c=c[15],t=d[0],x=d[4],
|
|
|
-F=d[8],C=d[12],z=d[1],v=d[5],H=d[9],I=d[13],N=d[2],R=d[6],Y=d[10],B=d[14],G=d[3],Q=d[7],D=d[11],d=d[15];e[0]=f*t+g*z+h*N+i*G;e[4]=f*x+g*v+h*R+i*Q;e[8]=f*F+g*H+h*Y+i*D;e[12]=f*C+g*I+h*B+i*d;e[1]=k*t+l*z+o*N+m*G;e[5]=k*x+l*v+o*R+m*Q;e[9]=k*F+l*H+o*Y+m*D;e[13]=k*C+l*I+o*B+m*d;e[2]=p*t+r*z+n*N+q*G;e[6]=p*x+r*v+n*R+q*Q;e[10]=p*F+r*H+n*Y+q*D;e[14]=p*C+r*I+n*B+q*d;e[3]=s*t+u*z+w*N+c*G;e[7]=s*x+u*v+w*R+c*Q;e[11]=s*F+u*H+w*Y+c*D;e[15]=s*C+u*I+w*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;return this},
|
|
|
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,o,m,p,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,j||0,l!==void 0?l:1,o||0,m||0,p||0,r||0,n!==void 0?n:1)};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,o,m,p,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=l;q[14]=o;q[3]=m;q[7]=p;q[11]=r;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],o=c[9],m=c[13],p=c[2],r=c[6],n=c[10],q=c[14],s=c[3],u=c[7],w=c[11],c=c[15],t=d[0],x=d[4],
|
|
|
+F=d[8],C=d[12],z=d[1],v=d[5],H=d[9],I=d[13],N=d[2],R=d[6],Y=d[10],B=d[14],G=d[3],Q=d[7],D=d[11],d=d[15];e[0]=f*t+g*z+h*N+i*G;e[4]=f*x+g*v+h*R+i*Q;e[8]=f*F+g*H+h*Y+i*D;e[12]=f*C+g*I+h*B+i*d;e[1]=j*t+l*z+o*N+m*G;e[5]=j*x+l*v+o*R+m*Q;e[9]=j*F+l*H+o*Y+m*D;e[13]=j*C+l*I+o*B+m*d;e[2]=p*t+r*z+n*N+q*G;e[6]=p*x+r*v+n*R+q*Q;e[10]=p*F+r*H+n*Y+q*D;e[14]=p*C+r*I+n*B+q*d;e[3]=s*t+u*z+w*N+c*G;e[7]=s*x+u*v+w*R+c*Q;e[11]=s*F+u*H+w*Y+c*D;e[15]=s*C+u*I+w*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
|
|
|
b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
|
|
|
c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
|
|
|
-a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],o=a[10],m=a[14],p=a[3],r=a[7],n=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*m*p-c*h*m*p-e*h*k*r+d*i*k*r+e*f*o*r-b*i*o*r-d*f*m*r+b*h*m*r+e*g*k*n-c*i*k*n-e*f*l*n+b*i*l*n+c*f*m*n-b*g*m*n-d*g*k*a+c*h*k*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
|
|
|
+a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],l=a[6],o=a[10],m=a[14],p=a[3],r=a[7],n=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*m*p-c*h*m*p-e*h*j*r+d*i*j*r+e*f*o*r-b*i*o*r-d*f*m*r+b*h*m*r+e*g*j*n-c*i*j*n-e*f*l*n+b*i*l*n+c*f*m*n-b*g*m*n-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
|
|
|
b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
|
|
|
c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
|
|
|
-a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],k=c[9],l=c[13],o=c[2],m=c[6],p=c[10],r=c[14],n=c[3],q=c[7],s=c[11],c=c[15];b[0]=k*r*q-l*p*q+l*m*s-i*r*s-k*m*c+i*p*c;b[4]=g*p*q-f*r*q-g*m*s+e*r*s+f*m*c-e*p*c;b[8]=f*l*q-g*k*q+g*i*s-e*l*s-f*i*c+e*k*c;b[12]=g*k*m-f*l*m-g*i*p+e*l*p+f*i*r-e*k*r;b[1]=l*p*n-k*r*n-l*o*s+h*r*s+k*o*c-h*p*c;b[5]=f*r*n-g*p*n+g*o*s-d*r*s-f*o*c+d*p*c;b[9]=g*k*n-f*l*n-g*h*s+d*l*s+f*h*c-d*k*c;b[13]=f*l*o-g*k*o+g*h*p-d*
|
|
|
-l*p-f*h*r+d*k*r;b[2]=i*r*n-l*m*n+l*o*q-h*r*q-i*o*c+h*m*c;b[6]=g*m*n-e*r*n-g*o*q+d*r*q+e*o*c-d*m*c;b[10]=e*l*n-g*i*n+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*o-e*l*o-g*h*m+d*l*m+e*h*r-d*i*r;b[3]=k*m*n-i*p*n-k*o*q+h*p*q+i*o*s-h*m*s;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*s+d*m*s;b[11]=f*i*n-e*k*n-f*h*q+d*k*q+e*h*s-d*i*s;b[15]=e*k*o-f*i*o+f*h*m-d*k*m-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),
|
|
|
-h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var k=g*i,l=g*f,o=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=o+l*e;c[10]=g*h}else if(b==="YXZ"){k=h*i;l=h*f;o=e*i;m=e*f;c[0]=k+m*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=l*d-o;c[6]=m+k*d;c[10]=g*h}else if(b==="ZXY"){k=h*i;l=h*f;o=e*i;m=e*f;c[0]=k-m*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*i;c[9]=m-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){k=g*i;l=g*f;o=d*i;
|
|
|
-m=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=k*e+m;c[1]=h*f;c[5]=m*e+k;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){k=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=m-k*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=k-m*f}else if(b==="XZY"){k=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;c[1]=k*f+m;c[5]=g*i;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*i;c[10]=m*f+k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,c=c*i,l=d*h,d=d*
|
|
|
-i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
|
|
|
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],j=c[9],l=c[13],o=c[2],m=c[6],p=c[10],r=c[14],n=c[3],q=c[7],s=c[11],c=c[15];b[0]=j*r*q-l*p*q+l*m*s-i*r*s-j*m*c+i*p*c;b[4]=g*p*q-f*r*q-g*m*s+e*r*s+f*m*c-e*p*c;b[8]=f*l*q-g*j*q+g*i*s-e*l*s-f*i*c+e*j*c;b[12]=g*j*m-f*l*m-g*i*p+e*l*p+f*i*r-e*j*r;b[1]=l*p*n-j*r*n-l*o*s+h*r*s+j*o*c-h*p*c;b[5]=f*r*n-g*p*n+g*o*s-d*r*s-f*o*c+d*p*c;b[9]=g*j*n-f*l*n-g*h*s+d*l*s+f*h*c-d*j*c;b[13]=f*l*o-g*j*o+g*h*p-d*
|
|
|
+l*p-f*h*r+d*j*r;b[2]=i*r*n-l*m*n+l*o*q-h*r*q-i*o*c+h*m*c;b[6]=g*m*n-e*r*n-g*o*q+d*r*q+e*o*c-d*m*c;b[10]=e*l*n-g*i*n+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*o-e*l*o-g*h*m+d*l*m+e*h*r-d*i*r;b[3]=j*m*n-i*p*n-j*o*q+h*p*q+i*o*s-h*m*s;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*s+d*m*s;b[11]=f*i*n-e*j*n-f*h*q+d*j*q+e*h*s-d*i*s;b[15]=e*j*o-f*i*o+f*h*m-d*j*m-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),
|
|
|
+h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(b===void 0||b==="XYZ"){var j=g*i,l=g*f,o=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=o+l*e;c[10]=g*h}else if(b==="YXZ"){j=h*i;l=h*f;o=e*i;m=e*f;c[0]=j+m*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*i;c[9]=-d;c[2]=l*d-o;c[6]=m+j*d;c[10]=g*h}else if(b==="ZXY"){j=h*i;l=h*f;o=e*i;m=e*f;c[0]=j-m*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*i;c[9]=m-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h}else if(b==="ZYX"){j=g*i;l=g*f;o=d*i;
|
|
|
+m=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=j*e+m;c[1]=h*f;c[5]=m*e+j;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){j=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=m-j*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=j-m*f}else if(b==="XZY"){j=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;c[1]=j*f+m;c[5]=g*i;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*i;c[10]=m*f+j}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,l=d*h,d=d*
|
|
|
+i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);
|
|
|
g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
|
|
|
c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*
|
|
|
-c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=
|
|
|
-this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
|
|
|
-if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),o=1-k,m=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=p-r,m=m-l,h=h+(1-h)*k,l=o+d,p=p+r,o=o-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],n=c[3],q=c[4],s=c[5],u=c[6],w=c[7],t=c[8],x=c[9],F=c[10],C=c[11];c[0]=f*k+g*q+e*t;c[1]=f*d+g*
|
|
|
-s+e*x;c[2]=f*r+g*u+e*F;c[3]=f*n+g*w+e*C;c[4]=m*k+h*q+l*t;c[5]=m*d+h*s+l*x;c[6]=m*r+h*u+l*F;c[7]=m*n+h*w+l*C;c[8]=p*k+o*q+i*t;c[9]=p*d+o*s+i*x;c[10]=p*r+o*u+i*F;c[11]=p*n+o*w+i*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
|
|
|
+c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=
|
|
|
+this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
|
|
|
+if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),o=1-j,m=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*j,g=m+l,e=p-r,m=m-l,h=h+(1-h)*j,l=o+d,p=p+r,o=o-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],n=c[3],q=c[4],s=c[5],u=c[6],w=c[7],t=c[8],x=c[9],F=c[10],C=c[11];c[0]=f*j+g*q+e*t;c[1]=f*d+g*
|
|
|
+s+e*x;c[2]=f*r+g*u+e*F;c[3]=f*n+g*w+e*C;c[4]=m*j+h*q+l*t;c[5]=m*d+h*s+l*x;c[6]=m*r+h*u+l*F;c[7]=m*n+h*w+l*C;c[8]=p*j+o*q+i*t;c[9]=p*d+o*s+i*x;c[10]=p*r+o*u+i*F;c[11]=p*n+o*w+i*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
|
|
|
a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);
|
|
|
-return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=
|
|
|
-0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
|
|
|
+return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=
|
|
|
+0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
|
|
|
a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
|
|
@@ -74,25 +74,25 @@ this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.s
|
|
|
b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
this.useQuaternion===true?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent!==void 0?this.matrixWorld.multiply(this.parent.matrixWorld,
|
|
|
this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===k.length){a=new THREE.RenderableVertex;k.push(a)}else a=k[i];i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,
|
|
|
-g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,i,k=[],l,o,m=[],p,r=[],n,q,s=[],u,w,t=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,I=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
|
|
|
+THREE.Projector=function(){function a(){var a;if(f===g.length){a=new THREE.RenderableObject;g.push(a)}else a=g[f];f++;return a}function b(){var a;if(i===j.length){a=new THREE.RenderableVertex;j.push(a)}else a=j[i];i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,
|
|
|
+g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var e,f,g=[],h,i,j=[],l,o,m=[],p,r=[],n,q,s=[],u,w,t=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,C=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,I=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=
|
|
|
function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof
|
|
|
THREE.Line)&&(b.frustumCulled===false||H.contains(b)===true)){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d===true&&x.objects.sort(c);return x};this.projectScene=function(a,
|
|
|
-e,f){var g=e.near,F=e.far,D=false,j,P,L,S,aa,K,ca,ha,O,Z,$,X,ia,ya,Ia;w=q=p=o=0;x.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(j=x.objects.length;a<j;a++){O=x.objects[a].object;Z=O.matrixWorld;i=0;if(O instanceof THREE.Mesh){$=O.geometry;X=O.geometry.materials;
|
|
|
-S=$.vertices;ia=$.faces;ya=$.faceVertexUvs;$=O.matrixRotationWorld.extractRotation(Z);P=0;for(L=S.length;P<L;P++){h=b();h.positionWorld.copy(S[P]);Z.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}S=0;for(P=ia.length;S<P;S++){L=ia[S];if(L instanceof THREE.Face3){aa=k[L.a];K=
|
|
|
-k[L.b];ca=k[L.c];if(aa.visible===true&&K.visible===true&&ca.visible===true){D=(ca.positionScreen.x-aa.positionScreen.x)*(K.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(K.positionScreen.x-aa.positionScreen.x)<0;if(O.doubleSided===true||D!==O.flipSided){ha=void 0;if(o===m.length){ha=new THREE.RenderableFace3;m.push(ha)}else ha=m[o];o++;l=ha;l.v1.copy(aa);l.v2.copy(K);l.v3.copy(ca)}else continue}else continue}else if(L instanceof THREE.Face4){aa=k[L.a];K=k[L.b];ca=
|
|
|
-k[L.c];ha=k[L.d];if(aa.visible===true&&K.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-aa.positionScreen.x)*(K.positionScreen.y-aa.positionScreen.y)-(ha.positionScreen.y-aa.positionScreen.y)*(K.positionScreen.x-aa.positionScreen.x)<0||(K.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(K.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(O.doubleSided===true||D!==O.flipSided){Ia=void 0;if(p===r.length){Ia=
|
|
|
-new THREE.RenderableFace4;r.push(Ia)}else Ia=r[p];p++;l=Ia;l.v1.copy(aa);l.v2.copy(K);l.v3.copy(ca);l.v4.copy(ha)}else continue}else continue}l.normalWorld.copy(L.normal);D===false&&(O.flipSided===true||O.doubleSided===true)&&l.normalWorld.negate();$.multiplyVector3(l.normalWorld);l.centroidWorld.copy(L.centroid);Z.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);z.multiplyVector3(l.centroidScreen);ca=L.vertexNormals;aa=0;for(K=ca.length;aa<K;aa++){ha=l.vertexNormalsWorld[aa];
|
|
|
-ha.copy(ca[aa]);D===false&&(O.flipSided===true||O.doubleSided===true)&&ha.negate();$.multiplyVector3(ha)}aa=0;for(K=ya.length;aa<K;aa++){Ia=ya[aa][S];if(Ia!==void 0){ca=0;for(ha=Ia.length;ca<ha;ca++)l.uvs[aa][ca]=Ia[ca]}}l.material=O.material;l.faceMaterial=L.materialIndex!==null?X[L.materialIndex]:null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(O instanceof THREE.Line){v.multiply(z,Z);S=O.geometry.vertices;aa=b();aa.positionScreen.copy(S[0]);v.multiplyVector4(aa.positionScreen);Z=O.type===
|
|
|
-THREE.LinePieces?2:1;P=1;for(L=S.length;P<L;P++){aa=b();aa.positionScreen.copy(S[P]);v.multiplyVector4(aa.positionScreen);if(!((P+1)%Z>0)){K=k[i-2];I.copy(aa.positionScreen);N.copy(K.positionScreen);if(d(I,N)===true){I.multiplyScalar(1/I.w);N.multiplyScalar(1/N.w);X=void 0;if(q===s.length){X=new THREE.RenderableLine;s.push(X)}else X=s[q];q++;n=X;n.v1.positionScreen.copy(I);n.v2.positionScreen.copy(N);n.z=Math.max(I.z,N.z);n.material=O.material;x.elements.push(n)}}}}}a=0;for(j=x.sprites.length;a<j;a++){O=
|
|
|
+e,f){var g=e.near,F=e.far,D=false,k,P,L,S,aa,K,ca,ha,O,Z,$,X,ia,za,Ga;w=q=p=o=0;x.elements.length=0;if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(z);x=this.projectGraph(a,false);a=0;for(k=x.objects.length;a<k;a++){O=x.objects[a].object;Z=O.matrixWorld;i=0;if(O instanceof THREE.Mesh){$=O.geometry;X=O.geometry.materials;
|
|
|
+S=$.vertices;ia=$.faces;za=$.faceVertexUvs;$=O.matrixRotationWorld.extractRotation(Z);P=0;for(L=S.length;P<L;P++){h=b();h.positionWorld.copy(S[P]);Z.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}S=0;for(P=ia.length;S<P;S++){L=ia[S];if(L instanceof THREE.Face3){aa=j[L.a];K=
|
|
|
+j[L.b];ca=j[L.c];if(aa.visible===true&&K.visible===true&&ca.visible===true){D=(ca.positionScreen.x-aa.positionScreen.x)*(K.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(K.positionScreen.x-aa.positionScreen.x)<0;if(O.doubleSided===true||D!==O.flipSided){ha=void 0;if(o===m.length){ha=new THREE.RenderableFace3;m.push(ha)}else ha=m[o];o++;l=ha;l.v1.copy(aa);l.v2.copy(K);l.v3.copy(ca)}else continue}else continue}else if(L instanceof THREE.Face4){aa=j[L.a];K=j[L.b];ca=
|
|
|
+j[L.c];ha=j[L.d];if(aa.visible===true&&K.visible===true&&ca.visible===true&&ha.visible===true){D=(ha.positionScreen.x-aa.positionScreen.x)*(K.positionScreen.y-aa.positionScreen.y)-(ha.positionScreen.y-aa.positionScreen.y)*(K.positionScreen.x-aa.positionScreen.x)<0||(K.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(K.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0;if(O.doubleSided===true||D!==O.flipSided){Ga=void 0;if(p===r.length){Ga=
|
|
|
+new THREE.RenderableFace4;r.push(Ga)}else Ga=r[p];p++;l=Ga;l.v1.copy(aa);l.v2.copy(K);l.v3.copy(ca);l.v4.copy(ha)}else continue}else continue}l.normalWorld.copy(L.normal);D===false&&(O.flipSided===true||O.doubleSided===true)&&l.normalWorld.negate();$.multiplyVector3(l.normalWorld);l.centroidWorld.copy(L.centroid);Z.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);z.multiplyVector3(l.centroidScreen);ca=L.vertexNormals;aa=0;for(K=ca.length;aa<K;aa++){ha=l.vertexNormalsWorld[aa];
|
|
|
+ha.copy(ca[aa]);D===false&&(O.flipSided===true||O.doubleSided===true)&&ha.negate();$.multiplyVector3(ha)}aa=0;for(K=za.length;aa<K;aa++){Ga=za[aa][S];if(Ga!==void 0){ca=0;for(ha=Ga.length;ca<ha;ca++)l.uvs[aa][ca]=Ga[ca]}}l.material=O.material;l.faceMaterial=L.materialIndex!==null?X[L.materialIndex]:null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(O instanceof THREE.Line){v.multiply(z,Z);S=O.geometry.vertices;aa=b();aa.positionScreen.copy(S[0]);v.multiplyVector4(aa.positionScreen);Z=O.type===
|
|
|
+THREE.LinePieces?2:1;P=1;for(L=S.length;P<L;P++){aa=b();aa.positionScreen.copy(S[P]);v.multiplyVector4(aa.positionScreen);if(!((P+1)%Z>0)){K=j[i-2];I.copy(aa.positionScreen);N.copy(K.positionScreen);if(d(I,N)===true){I.multiplyScalar(1/I.w);N.multiplyScalar(1/N.w);X=void 0;if(q===s.length){X=new THREE.RenderableLine;s.push(X)}else X=s[q];q++;n=X;n.v1.positionScreen.copy(I);n.v2.positionScreen.copy(N);n.z=Math.max(I.z,N.z);n.material=O.material;x.elements.push(n)}}}}}a=0;for(k=x.sprites.length;a<k;a++){O=
|
|
|
x.sprites[a].object;Z=O.matrixWorld;if(O instanceof THREE.Particle){C.set(Z.elements[12],Z.elements[13],Z.elements[14],1);z.multiplyVector4(C);C.z=C.z/C.w;if(C.z>0&&C.z<1){g=void 0;if(w===t.length){g=new THREE.RenderableParticle;t.push(g)}else g=t[w];w++;u=g;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=O.rotation.z;u.scale.x=O.scale.x*Math.abs(u.x-(C.x+e.projectionMatrix.elements[0])/(C.w+e.projectionMatrix.elements[12]));u.scale.y=O.scale.y*Math.abs(u.y-(C.y+e.projectionMatrix.elements[5])/(C.w+e.projectionMatrix.elements[13]));
|
|
|
u.material=O.material;x.elements.push(u)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="YXZ"){this.x=f*d*e+c*g*h;this.y=c*g*e-f*d*h;this.z=
|
|
|
c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="ZXY"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e-f*g*h}else if(b==="ZYX"){this.x=f*d*e-c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e+f*g*h}else if(b==="YZX"){this.x=f*d*e+c*g*h;this.y=c*g*e+f*d*h;this.z=c*d*h-f*g*e;this.w=c*d*e-f*g*h}else if(b==="XZY"){this.x=f*d*e-c*g*h;this.y=c*g*e-f*d*h;this.z=c*d*h+f*g*e;this.w=c*d*e+f*g*h}return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
|
|
|
-d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
|
|
|
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
|
|
|
(d+h)/c;this.y=(g+i)/c;this.z=0.25*c}return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
|
|
|
this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
|
|
|
-f=this.x,g=this.y,h=this.z,i=this.w,k=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-k*-h;b.z=o*i+c*-h+k*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
|
|
|
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-j*-h;b.z=o*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.0010){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
|
|
|
this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
|
|
|
THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
@@ -107,17 +107,17 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
|
|
|
else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
|
|
|
for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
|
|
|
e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
|
|
|
-[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
|
|
|
-i=g.faceNormals[c];k=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];
|
|
|
-k=a.vertices[d];l=g[e];o=g[f];m=g[z];p=i.x-h.x;r=k.x-h.x;n=i.y-h.y;q=k.y-h.y;s=i.z-h.z;u=k.z-h.z;w=o.u-l.u;t=m.u-l.u;x=o.v-l.v;F=m.v-l.v;C=1/(w*F-t*x);I.set((F*p-x*r)*C,(F*n-x*q)*C,(F*s-x*u)*C);N.set((w*r-t*p)*C,(w*q-t*n)*C,(w*u-t*s)*C);v[b].addSelf(I);v[c].addSelf(I);v[d].addSelf(I);H[b].addSelf(N);H[c].addSelf(N);H[d].addSelf(N)}var b,c,d,e,f,g,h,i,k,l,o,m,p,r,n,q,s,u,w,t,x,F,C,z,v=[],H=[],I=new THREE.Vector3,N=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
|
|
|
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
|
|
|
+i=g.faceNormals[c];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];
|
|
|
+j=a.vertices[d];l=g[e];o=g[f];m=g[z];p=i.x-h.x;r=j.x-h.x;n=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;w=o.u-l.u;t=m.u-l.u;x=o.v-l.v;F=m.v-l.v;C=1/(w*F-t*x);I.set((F*p-x*r)*C,(F*n-x*q)*C,(F*s-x*u)*C);N.set((w*r-t*p)*C,(w*q-t*n)*C,(w*u-t*s)*C);v[b].addSelf(I);v[c].addSelf(I);v[d].addSelf(I);H[b].addSelf(N);H[c].addSelf(N);H[d].addSelf(N)}var b,c,d,e,f,g,h,i,j,l,o,m,p,r,n,q,s,u,w,t,x,F,C,z,v=[],H=[],I=new THREE.Vector3,N=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
|
|
|
this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[G[d]];z=v[e];R.copy(z);R.subSelf(B.multiplyScalar(B.dot(z))).normalize();
|
|
|
Y.cross(f.vertexNormals[d],z);e=Y.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
|
|
|
a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
|
|
|
e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(h=
|
|
|
this.faceVertexUvs[e][f])&&h.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,o,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
-f+2;k=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,o.x,m.x,g,h,i);d.y=b(k.y,l.y,o.y,m.y,g,h,i);d.z=b(k.z,l.z,o.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
|
|
|
-a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=i;e=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,l,o,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
+f+2;j=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,o.x,m.x,g,h,i);d.y=b(j.y,l.y,o.y,m.y,g,h,i);d.z=b(j.z,l.z,o.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
|
|
|
+a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=i;e=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
|
|
|
h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
|
|
|
THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
|
THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
|
|
@@ -132,54 +132,54 @@ this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.protot
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
|
|
|
Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function 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=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
|
|
|
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=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(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
|
|
|
-if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=k.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(k.map){l.tDiffuse.texture=k.map;l.enableDiffuse.value=true}if(k.specularMap){l.tSpecular.texture=k.specularMap;l.enableSpecular.value=true}if(k.lightMap){l.tAO.texture=k.lightMap;
|
|
|
-l.enableAO.value=true}l.uDiffuseColor.value.setHex(k.color);l.uSpecularColor.value.setHex(k.specular);l.uAmbientColor.value.setHex(k.ambient);l.uShininess.value=k.shininess;if(k.opacity!==void 0)l.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else k=new THREE[i](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=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(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
|
|
|
+if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;
|
|
|
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
THREE.BinaryLoader.prototype=Object.create(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,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
|
|
|
f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,o,m,p,r,n,q,s,u,w,t;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=Q[e*2];e=Q[e*2+1];j=Q[f*2];i=Q[f*2+1];f=Q[g*2];k=Q[g*2+1];g=Y.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));m.push(new THREE.UV(f,
|
|
|
-k));g.push(m)}}function v(b,c){var d,e,f,g,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=Q[e*2];e=Q[e*2+1];i=Q[f*2];l=Q[f*2+1];k=Q[g*2];m=Q[g*2+1];g=Q[h*2];f=Q[h*2+1];h=Y.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function H(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
|
|
|
-Y.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function I(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];Y.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function N(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];l=d[e*3+2];j=m[e];var n=G[k*3],o=G[k*3+1];k=G[k*3+2];var p=G[l*3],
|
|
|
-r=G[l*3+1];l=G[l*3+2];Y.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(G[i*3],G[i*3+1],G[i*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,j))}}function R(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];i=o[e];var p=G[l*3],r=G[l*3+1];l=G[l*3+2];var q=G[m*3],s=G[m*3+1];m=G[m*3+2];var t=G[n*3],u=G[n*3+1];n=G[n*3+2];Y.faces.push(new THREE.Face4(f,
|
|
|
-g,h,j,[new THREE.Vector3(G[k*3],G[k*3+1],G[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,i))}}var Y=this,B=0,G=[],Q=[],D,j,P;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);k=F(a,B+18);l=F(a,B+19);o=C(a,B+20);m=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
|
|
|
-C(a,B+20+16);n=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);w=C(a,B+20+36);t=C(a,B+20+40);B=B+c;c=e*3+l;P=e*4+l;D=b*c;j=r*(c+i*3);e=n*(c+k*3);l=q*(c+i*3+k*3);c=s*P;i=u*(P+i*4);k=w*(P+k*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Y.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];G.push(d/
|
|
|
-127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(m*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];Q.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);j=D+j+x(r*2);e=j+e+x(n*2);l=e+l+x(q*2);c=l+c+x(s*2);i=c+i+x(u*2);k=i+k+x(w*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(j);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
|
|
|
-q*Uint32Array.BYTES_PER_ELEMENT*3;N(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;I(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;R(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,c)}})(k);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;N(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,o,m,p,r,n,q,s,u,w,t;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,k,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=Q[e*2];e=Q[e*2+1];k=Q[f*2];i=Q[f*2+1];f=Q[g*2];j=Q[g*2+1];g=Y.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(k,i));m.push(new THREE.UV(f,
|
|
|
+j));g.push(m)}}function v(b,c){var d,e,f,g,h,k,i,j,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];k=Q[e*2];e=Q[e*2+1];i=Q[f*2];l=Q[f*2+1];j=Q[g*2];m=Q[g*2+1];g=Q[h*2];f=Q[h*2+1];h=Y.faceVertexUvs[0];var o=[];o.push(new THREE.UV(k,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(j,m));o.push(new THREE.UV(g,f));h.push(o)}}function H(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=k[d];
|
|
|
+Y.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function I(b,c,d){for(var e,f,g,h,k,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];k=i[d];Y.faces.push(new THREE.Face4(e,f,g,h,null,null,k))}}function N(b,c,d,e){for(var f,g,h,k,i,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[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];j=d[e*3+1];l=d[e*3+2];k=m[e];var n=G[j*3],o=G[j*3+1];j=G[j*3+2];var p=G[l*3],
|
|
|
+r=G[l*3+1];l=G[l*3+2];Y.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(G[i*3],G[i*3+1],G[i*3+2]),new THREE.Vector3(n,o,j),new THREE.Vector3(p,r,l)],null,k))}}function R(b,c,d,e){for(var f,g,h,k,i,j,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];k=c[e*4+3];j=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];i=o[e];var p=G[l*3],r=G[l*3+1];l=G[l*3+2];var q=G[m*3],s=G[m*3+1];m=G[m*3+2];var t=G[n*3],u=G[n*3+1];n=G[n*3+2];Y.faces.push(new THREE.Face4(f,
|
|
|
+g,h,k,[new THREE.Vector3(G[j*3],G[j*3+1],G[j*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,i))}}var Y=this,B=0,G=[],Q=[],D,k,P;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Y,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);i=F(a,B+17);j=F(a,B+18);l=F(a,B+19);o=C(a,B+20);m=C(a,B+20+4);p=C(a,B+20+8);b=C(a,B+20+12);r=
|
|
|
+C(a,B+20+16);n=C(a,B+20+20);q=C(a,B+20+24);s=C(a,B+20+28);u=C(a,B+20+32);w=C(a,B+20+36);t=C(a,B+20+40);B=B+c;c=e*3+l;P=e*4+l;D=b*c;k=r*(c+i*3);e=n*(c+j*3);l=q*(c+i*3+j*3);c=s*P;i=u*(P+i*4);j=w*(P+j*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Y.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];G.push(d/
|
|
|
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(m*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];Q.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);D=B+D+x(b*2);k=D+k+x(r*2);e=k+e+x(n*2);l=e+l+x(q*2);c=l+c+x(s*2);i=c+i+x(u*2);j=i+j+x(w*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(k);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
|
|
|
+q*Uint32Array.BYTES_PER_ELEMENT*3;N(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);z(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;I(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(i);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4,c=b+t*Uint32Array.BYTES_PER_ELEMENT*4;R(t,a,b,c+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,c)}})(j);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;N(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
3)}})(D);s&&I(s,l,l+s*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4;R(u,a,b,b+u*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
|
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.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+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
|
|
|
e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,k,l,o,m,p,r,n,q,s,u,w,t=a.faces;o=a.vertices;var x=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=o.length;k<l;){m=new THREE.Vector3;m.x=o[k++]*b;m.y=o[k++]*b;m.z=o[k++]*b;d.vertices.push(m)}k=0;for(l=t.length;k<l;){b=t[k++];o=b&1;i=b&2;c=b&
|
|
|
-4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=t[k++];q.b=t[k++];q.c=t[k++];q.d=t[k++];o=4}else{q=new THREE.Face3;q.a=t[k++];q.b=t[k++];q.c=t[k++];o=3}if(i){i=t[k++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<C;c++){s=a.uvs[c];r=t[k++];w=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(w,r)}if(e)for(c=0;c<C;c++){s=a.uvs[c];u=[];for(e=0;e<o;e++){r=t[k++];w=s[r*2];r=s[r*2+1];u[e]=new THREE.UV(w,r)}d.faceVertexUvs[c][i]=u}if(p){p=t[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
|
|
|
-e.z=x[p];q.normal=e}if(m)for(c=0;c<o;c++){p=t[k++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){m=t[k++];m=new THREE.Color(F[m]);q.color=m}if(b)for(c=0;c<o;c++){m=t[k++];m=new THREE.Color(F[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
|
|
|
-b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(k=o.length;i<k;i=i+3){var m=new THREE.Vector3;m.x=o[i]*b;m.y=o[i+1]*b;m.z=o[i+2]*b;l.push(m)}}}if(a.morphColors!==
|
|
|
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);k.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,l,o,m,p,r,n,q,s,u,w,t=a.faces;o=a.vertices;var x=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(l=o.length;j<l;){m=new THREE.Vector3;m.x=o[j++]*b;m.y=o[j++]*b;m.z=o[j++]*b;d.vertices.push(m)}j=0;for(l=t.length;j<l;){b=t[j++];o=b&1;i=b&2;c=b&
|
|
|
+4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=t[j++];q.b=t[j++];q.c=t[j++];q.d=t[j++];o=4}else{q=new THREE.Face3;q.a=t[j++];q.b=t[j++];q.c=t[j++];o=3}if(i){i=t[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<C;c++){s=a.uvs[c];r=t[j++];w=s[r*2];r=s[r*2+1];d.faceUvs[c][i]=new THREE.UV(w,r)}if(e)for(c=0;c<C;c++){s=a.uvs[c];u=[];for(e=0;e<o;e++){r=t[j++];w=s[r*2];r=s[r*2+1];u[e]=new THREE.UV(w,r)}d.faceVertexUvs[c][i]=u}if(p){p=t[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
|
|
|
+e.z=x[p];q.normal=e}if(m)for(c=0;c<o;c++){p=t[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){m=t[j++];m=new THREE.Color(F[m]);q.color=m}if(b)for(c=0;c<o;c++){m=t[j++];m=new THREE.Color(F[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
|
|
|
+b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(j=o.length;i<j;i=i+3){var m=new THREE.Vector3;m.x=o[i]*b;m.y=o[i+1]*b;m.z=o[i+2]*b;l.push(m)}}}if(a.morphColors!==
|
|
|
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);j.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
|
|
|
THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),e):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
|
|
|
-a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},k=function(a,d,e,f,g,k){a[d]=new THREE.Texture;a[d].sourceFile=
|
|
|
-e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(k){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[k[0]]!==void 0)a[d].wrapS=f[k[0]];if(f[k[1]]!==void 0)a[d].wrapT=f[k[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=i(a.height);l.image=document.createElement("canvas");l.image.width=
|
|
|
+a,true);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},j=function(a,d,e,f,g,j){a[d]=new THREE.Texture;a[d].sourceFile=
|
|
|
+e;if(f){a[d].repeat.set(f[0],f[1]);if(f[0]!=1)a[d].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(j){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[j[0]]!==void 0)a[d].wrapS=f[j[0]];if(f[j[1]]!==void 0)a[d].wrapT=f[j[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=i(a.height);l.image=document.createElement("canvas");l.image.width=
|
|
|
b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},l=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:g.wireframe};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o="MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)m.blending=
|
|
|
THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)m.transparent=g.transparent;if(g.depthTest!==void 0)m.depthTest=g.depthTest;if(g.depthWrite!==void 0)m.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(g.vertexColors)m.vertexColors=THREE.VertexColors;if(g.colorDiffuse)m.color=l(g.colorDiffuse);else if(g.DbgColor)m.color=g.DbgColor;if(g.colorSpecular)m.specular=l(g.colorSpecular);if(g.colorAmbient)m.ambient=l(g.colorAmbient);
|
|
|
-if(g.transparency)m.opacity=g.transparency;if(g.specularCoef)m.shininess=g.specularCoef;g.mapDiffuse&&k(m,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&k(m,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&k(m,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&k(m,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){k=THREE.ShaderUtils.lib.normal;
|
|
|
-l=THREE.UniformsUtils.clone(k.uniforms);l.tNormal.texture=m.normalMap;if(g.mapNormalFactor)l.uNormalScale.value=g.mapNormalFactor;if(m.map){l.tDiffuse.texture=m.map;l.enableDiffuse.value=true}if(m.specularMap){l.tSpecular.texture=m.specularMap;l.enableSpecular.value=true}if(m.lightMap){l.tAO.texture=m.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(m.color);l.uSpecularColor.value.setHex(m.specular);l.uAmbientColor.value.setHex(m.ambient);l.uShininess.value=m.shininess;if(m.opacity!==void 0)l.uOpacity.value=
|
|
|
-m.opacity;m=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:true,fog:true})}else m=new THREE[o](m);if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[f]=m}}var g=a.faces,r=a.vertices,m=a.normals,k=a.colors,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=r.length;o<p;){var n=new THREE.Vector3;n.x=r[o++]*e;n.y=r[o++]*e;n.z=r[o++]*e;d.vertices.push(n)}o=0;for(p=g.length;o<
|
|
|
+if(g.transparency)m.opacity=g.transparency;if(g.specularCoef)m.shininess=g.specularCoef;g.mapDiffuse&&j(m,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(m,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapNormal&&j(m,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(m,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){j=THREE.ShaderUtils.lib.normal;
|
|
|
+l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=m.normalMap;if(g.mapNormalFactor)l.uNormalScale.value=g.mapNormalFactor;if(m.map){l.tDiffuse.texture=m.map;l.enableDiffuse.value=true}if(m.specularMap){l.tSpecular.texture=m.specularMap;l.enableSpecular.value=true}if(m.lightMap){l.tAO.texture=m.lightMap;l.enableAO.value=true}l.uDiffuseColor.value.setHex(m.color);l.uSpecularColor.value.setHex(m.specular);l.uAmbientColor.value.setHex(m.ambient);l.uShininess.value=m.shininess;if(m.opacity!==void 0)l.uOpacity.value=
|
|
|
+m.opacity;m=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else m=new THREE[o](m);if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[f]=m}}var g=a.faces,r=a.vertices,m=a.normals,j=a.colors,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}o=0;for(p=r.length;o<p;){var n=new THREE.Vector3;n.x=r[o++]*e;n.y=r[o++]*e;n.z=r[o++]*e;d.vertices.push(n)}o=0;for(p=g.length;o<
|
|
|
p;){var q=g[o++],s=q&2,f=q&4,u=q&8,w=q&16,r=q&32,t=q&64,n=q&128;if(q&1){q=new THREE.Face4;q.a=g[o++];q.b=g[o++];q.c=g[o++];q.d=g[o++];var x=4}else{q=new THREE.Face3;q.a=g[o++];q.b=g[o++];q.c=g[o++];x=3}if(s){s=g[o++];q.materialIndex=s}var F=d.faces.length;if(f)for(f=0;f<l;f++){var C=a.uvs[f],s=g[o++],z=C[s*2],s=C[s*2+1];d.faceUvs[f][F]=new THREE.UV(z,s)}if(u)for(f=0;f<l;f++){for(var C=a.uvs[f],u=[],v=0;v<x;v++){s=g[o++];z=C[s*2];s=C[s*2+1];u[v]=new THREE.UV(z,s)}d.faceVertexUvs[f][F]=u}if(w){w=g[o++]*
|
|
|
-3;s=new THREE.Vector3;s.x=m[w++];s.y=m[w++];s.z=m[w];q.normal=s}if(r)for(f=0;f<x;f++){w=g[o++]*3;s=new THREE.Vector3;s.x=m[w++];s.y=m[w++];s.z=m[w];q.vertexNormals.push(s)}if(t){r=g[o++];q.color=new THREE.Color(k[r])}if(n)for(f=0;f<x;f++){r=g[o++];q.vertexColors.push(new THREE.Color(k[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+
|
|
|
-2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];m=d.morphTargets[f].vertices;k=a.morphTargets[f].vertices;s=0;for(l=k.length;s<l;s=s+3){n=new THREE.Vector3;n.x=k[s]*e;n.y=k[s+1]*e;n.z=k[s+2]*e;m.push(n)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]=
|
|
|
-{};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;k=a.morphColors[f].colors;m=0;for(l=k.length;m<l;m=m+3){o=new THREE.Color(16755200);o.setRGB(k[m],k[m+1],k[m+2]);e.push(o)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
+3;s=new THREE.Vector3;s.x=m[w++];s.y=m[w++];s.z=m[w];q.normal=s}if(r)for(f=0;f<x;f++){w=g[o++]*3;s=new THREE.Vector3;s.x=m[w++];s.y=m[w++];s.z=m[w];q.vertexNormals.push(s)}if(t){r=g[o++];q.color=new THREE.Color(j[r])}if(n)for(f=0;f<x;f++){r=g[o++];q.vertexColors.push(new THREE.Color(j[r]))}d.faces.push(q)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f=f+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f=f+
|
|
|
+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];m=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;s=0;for(l=j.length;s<l;s=s+3){n=new THREE.Vector3;n.x=j[s]*e;n.y=j[s+1]*e;n.z=j[s+2]*e;m.push(n)}}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]=
|
|
|
+{};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;j=a.morphColors[f].colors;m=0;for(l=j.length;m<l;m=m+3){o=new THREE.Color(16755200);o.setRGB(j[m],j[m+1],j[m+2]);e.push(o)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var 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,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in B.objects)if(!L.objects[m]){s=B.objects[m];if(s.geometry!==void 0){if(I=L.geometries[s.geometry]){a=false;N=L.materials[s.materials[0]];(a=N instanceof THREE.ShaderMaterial)&&I.computeTangents();x=s.position;F=s.rotation;C=s.quaternion;z=s.scale;u=s.matrix;C=0;s.materials.length==0&&(N=new THREE.MeshFaceMaterial);s.materials.length>1&&(N=new THREE.MeshFaceMaterial);
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(m in B.objects)if(!L.objects[m]){s=B.objects[m];if(s.geometry!==void 0){if(I=L.geometries[s.geometry]){a=false;N=L.materials[s.materials[0]];(a=N instanceof THREE.ShaderMaterial)&&I.computeTangents();x=s.position;F=s.rotation;C=s.quaternion;z=s.scale;u=s.matrix;C=0;s.materials.length==0&&(N=new THREE.MeshFaceMaterial);s.materials.length>1&&(N=new THREE.MeshFaceMaterial);
|
|
|
a=new THREE.Mesh(I,N);a.name=m;if(u){a.matrixAutoUpdate=false;a.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2])}a.visible=s.visible;a.doubleSided=s.doubleSided;a.castShadow=s.castShadow;a.receiveShadow=s.receiveShadow;L.scene.add(a);L.objects[m]=a}}else{x=s.position;F=s.rotation;C=s.quaternion;
|
|
|
-z=s.scale;C=0;a=new THREE.Object3D;a.name=m;a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;L.scene.add(a);L.objects[m]=a;L.empties[m]=a}}}function f(a){return function(b){L.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:P,loadedModels:j-
|
|
|
-Q,loadedTextures:P-D},L);i.onLoadProgress();Q===0&&D===0&&b(L)}var i=this,k=THREE.Loader.prototype.extractUrlBase(c),l,o,m,p,r,n,q,s,u,w,t,x,F,C,z,v,H,I,N,R,Y,B,G,Q,D,j,P,L;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;D=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;w=B.transform.rotation;v=B.transform.scale;a&&L.scene.position.set(a[0],a[1],a[2]);w&&L.scene.rotation.set(w[0],w[1],
|
|
|
+z=s.scale;C=0;a=new THREE.Object3D;a.name=m;a.position.set(x[0],x[1],x[2]);if(C){a.quaternion.set(C[0],C[1],C[2],C[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=s.visible!==void 0?s.visible:false;L.scene.add(a);L.objects[m]=a;L.empties[m]=a}}}function f(a){return function(b){L.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:k,totalTextures:P,loadedModels:k-
|
|
|
+Q,loadedTextures:P-D},L);i.onLoadProgress();Q===0&&D===0&&b(L)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,o,m,p,r,n,q,s,u,w,t,x,F,C,z,v,H,I,N,R,Y,B,G,Q,D,k,P,L;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;D=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;w=B.transform.rotation;v=B.transform.scale;a&&L.scene.position.set(a[0],a[1],a[2]);w&&L.scene.rotation.set(w[0],w[1],
|
|
|
w[2]);v&&L.scene.scale.set(v[0],v[1],v[2]);if(a||w||v){L.scene.updateMatrix();L.scene.updateMatrixWorld()}}a=function(a){return function(){D=D-a;h();i.onLoadComplete()}};for(r in B.cameras){v=B.cameras[r];v.type==="perspective"?R=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type==="ortho"&&(R=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));x=v.position;w=v.target;v=v.up;R.position.set(x[0],x[1],x[2]);R.target=new THREE.Vector3(w[0],w[1],w[2]);v&&R.up.set(v[0],
|
|
|
v[1],v[2]);L.cameras[r]=R}for(p in B.lights){w=B.lights[p];r=w.color!==void 0?w.color:16777215;R=w.intensity!==void 0?w.intensity:1;if(w.type==="directional"){x=w.direction;t=new THREE.DirectionalLight(r,R);t.position.set(x[0],x[1],x[2]);t.position.normalize()}else if(w.type==="point"){x=w.position;t=w.distance;t=new THREE.PointLight(r,R,t);t.position.set(x[0],x[1],x[2])}else w.type==="ambient"&&(t=new THREE.AmbientLight(r));L.scene.add(t);L.lights[p]=t}for(n in B.fogs){p=B.fogs[n];p.type==="linear"?
|
|
|
-Y=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(Y=new THREE.FogExp2(0,p.density));v=p.color;Y.color.setRGB(v[0],v[1],v[2]);L.fogs[n]=Y}if(L.cameras&&B.defaults.camera)L.currentCamera=L.cameras[B.defaults.camera];if(L.fogs&&B.defaults.fog)L.scene.fog=L.fogs[B.defaults.fog];v=B.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(v[0],v[1],v[2]);L.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){n=B.geometries[l];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}j=Q;
|
|
|
+Y=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(Y=new THREE.FogExp2(0,p.density));v=p.color;Y.color.setRGB(v[0],v[1],v[2]);L.fogs[n]=Y}if(L.cameras&&B.defaults.camera)L.currentCamera=L.cameras[B.defaults.camera];if(L.fogs&&B.defaults.fog)L.scene.fog=L.fogs[B.defaults.fog];v=B.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(v[0],v[1],v[2]);L.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){n=B.geometries[l];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}k=Q;
|
|
|
for(l in B.geometries){n=B.geometries[l];if(n.type==="cube"){I=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);L.geometries[l]=I}else if(n.type==="plane"){I=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);L.geometries[l]=I}else if(n.type==="sphere"){I=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);L.geometries[l]=I}else if(n.type==="cylinder"){I=new THREE.CylinderGeometry(n.topRad,
|
|
|
n.botRad,n.height,n.radSegs,n.heightSegs);L.geometries[l]=I}else if(n.type==="torus"){I=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);L.geometries[l]=I}else if(n.type==="icosahedron"){I=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);L.geometries[l]=I}else if(n.type==="bin_mesh")c.load(d(n.url,B.urlBaseType),f(l));else if(n.type==="ascii_mesh")G.load(d(n.url,B.urlBaseType),f(l));else if(n.type==="embedded_mesh"){n=B.embeds[n.id];n.metadata=B.metadata;n&&G.createModel(n,g(l),
|
|
|
"")}}for(q in B.textures){l=B.textures[q];if(l.url instanceof Array){D=D+l.url.length;for(n=0;n<l.url.length;n++)i.onLoadStart()}else{D=D+1;i.onLoadStart()}}P=D;for(q in B.textures){l=B.textures[q];if(l.mapping!==void 0&&THREE[l.mapping]!==void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){n=l.url.length;Y=[];for(c=0;c<n;c++)Y[c]=d(l.url[c],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(Y,l.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a(1));if(THREE[l.minFilter]!==
|
|
@@ -208,7 +208,7 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
|
|
|
THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:false;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=
|
|
|
a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
|
THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
|
|
|
-true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k){THREE.Texture.call(this,null,f,g,h,i,k,d,e);this.image={data:a,width:b,height:c}};
|
|
|
+true;this.premultiplyAlpha=false;this.flipY=true;this.needsUpdate=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j){THREE.Texture.call(this,null,f,g,h,i,j,d,e);this.image={data:a,width:b,height:c}};
|
|
|
THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -238,36 +238,36 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=n.globalAlpha=a}function c(a){if(w!==a){if(a===THREE.NormalBlending)n.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)n.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)n.globalCompositeOperation="darker";w=a}}function d(a){if(t!==a)t=n.strokeStyle=a}function e(a){if(x!==a)x=n.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,k=new THREE.Projector,l=a.canvas!==
|
|
|
-void 0?a.canvas:document.createElement("canvas"),o,m,p,r,n=l.getContext("2d"),q=new THREE.Color(0),s=0,u=1,w=0,t=null,x=null,F=null,C=null,z=null,v,H,I,N,R=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,B,G,Q,D,j,P,L,S,aa,K,ca,ha,O=new THREE.Color,Z=new THREE.Color,$=new THREE.Color,X=new THREE.Color,ia=new THREE.Color,ya=[],Ia=[],Pa,Qa,Ua,fb,gb,$a,ob,kb,pb,hb,bb=new THREE.Rectangle,Ca=new THREE.Rectangle,za=new THREE.Rectangle,lb=false,wa=new THREE.Color,Ra=new THREE.Color,Fa=new THREE.Color,
|
|
|
-ja=new THREE.Vector3,qb,ab,bc,ga,qc,Cc,a=16;qb=document.createElement("canvas");qb.width=qb.height=2;ab=qb.getContext("2d");ab.fillStyle="rgba(0,0,0,1)";ab.fillRect(0,0,2,2);bc=ab.getImageData(0,0,2,2);ga=bc.data;qc=document.createElement("canvas");qc.width=qc.height=a;Cc=qc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);
|
|
|
-r=Math.floor(m/2);l.width=o;l.height=m;bb.set(-p,-r,p,r);Ca.set(-p,-r,p,r);u=1;w=0;z=C=F=x=t=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Ca.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Ca.set(-p,-r,p,r)};this.clear=function(){n.setTransform(1,0,0,-1,p,r);if(Ca.isEmpty()===false){Ca.minSelf(bb);Ca.inflate(2);s<1&&n.clearRect(Math.floor(Ca.getX()),Math.floor(Ca.getY()),Math.floor(Ca.getWidth()),Math.floor(Ca.getHeight()));if(s>0){c(THREE.NormalBlending);
|
|
|
-b(1);e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")");n.fillRect(Math.floor(Ca.getX()),Math.floor(Ca.getY()),Math.floor(Ca.getWidth()),Math.floor(Ca.getHeight()))}Ca.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;wa.setRGB(0,0,0);Ra.setRGB(0,0,0);Fa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){wa.r=wa.r+e.r;wa.g=wa.g+e.g;wa.b=wa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ra.r=Ra.r+e.r;
|
|
|
-Ra.g=Ra.g+e.g;Ra.b=Ra.b+e.b}else if(d instanceof THREE.PointLight){Fa.r=Fa.r+e.r;Fa.g=Fa.g+e.g;Fa.b=Fa.b+e.b}}}function o(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();i=c.dot(j);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();i=c.dot(ja.sub(j,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(j)/
|
|
|
-g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,j,i,l,k,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map!==null){l=g.map.image;k=l.width>>1;m=l.height>>1;g=f.scale.x*p;i=f.scale.y*r;h=g*k;j=i*m;za.set(a.x-h,a.y-j,a.x+h,a.y+j);if(bb.intersects(za)!==false){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-k,-m);n.drawImage(l,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
|
|
|
-f.scale.x*p;j=f.scale.y*r;za.set(a.x-h,a.y-j,a.x+h,a.y+j);if(bb.intersects(za)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(h,j);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!==a)F=n.lineWidth=a;a=g.linecap;
|
|
|
-if(C!==a)C=n.lineCap=a;a=g.linejoin;if(z!==a)z=n.lineJoin=a;d(g.color.getContextStyle());n.stroke();za.inflate(g.linewidth*2)}}function t(a,d,e,g,h,k,m,n){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(n.opacity);c(n.blending);B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;D=d.positionScreen.y;j=e.positionScreen.x;P=e.positionScreen.y;w(B,G,Q,D,j,P);if(n instanceof THREE.MeshBasicMaterial)if(n.map!==null){if(n.map.mapping instanceof THREE.UVMapping){fb=m.uvs[0];
|
|
|
-bd(B,G,Q,D,j,P,fb[g].u,fb[g].v,fb[h].u,fb[h].v,fb[k].u,fb[k].v,n.map)}}else if(n.envMap!==null){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ja.copy(m.vertexNormalsWorld[g]);gb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;$a=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;ja.copy(m.vertexNormalsWorld[h]);ob=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;kb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+
|
|
|
-ja.z*a.elements[9])*0.5+0.5;ja.copy(m.vertexNormalsWorld[k]);pb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;hb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;bd(B,G,Q,D,j,P,gb,$a,ob,kb,pb,hb,n.envMap)}}else n.wireframe===true?Nb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(n.color);else if(n instanceof THREE.MeshLambertMaterial)if(lb===true)if(n.wireframe===false&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){Z.r=
|
|
|
-$.r=X.r=wa.r;Z.g=$.g=X.g=wa.g;Z.b=$.b=X.b=wa.b;o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Z);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$);o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],X);Z.r=Math.max(0,Math.min(n.color.r*Z.r,1));Z.g=Math.max(0,Math.min(n.color.g*Z.g,1));Z.b=Math.max(0,Math.min(n.color.b*Z.b,1));$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));X.r=Math.max(0,Math.min(n.color.r*X.r,1));X.g=Math.max(0,
|
|
|
-Math.min(n.color.g*X.g,1));X.b=Math.max(0,Math.min(n.color.b*X.b,1));ia.r=($.r+X.r)*0.5;ia.g=($.g+X.g)*0.5;ia.b=($.b+X.b)*0.5;Ua=Dc(Z,$,X,ia);ic(B,G,Q,D,j,P,0,0,1,0,0,1,Ua)}else{O.r=wa.r;O.g=wa.g;O.b=wa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));n.wireframe===true?Nb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(O)}else n.wireframe===true?Nb(n.color,n.wireframeLinewidth,
|
|
|
-n.wireframeLinecap,n.wireframeLinejoin):Hb(n.color);else if(n instanceof THREE.MeshDepthMaterial){Pa=l.near;Qa=l.far;Z.r=Z.g=Z.b=1-cc(a.positionScreen.z,Pa,Qa);$.r=$.g=$.b=1-cc(d.positionScreen.z,Pa,Qa);X.r=X.g=X.b=1-cc(e.positionScreen.z,Pa,Qa);ia.r=($.r+X.r)*0.5;ia.g=($.g+X.g)*0.5;ia.b=($.b+X.b)*0.5;Ua=Dc(Z,$,X,ia);ic(B,G,Q,D,j,P,0,0,1,0,0,1,Ua)}else if(n instanceof THREE.MeshNormalMaterial){O.r=jc(m.normalWorld.x);O.g=jc(m.normalWorld.y);O.b=jc(m.normalWorld.z);n.wireframe===true?Nb(O,n.wireframeLinewidth,
|
|
|
-n.wireframeLinecap,n.wireframeLinejoin):Hb(O)}}function u(a,d,e,g,h,k,m,n,ga){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(n.opacity);c(n.blending);if(n.map!==null||n.envMap!==null){t(a,d,g,0,1,3,m,n,ga);t(h,e,k,1,2,3,m,n,ga)}else{B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;D=d.positionScreen.y;j=e.positionScreen.x;P=e.positionScreen.y;L=g.positionScreen.x;S=g.positionScreen.y;aa=h.positionScreen.x;K=h.positionScreen.y;ca=k.positionScreen.x;ha=k.positionScreen.y;
|
|
|
-if(n instanceof THREE.MeshBasicMaterial){x(B,G,Q,D,j,P,L,S);n.wireframe===true?Nb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(n.color)}else if(n instanceof THREE.MeshLambertMaterial)if(lb===true)if(!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4){Z.r=$.r=X.r=ia.r=wa.r;Z.g=$.g=X.g=ia.g=wa.g;Z.b=$.b=X.b=ia.b=wa.b;o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Z);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$);o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=n.globalAlpha=a}function c(a){if(w!==a){if(a===THREE.NormalBlending)n.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)n.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)n.globalCompositeOperation="darker";w=a}}function d(a){if(t!==a)t=n.strokeStyle=a}function e(a){if(x!==a)x=n.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=a.canvas!==
|
|
|
+void 0?a.canvas:document.createElement("canvas"),o,m,p,r,n=l.getContext("2d"),q=new THREE.Color(0),s=0,u=1,w=0,t=null,x=null,F=null,C=null,z=null,v,H,I,N,R=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,B,G,Q,D,k,P,L,S,aa,K,ca,ha,O=new THREE.Color,Z=new THREE.Color,$=new THREE.Color,X=new THREE.Color,ia=new THREE.Color,za=[],Ga=[],Oa,Pa,Ta,Wa,lb,$a,mb,Fb,ab,nb,bb=new THREE.Rectangle,Ha=new THREE.Rectangle,wa=new THREE.Rectangle,ib=false,xa=new THREE.Color,Qa=new THREE.Color,Da=new THREE.Color,
|
|
|
+ja=new THREE.Vector3,ob,fb,bc,ga,rc,Gc,a=16;ob=document.createElement("canvas");ob.width=ob.height=2;fb=ob.getContext("2d");fb.fillStyle="rgba(0,0,0,1)";fb.fillRect(0,0,2,2);bc=fb.getImageData(0,0,2,2);ga=bc.data;rc=document.createElement("canvas");rc.width=rc.height=a;Gc=rc.getContext("2d");Gc.translate(-a/2,-a/2);Gc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);
|
|
|
+r=Math.floor(m/2);l.width=o;l.height=m;bb.set(-p,-r,p,r);Ha.set(-p,-r,p,r);u=1;w=0;z=C=F=x=t=null};this.setClearColor=function(a,b){q.copy(a);s=b!==void 0?b:1;Ha.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b!==void 0?b:1;Ha.set(-p,-r,p,r)};this.clear=function(){n.setTransform(1,0,0,-1,p,r);if(Ha.isEmpty()===false){Ha.minSelf(bb);Ha.inflate(2);s<1&&n.clearRect(Math.floor(Ha.getX()),Math.floor(Ha.getY()),Math.floor(Ha.getWidth()),Math.floor(Ha.getHeight()));if(s>0){c(THREE.NormalBlending);
|
|
|
+b(1);e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")");n.fillRect(Math.floor(Ha.getX()),Math.floor(Ha.getY()),Math.floor(Ha.getWidth()),Math.floor(Ha.getHeight()))}Ha.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;xa.setRGB(0,0,0);Qa.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){xa.r=xa.r+e.r;xa.g=xa.g+e.g;xa.b=xa.b+e.b}else if(d instanceof THREE.DirectionalLight){Qa.r=Qa.r+e.r;
|
|
|
+Qa.g=Qa.g+e.g;Qa.b=Qa.b+e.b}else if(d instanceof THREE.PointLight){Da.r=Da.r+e.r;Da.g=Da.g+e.g;Da.b=Da.b+e.b}}}function o(a,b,c,d){var e,f,g,h,k,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition();i=c.dot(k);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();i=c.dot(ja.sub(k,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
|
|
|
+g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,k,i,l,j,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map!==null){l=g.map.image;j=l.width>>1;m=l.height>>1;g=f.scale.x*p;i=f.scale.y*r;h=g*j;k=i*m;wa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(wa)!==false){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-j,-m);n.drawImage(l,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
|
|
|
+f.scale.x*p;k=f.scale.y*r;wa.set(a.x-h,a.y-k,a.x+h,a.y+k);if(bb.intersects(wa)!==false){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(h,k);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!==a)F=n.lineWidth=a;a=g.linecap;
|
|
|
+if(C!==a)C=n.lineCap=a;a=g.linejoin;if(z!==a)z=n.lineJoin=a;d(g.color.getContextStyle());n.stroke();wa.inflate(g.linewidth*2)}}function t(a,d,e,g,h,j,m,n){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(n.opacity);c(n.blending);B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;D=d.positionScreen.y;k=e.positionScreen.x;P=e.positionScreen.y;w(B,G,Q,D,k,P);if(n instanceof THREE.MeshBasicMaterial)if(n.map!==null){if(n.map.mapping instanceof THREE.UVMapping){Wa=m.uvs[0];
|
|
|
+kd(B,G,Q,D,k,P,Wa[g].u,Wa[g].v,Wa[h].u,Wa[h].v,Wa[j].u,Wa[j].v,n.map)}}else if(n.envMap!==null){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ja.copy(m.vertexNormalsWorld[g]);lb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;$a=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;ja.copy(m.vertexNormalsWorld[h]);mb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;Fb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+
|
|
|
+ja.z*a.elements[9])*0.5+0.5;ja.copy(m.vertexNormalsWorld[j]);ab=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;nb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;kd(B,G,Q,D,k,P,lb,$a,mb,Fb,ab,nb,n.envMap)}}else n.wireframe===true?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color);else if(n instanceof THREE.MeshLambertMaterial)if(ib===true)if(n.wireframe===false&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){Z.r=
|
|
|
+$.r=X.r=xa.r;Z.g=$.g=X.g=xa.g;Z.b=$.b=X.b=xa.b;o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Z);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$);o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],X);Z.r=Math.max(0,Math.min(n.color.r*Z.r,1));Z.g=Math.max(0,Math.min(n.color.g*Z.g,1));Z.b=Math.max(0,Math.min(n.color.b*Z.b,1));$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));X.r=Math.max(0,Math.min(n.color.r*X.r,1));X.g=Math.max(0,
|
|
|
+Math.min(n.color.g*X.g,1));X.b=Math.max(0,Math.min(n.color.b*X.b,1));ia.r=($.r+X.r)*0.5;ia.g=($.g+X.g)*0.5;ia.b=($.b+X.b)*0.5;Ta=Hc(Z,$,X,ia);ic(B,G,Q,D,k,P,0,0,1,0,0,1,Ta)}else{O.r=xa.r;O.g=xa.g;O.b=xa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));n.wireframe===true?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(O)}else n.wireframe===true?Mb(n.color,n.wireframeLinewidth,
|
|
|
+n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color);else if(n instanceof THREE.MeshDepthMaterial){Oa=l.near;Pa=l.far;Z.r=Z.g=Z.b=1-cc(a.positionScreen.z,Oa,Pa);$.r=$.g=$.b=1-cc(d.positionScreen.z,Oa,Pa);X.r=X.g=X.b=1-cc(e.positionScreen.z,Oa,Pa);ia.r=($.r+X.r)*0.5;ia.g=($.g+X.g)*0.5;ia.b=($.b+X.b)*0.5;Ta=Hc(Z,$,X,ia);ic(B,G,Q,D,k,P,0,0,1,0,0,1,Ta)}else if(n instanceof THREE.MeshNormalMaterial){O.r=jc(m.normalWorld.x);O.g=jc(m.normalWorld.y);O.b=jc(m.normalWorld.z);n.wireframe===true?Mb(O,n.wireframeLinewidth,
|
|
|
+n.wireframeLinecap,n.wireframeLinejoin):Gb(O)}}function u(a,d,e,g,h,j,m,n,ga){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(n.opacity);c(n.blending);if(n.map!==null||n.envMap!==null){t(a,d,g,0,1,3,m,n,ga);t(h,e,j,1,2,3,m,n,ga)}else{B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;D=d.positionScreen.y;k=e.positionScreen.x;P=e.positionScreen.y;L=g.positionScreen.x;S=g.positionScreen.y;aa=h.positionScreen.x;K=h.positionScreen.y;ca=j.positionScreen.x;ha=j.positionScreen.y;
|
|
|
+if(n instanceof THREE.MeshBasicMaterial){x(B,G,Q,D,k,P,L,S);n.wireframe===true?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color)}else if(n instanceof THREE.MeshLambertMaterial)if(ib===true)if(!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4){Z.r=$.r=X.r=ia.r=xa.r;Z.g=$.g=X.g=ia.g=xa.g;Z.b=$.b=X.b=ia.b=xa.b;o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Z);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$);o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],
|
|
|
X);o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia);Z.r=Math.max(0,Math.min(n.color.r*Z.r,1));Z.g=Math.max(0,Math.min(n.color.g*Z.g,1));Z.b=Math.max(0,Math.min(n.color.b*Z.b,1));$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));X.r=Math.max(0,Math.min(n.color.r*X.r,1));X.g=Math.max(0,Math.min(n.color.g*X.g,1));X.b=Math.max(0,Math.min(n.color.b*X.b,1));ia.r=Math.max(0,Math.min(n.color.r*ia.r,1));ia.g=Math.max(0,Math.min(n.color.g*
|
|
|
-ia.g,1));ia.b=Math.max(0,Math.min(n.color.b*ia.b,1));Ua=Dc(Z,$,X,ia);w(B,G,Q,D,L,S);ic(B,G,Q,D,L,S,0,0,1,0,0,1,Ua);w(aa,K,j,P,ca,ha);ic(aa,K,j,P,ca,ha,1,0,1,1,0,1,Ua)}else{O.r=wa.r;O.g=wa.g;O.b=wa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));x(B,G,Q,D,j,P,L,S);n.wireframe===true?Nb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(O)}else{x(B,G,Q,D,j,P,L,S);n.wireframe===
|
|
|
-true?Nb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(n.color)}else if(n instanceof THREE.MeshNormalMaterial){O.r=jc(m.normalWorld.x);O.g=jc(m.normalWorld.y);O.b=jc(m.normalWorld.z);x(B,G,Q,D,j,P,L,S);n.wireframe===true?Nb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Hb(O)}else if(n instanceof THREE.MeshDepthMaterial){Pa=l.near;Qa=l.far;Z.r=Z.g=Z.b=1-cc(a.positionScreen.z,Pa,Qa);$.r=$.g=$.b=1-cc(d.positionScreen.z,Pa,Qa);X.r=X.g=X.b=1-cc(g.positionScreen.z,
|
|
|
-Pa,Qa);ia.r=ia.g=ia.b=1-cc(e.positionScreen.z,Pa,Qa);Ua=Dc(Z,$,X,ia);w(B,G,Q,D,L,S);ic(B,G,Q,D,L,S,0,0,1,0,0,1,Ua);w(aa,K,j,P,ca,ha);ic(aa,K,j,P,ca,ha,1,0,1,1,0,1,Ua)}}}function w(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Nb(a,b,c,e){if(F!==b)F=n.lineWidth=b;if(C!==c)C=n.lineCap=c;if(z!==e)z=n.lineJoin=e;d(a.getContextStyle());n.stroke();
|
|
|
-za.inflate(b*2)}function Hb(a){e(a.getContextStyle());n.fill()}function bd(a,b,c,d,f,g,h,j,i,k,l,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||ya[o.id]===void 0){var ga=o.wrapS==THREE.RepeatWrapping,p=o.wrapT==THREE.RepeatWrapping;ya[o.id]=n.createPattern(o.image,ga===true&&p===true?"repeat":ga===true&&p===false?"repeat-x":ga===false&&p===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(ya[o.id]);var ga=o.offset.x/o.repeat.x,p=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
|
|
|
-q=o.image.height*o.repeat.y,h=(h+ga)*r,j=(j+p)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+ga)*r-h,k=(k+p)*q-j,l=(l+ga)*r-h,m=(m+p)*q-j,ga=i*m-l*k;if(ga===0){if(Ia[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);Ia[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Ia[o.id];h=(Math.floor(h)+Math.floor(j)*o.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Hb(O)}else{ga=1/ga;o=(m*c-k*f)*ga;k=(m*d-k*g)*
|
|
|
-ga;c=(i*f-l*c)*ga;d=(i*g-l*d)*ga;a=a-o*h-c*j;h=b-k*h-d*j;n.save();n.transform(o,k,c,d,a,h);n.fill();n.restore()}}}function ic(a,b,c,d,e,f,g,h,j,i,k,l,m){var o,ga;o=m.width-1;ga=m.height-1;g=g*o;h=h*ga;c=c-a;d=d-b;e=e-a;f=f-b;j=j*o-g;i=i*ga-h;k=k*o-g;l=l*ga-h;ga=1/(j*l-k*i);o=(l*c-i*e)*ga;i=(l*d-i*f)*ga;c=(j*e-k*c)*ga;d=(j*f-k*d)*ga;a=a-o*g-c*h;b=b-i*g-d*h;n.save();n.transform(o,i,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=
|
|
|
-~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ga[0]=e<0?0:e>255?255:e;ga[1]=f<0?0:f>255?255:f;ga[2]=a<0?0:a>255?255:a;ga[4]=g<0?0:g>255?255:g;ga[5]=h<0?0:h>255?255:h;ga[6]=b<0?0:b>255?255:b;ga[8]=j<0?0:j>255?255:j;ga[9]=i<0?0:i>255?255:i;ga[10]=c<0?0:c>255?255:c;ga[12]=k<0?0:k>255?255:k;ga[13]=l<0?0:l>255?255:l;ga[14]=d<0?0:d>255?255:d;ab.putImageData(bc,0,0);Cc.drawImage(qb,0,0);return qc}function cc(a,b,c){a=(a-b)/(c-
|
|
|
-b);return a*a*(3-2*a)}function jc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ob(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ma,ib;this.autoClear===true?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;lb=i.length>0;lb===true&&m(i);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ma=h[Ec];ib=Ma.material;ib=ib instanceof THREE.MeshFaceMaterial?
|
|
|
-Ma.faceMaterial:ib;if(!(ib===void 0||ib.visible===false)){za.empty();if(Ma instanceof THREE.RenderableParticle){v=Ma;v.x=v.x*p;v.y=v.y*r;q(v,Ma,ib,a)}else if(Ma instanceof THREE.RenderableLine){v=Ma.v1;H=Ma.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;za.addPoint(v.positionScreen.x,v.positionScreen.y);za.addPoint(H.positionScreen.x,H.positionScreen.y);bb.intersects(za)===true&&s(v,
|
|
|
-H,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace3){v=Ma.v1;H=Ma.v2;I=Ma.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;if(ib.overdraw===true){Ob(v.positionScreen,H.positionScreen);Ob(H.positionScreen,I.positionScreen);Ob(I.positionScreen,v.positionScreen)}za.add3Points(v.positionScreen.x,v.positionScreen.y,
|
|
|
-H.positionScreen.x,H.positionScreen.y,I.positionScreen.x,I.positionScreen.y);bb.intersects(za)===true&&t(v,H,I,0,1,2,Ma,ib,a)}else if(Ma instanceof THREE.RenderableFace4){v=Ma.v1;H=Ma.v2;I=Ma.v3;N=Ma.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;N.positionScreen.x=N.positionScreen.x*p;N.positionScreen.y=
|
|
|
-N.positionScreen.y*r;R.positionScreen.copy(H.positionScreen);Y.positionScreen.copy(N.positionScreen);if(ib.overdraw===true){Ob(v.positionScreen,H.positionScreen);Ob(H.positionScreen,N.positionScreen);Ob(N.positionScreen,v.positionScreen);Ob(I.positionScreen,R.positionScreen);Ob(I.positionScreen,Y.positionScreen)}za.addPoint(v.positionScreen.x,v.positionScreen.y);za.addPoint(H.positionScreen.x,H.positionScreen.y);za.addPoint(I.positionScreen.x,I.positionScreen.y);za.addPoint(N.positionScreen.x,N.positionScreen.y);
|
|
|
-bb.intersects(za)===true&&u(v,H,I,N,R,Y,Ma,ib,a)}Ca.addRectangle(za)}}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+ia.g,1));ia.b=Math.max(0,Math.min(n.color.b*ia.b,1));Ta=Hc(Z,$,X,ia);w(B,G,Q,D,L,S);ic(B,G,Q,D,L,S,0,0,1,0,0,1,Ta);w(aa,K,k,P,ca,ha);ic(aa,K,k,P,ca,ha,1,0,1,1,0,1,Ta)}else{O.r=xa.r;O.g=xa.g;O.b=xa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));x(B,G,Q,D,k,P,L,S);n.wireframe===true?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(O)}else{x(B,G,Q,D,k,P,L,S);n.wireframe===
|
|
|
+true?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color)}else if(n instanceof THREE.MeshNormalMaterial){O.r=jc(m.normalWorld.x);O.g=jc(m.normalWorld.y);O.b=jc(m.normalWorld.z);x(B,G,Q,D,k,P,L,S);n.wireframe===true?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(O)}else if(n instanceof THREE.MeshDepthMaterial){Oa=l.near;Pa=l.far;Z.r=Z.g=Z.b=1-cc(a.positionScreen.z,Oa,Pa);$.r=$.g=$.b=1-cc(d.positionScreen.z,Oa,Pa);X.r=X.g=X.b=1-cc(g.positionScreen.z,
|
|
|
+Oa,Pa);ia.r=ia.g=ia.b=1-cc(e.positionScreen.z,Oa,Pa);Ta=Hc(Z,$,X,ia);w(B,G,Q,D,L,S);ic(B,G,Q,D,L,S,0,0,1,0,0,1,Ta);w(aa,K,k,P,ca,ha);ic(aa,K,k,P,ca,ha,1,0,1,1,0,1,Ta)}}}function w(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function x(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Mb(a,b,c,e){if(F!==b)F=n.lineWidth=b;if(C!==c)C=n.lineCap=c;if(z!==e)z=n.lineJoin=e;d(a.getContextStyle());n.stroke();
|
|
|
+wa.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function kd(a,b,c,d,f,g,h,k,i,j,l,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||za[o.id]===void 0){var ga=o.wrapS==THREE.RepeatWrapping,p=o.wrapT==THREE.RepeatWrapping;za[o.id]=n.createPattern(o.image,ga===true&&p===true?"repeat":ga===true&&p===false?"repeat-x":ga===false&&p===true?"repeat-y":"no-repeat");o.needsUpdate=false}e(za[o.id]);var ga=o.offset.x/o.repeat.x,p=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,
|
|
|
+q=o.image.height*o.repeat.y,h=(h+ga)*r,k=(k+p)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+ga)*r-h,j=(j+p)*q-k,l=(l+ga)*r-h,m=(m+p)*q-k,ga=i*m-l*j;if(ga===0){if(Ga[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);Ga[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Ga[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(O)}else{ga=1/ga;o=(m*c-j*f)*ga;j=(m*d-j*g)*
|
|
|
+ga;c=(i*f-l*c)*ga;d=(i*g-l*d)*ga;a=a-o*h-c*k;h=b-j*h-d*k;n.save();n.transform(o,j,c,d,a,h);n.fill();n.restore()}}}function ic(a,b,c,d,e,f,g,h,k,i,j,l,m){var o,ga;o=m.width-1;ga=m.height-1;g=g*o;h=h*ga;c=c-a;d=d-b;e=e-a;f=f-b;k=k*o-g;i=i*ga-h;j=j*o-g;l=l*ga-h;ga=1/(k*l-j*i);o=(l*c-i*e)*ga;i=(l*d-i*f)*ga;c=(k*e-j*c)*ga;d=(k*f-j*d)*ga;a=a-o*g-c*h;b=b-i*g-d*h;n.save();n.transform(o,i,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Hc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=
|
|
|
+~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ga[0]=e<0?0:e>255?255:e;ga[1]=f<0?0:f>255?255:f;ga[2]=a<0?0:a>255?255:a;ga[4]=g<0?0:g>255?255:g;ga[5]=h<0?0:h>255?255:h;ga[6]=b<0?0:b>255?255:b;ga[8]=k<0?0:k>255?255:k;ga[9]=i<0?0:i>255?255:i;ga[10]=c<0?0:c>255?255:c;ga[12]=j<0?0:j>255?255:j;ga[13]=l<0?0:l>255?255:l;ga[14]=d<0?0:d>255?255:d;fb.putImageData(bc,0,0);Gc.drawImage(ob,0,0);return rc}function cc(a,b,c){a=(a-b)/(c-
|
|
|
+b);return a*a*(3-2*a)}function jc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!==0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ic,ld,La,gb;this.autoClear===true?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;ib=i.length>0;ib===true&&m(i);Ic=0;for(ld=h.length;Ic<ld;Ic++){La=h[Ic];gb=La.material;gb=gb instanceof THREE.MeshFaceMaterial?
|
|
|
+La.faceMaterial:gb;if(!(gb===void 0||gb.visible===false)){wa.empty();if(La instanceof THREE.RenderableParticle){v=La;v.x=v.x*p;v.y=v.y*r;q(v,La,gb,a)}else if(La instanceof THREE.RenderableLine){v=La.v1;H=La.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;wa.addPoint(v.positionScreen.x,v.positionScreen.y);wa.addPoint(H.positionScreen.x,H.positionScreen.y);bb.intersects(wa)===true&&s(v,
|
|
|
+H,La,gb,a)}else if(La instanceof THREE.RenderableFace3){v=La.v1;H=La.v2;I=La.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;if(gb.overdraw===true){Nb(v.positionScreen,H.positionScreen);Nb(H.positionScreen,I.positionScreen);Nb(I.positionScreen,v.positionScreen)}wa.add3Points(v.positionScreen.x,v.positionScreen.y,
|
|
|
+H.positionScreen.x,H.positionScreen.y,I.positionScreen.x,I.positionScreen.y);bb.intersects(wa)===true&&t(v,H,I,0,1,2,La,gb,a)}else if(La instanceof THREE.RenderableFace4){v=La.v1;H=La.v2;I=La.v3;N=La.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;N.positionScreen.x=N.positionScreen.x*p;N.positionScreen.y=
|
|
|
+N.positionScreen.y*r;R.positionScreen.copy(H.positionScreen);Y.positionScreen.copy(N.positionScreen);if(gb.overdraw===true){Nb(v.positionScreen,H.positionScreen);Nb(H.positionScreen,N.positionScreen);Nb(N.positionScreen,v.positionScreen);Nb(I.positionScreen,R.positionScreen);Nb(I.positionScreen,Y.positionScreen)}wa.addPoint(v.positionScreen.x,v.positionScreen.y);wa.addPoint(H.positionScreen.x,H.positionScreen.y);wa.addPoint(I.positionScreen.x,I.positionScreen.y);wa.addPoint(N.positionScreen.x,N.positionScreen.y);
|
|
|
+bb.intersects(wa)===true&&u(v,H,I,N,R,Y,La,gb,a)}Ha.addRectangle(wa)}}n.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
|
|
|
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
@@ -304,139 +304,140 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.Shader
|
|
|
THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
|
|
|
THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
|
|
|
THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
|
|
|
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
|
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
|
-var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){wa.copy(lb);wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];Ra.copy(e);wa.multiplyVector3(Ra);n[d]=[Ra.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=i[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];
|
|
|
+var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){xa.copy(ib);xa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];Qa.copy(e);xa.multiplyVector3(Qa);n[d]=[Qa.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=i[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];
|
|
|
if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=n[d][1];
|
|
|
-g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<k;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
|
|
|
-3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-m,b)}if(r){i=0;for(k=r.length;i<k;i++){h=r[i];if(h.needsUpdate||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,h.buffer);j.bufferData(j.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ha=S=null;K=ca=$=Z=Qa=Pa=X=-1;ja=true;a[d].render(b,c,bb,Ca);ha=S=null;K=ca=$=Z=Qa=Pa=X=-1;ja=true}}function k(a,b,c,d,e,f,g,h){var j,i,k,l;if(b){i=a.length-1;l=b=-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){j=
|
|
|
-a[m];if(j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&D.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);D.setDepthTest(j.depthTest);D.setDepthWrite(j.depthWrite);u(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}D.setObjectFaces(i);k instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,j,k,i):D.renderBuffer(d,e,f,j,k,i)}}}function l(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++){h=a[i];j=h.object;if(j.visible){if(g)h=g;else{h=h[b];if(!h)continue;
|
|
|
-f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,j)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
|
|
|
-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var f=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==S){j.useProgram(g);S=g;f=true}if(d.id!==K){K=d.id;f=true}if(f||a!==ha){j.uniformMatrix4fv(h.projectionMatrix,
|
|
|
-false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(f){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ja){for(var k,l=0,m=0,n=0,o,p,r,q=qb,s=q.directional.colors,u=q.directional.positions,v=q.point.colors,w=q.point.positions,x=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
|
|
|
-Z=q.spot.directions,I=q.spot.angles,G=q.spot.exponents,N=0,X=0,L=0,O=r=0,c=O=0,f=b.length;c<f;c++){k=b[c];if(!k.onlyShadow&&k.visible){o=k.color;p=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(D.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(k instanceof THREE.DirectionalLight){r=N*3;if(D.gammaInput){s[r]=o.r*o.r*p*p;s[r+1]=o.g*o.g*p*p;s[r+2]=o.b*o.b*p*p}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}Fa.copy(k.matrixWorld.getPosition());Fa.subSelf(k.target.matrixWorld.getPosition());
|
|
|
-Fa.normalize();u[r]=Fa.x;u[r+1]=Fa.y;u[r+2]=Fa.z;N=N+1}else if(k instanceof THREE.PointLight){O=X*3;if(D.gammaInput){v[O]=o.r*o.r*p*p;v[O+1]=o.g*o.g*p*p;v[O+2]=o.b*o.b*p*p}else{v[O]=o.r*p;v[O+1]=o.g*p;v[O+2]=o.b*p}o=k.matrixWorld.getPosition();w[O]=o.x;w[O+1]=o.y;w[O+2]=o.z;x[X]=r;X=X+1}else if(k instanceof THREE.SpotLight){O=L*3;if(D.gammaInput){F[O]=o.r*o.r*p*p;F[O+1]=o.g*o.g*p*p;F[O+2]=o.b*o.b*p*p}else{F[O]=o.r*p;F[O+1]=o.g*p;F[O+2]=o.b*p}o=k.matrixWorld.getPosition();B[O]=o.x;B[O+1]=o.y;B[O+2]=
|
|
|
-o.z;H[L]=r;Fa.copy(o);Fa.subSelf(k.target.matrixWorld.getPosition());Fa.normalize();Z[O]=Fa.x;Z[O+1]=Fa.y;Z[O+2]=Fa.z;I[L]=Math.cos(k.angle);G[L]=k.exponent;L=L+1}}}c=N*3;for(f=s.length;c<f;c++)s[c]=0;c=X*3;for(f=v.length;c<f;c++)v[c]=0;c=L*3;for(f=F.length;c<f;c++)F[c]=0;q.directional.length=N;q.point.length=X;q.spot.length=L;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;ja=false}c=qb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=
|
|
|
+g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<j;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
|
|
|
+3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
+m,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ha=S=null;K=ca=$=Z=Pa=Oa=X=-1;ja=true;a[d].render(b,c,bb,Ha);ha=S=null;K=ca=$=Z=Pa=Oa=X=-1;ja=true}}function j(a,b,c,d,e,f,g,h){var k,i,j,l;if(b){i=a.length-1;l=b=-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){k=
|
|
|
+a[m];if(k.render){i=k.object;j=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&D.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);D.setDepthTest(k.depthTest);D.setDepthWrite(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}D.setObjectFaces(i);j instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,k,j,i):D.renderBuffer(d,e,f,k,j,i)}}}function l(a,b,c,d,e,f,g){for(var h,k,i=0,j=a.length;i<j;i++){h=a[i];k=h.object;if(k.visible){if(g)h=g;else{h=h[b];if(!h)continue;
|
|
|
+f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,k)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
|
|
|
+1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){if(d.needsUpdate){d.program&&D.deallocateMaterial(d);D.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);var f=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==S){k.useProgram(g);S=g;f=true}if(d.id!==K){K=d.id;f=true}if(f||a!==ha){k.uniformMatrix4fv(h.projectionMatrix,
|
|
|
+false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(f){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ja){for(var j,l=0,m=0,n=0,o,p,r,q=ob,s=q.directional.colors,u=q.directional.positions,v=q.point.colors,w=q.point.positions,x=q.point.distances,F=q.spot.colors,B=q.spot.positions,H=q.spot.distances,
|
|
|
+Z=q.spot.directions,I=q.spot.angles,G=q.spot.exponents,N=0,X=0,L=0,O=r=0,c=O=0,f=b.length;c<f;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(D.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=N*3;if(D.gammaInput){s[r]=o.r*o.r*p*p;s[r+1]=o.g*o.g*p*p;s[r+2]=o.b*o.b*p*p}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}Da.copy(j.matrixWorld.getPosition());Da.subSelf(j.target.matrixWorld.getPosition());
|
|
|
+Da.normalize();u[r]=Da.x;u[r+1]=Da.y;u[r+2]=Da.z;N=N+1}else if(j instanceof THREE.PointLight){O=X*3;if(D.gammaInput){v[O]=o.r*o.r*p*p;v[O+1]=o.g*o.g*p*p;v[O+2]=o.b*o.b*p*p}else{v[O]=o.r*p;v[O+1]=o.g*p;v[O+2]=o.b*p}o=j.matrixWorld.getPosition();w[O]=o.x;w[O+1]=o.y;w[O+2]=o.z;x[X]=r;X=X+1}else if(j instanceof THREE.SpotLight){O=L*3;if(D.gammaInput){F[O]=o.r*o.r*p*p;F[O+1]=o.g*o.g*p*p;F[O+2]=o.b*o.b*p*p}else{F[O]=o.r*p;F[O+1]=o.g*p;F[O+2]=o.b*p}o=j.matrixWorld.getPosition();B[O]=o.x;B[O+1]=o.y;B[O+2]=
|
|
|
+o.z;H[L]=r;Da.copy(o);Da.subSelf(j.target.matrixWorld.getPosition());Da.normalize();Z[O]=Da.x;Z[O+1]=Da.y;Z[O+2]=Da.z;I[L]=Math.cos(j.angle);G[L]=j.exponent;L=L+1}}}c=N*3;for(f=s.length;c<f;c++)s[c]=0;c=X*3;for(f=v.length;c<f;c++)v[c]=0;c=L*3;for(f=F.length;c<f;c++)F[c]=0;q.directional.length=N;q.point.length=X;q.spot.length=L;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;ja=false}c=ob;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=
|
|
|
c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
|
|
|
d.opacity;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);i.lightMap.texture=d.lightMap;i.envMap.texture=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
|
|
|
THREE.LineBasicMaterial){i.diffuse.value=d.color;i.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){i.psColor.value=d.color;i.opacity.value=d.opacity;i.size.value=d.size;i.scale.value=z.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;
|
|
|
i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(D.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=
|
|
|
-d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){f=c=0;for(k=b.length;f<k;f++){l=b[f];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){i.shadowMap.texture[c]=l.shadowMap;i.shadowMapSize.value[c]=l.shadowMapSize;i.shadowMatrix.value[c]=l.shadowMatrix;i.shadowDarkness.value[c]=l.shadowDarkness;i.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=g.uniforms[b[i][1]]){f=b[i][0];m=f.type;k=f.value;
|
|
|
-if(m==="i")j.uniform1i(l,k);else if(m==="f")j.uniform1f(l,k);else if(m==="v2")j.uniform2f(l,k.x,k.y);else if(m==="v3")j.uniform3f(l,k.x,k.y,k.z);else if(m==="v4")j.uniform4f(l,k.x,k.y,k.z,k.w);else if(m==="c")j.uniform3f(l,k.r,k.g,k.b);else if(m==="fv1")j.uniform1fv(l,k);else if(m==="fv")j.uniform3fv(l,k);else if(m==="v2v"){if(f._array===void 0)f._array=new Float32Array(2*k.length);m=0;for(n=k.length;m<n;m++){q=m*2;f._array[q]=k[m].x;f._array[q+1]=k[m].y}j.uniform2fv(l,f._array)}else if(m==="v3v"){if(f._array===
|
|
|
-void 0)f._array=new Float32Array(3*k.length);m=0;for(n=k.length;m<n;m++){q=m*3;f._array[q]=k[m].x;f._array[q+1]=k[m].y;f._array[q+2]=k[m].z}j.uniform3fv(l,f._array)}else if(m==="v4v"){if(f._array===void 0)f._array=new Float32Array(4*k.length);m=0;for(n=k.length;m<n;m++){q=m*4;f._array[q]=k[m].x;f._array[q+1]=k[m].y;f._array[q+2]=k[m].z;f._array[q+3]=k[m].w}j.uniform4fv(l,f._array)}else if(m==="m4"){if(f._array===void 0)f._array=new Float32Array(16);k.flattenToArray(f._array);j.uniformMatrix4fv(l,
|
|
|
-false,f._array)}else if(m==="m4v"){if(f._array===void 0)f._array=new Float32Array(16*k.length);m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(f._array,m*16);j.uniformMatrix4fv(l,false,f._array)}else if(m==="t"){j.uniform1i(l,k);if(l=f.texture)if(l.image instanceof Array&&l.image.length===6){f=l;if(f.image.length===6)if(f.needsUpdate){if(!f.image.__webglTextureCube)f.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,f.image.__webglTextureCube);
|
|
|
-j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,f.flipY);k=[];for(l=0;l<6;l++){m=k;n=l;if(D.autoScaleCubemaps){q=f.image[l];u=bc;if(!(q.width<=u&&q.height<=u)){v=Math.max(q.width,q.height);s=Math.floor(q.width*u/v);u=Math.floor(q.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=v}}else q=f.image[l];m[n]=q}l=k[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=C(f.format);q=C(f.type);t(j.TEXTURE_CUBE_MAP,f,m);for(l=0;l<6;l++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-l,0,n,n,q,k[l]);f.generateMipmaps&&m&&j.generateMipmap(j.TEXTURE_CUBE_MAP);f.needsUpdate=false;if(f.onUpdate)f.onUpdate()}else{j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,f.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){f=l;j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,f.__webglTexture)}else D.setTexture(l,k)}else if(m==="tv"){if(f._array===void 0){f._array=[];m=0;for(n=f.texture.length;m<n;m++)f._array[m]=k+m}j.uniform1iv(l,f._array);
|
|
|
-m=0;for(n=f.texture.length;m<n;m++)(l=f.texture[m])&&D.setTexture(l,f._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();j.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&j.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(h.boneGlobalMatrices,
|
|
|
-false,e.boneMatrices)}j.uniformMatrix4fv(h.modelViewMatrix,false,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,false,e._normalMatrix.elements);h.objectMatrix!==null&&j.uniformMatrix4fv(h.objectMatrix,false,e.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Ua!==a){a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL);
|
|
|
-Ua=a}if(a&&(fb!==b||gb!==c)){j.polygonOffset(b,c);fb=b;gb=c}}function w(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS)){console.error(j.getShaderInfoLog(c));console.error(b);return null}return c}function t(a,b,c){if(c){j.texParameteri(a,j.TEXTURE_WRAP_S,C(b.wrapS));j.texParameteri(a,j.TEXTURE_WRAP_T,C(b.wrapT));j.texParameteri(a,j.TEXTURE_MAG_FILTER,
|
|
|
-C(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,C(b.minFilter))}else{j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(a,j.TEXTURE_MAG_FILTER,F(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height);j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,
|
|
|
-j.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height);j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)}else j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function C(a){return a===THREE.RepeatWrapping?j.REPEAT:a===THREE.ClampToEdgeWrapping?
|
|
|
-j.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?j.MIRRORED_REPEAT:a===THREE.NearestFilter?j.NEAREST:a===THREE.NearestMipMapNearestFilter?j.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?j.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?j.LINEAR:a===THREE.LinearMipMapNearestFilter?j.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?j.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?j.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?j.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
|
|
|
-j.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?j.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?j.BYTE:a===THREE.ShortType?j.SHORT:a===THREE.UnsignedShortType?j.UNSIGNED_SHORT:a===THREE.IntType?j.INT:a===THREE.UnsignedIntType?j.UNSIGNED_INT:a===THREE.FloatType?j.FLOAT:a===THREE.AlphaFormat?j.ALPHA:a===THREE.RGBFormat?j.RGB:a===THREE.RGBAFormat?j.RGBA:a===THREE.LuminanceFormat?j.LUMINANCE:a===THREE.LuminanceAlphaFormat?j.LUMINANCE_ALPHA:a===THREE.AddEquation?j.FUNC_ADD:a===THREE.SubtractEquation?
|
|
|
-j.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?j.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?j.ZERO:a===THREE.OneFactor?j.ONE:a===THREE.SrcColorFactor?j.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?j.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?j.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?j.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?j.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?j.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?j.DST_COLOR:a===THREE.OneMinusDstColorFactor?j.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
|
|
|
-j.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),v=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,N=a.antialias!==void 0?a.antialias:false,R=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),G=a.clearAlpha!==
|
|
|
+d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){f=c=0;for(j=b.length;f<j;f++){l=b[f];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){i.shadowMap.texture[c]=l.shadowMap;i.shadowMapSize.value[c]=l.shadowMapSize;i.shadowMatrix.value[c]=l.shadowMatrix;i.shadowDarkness.value[c]=l.shadowDarkness;i.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=g.uniforms[b[i][1]]){f=b[i][0];m=f.type;j=f.value;
|
|
|
+if(m==="i")k.uniform1i(l,j);else if(m==="f")k.uniform1f(l,j);else if(m==="v2")k.uniform2f(l,j.x,j.y);else if(m==="v3")k.uniform3f(l,j.x,j.y,j.z);else if(m==="v4")k.uniform4f(l,j.x,j.y,j.z,j.w);else if(m==="c")k.uniform3f(l,j.r,j.g,j.b);else if(m==="fv1")k.uniform1fv(l,j);else if(m==="fv")k.uniform3fv(l,j);else if(m==="v2v"){if(f._array===void 0)f._array=new Float32Array(2*j.length);m=0;for(n=j.length;m<n;m++){q=m*2;f._array[q]=j[m].x;f._array[q+1]=j[m].y}k.uniform2fv(l,f._array)}else if(m==="v3v"){if(f._array===
|
|
|
+void 0)f._array=new Float32Array(3*j.length);m=0;for(n=j.length;m<n;m++){q=m*3;f._array[q]=j[m].x;f._array[q+1]=j[m].y;f._array[q+2]=j[m].z}k.uniform3fv(l,f._array)}else if(m==="v4v"){if(f._array===void 0)f._array=new Float32Array(4*j.length);m=0;for(n=j.length;m<n;m++){q=m*4;f._array[q]=j[m].x;f._array[q+1]=j[m].y;f._array[q+2]=j[m].z;f._array[q+3]=j[m].w}k.uniform4fv(l,f._array)}else if(m==="m4"){if(f._array===void 0)f._array=new Float32Array(16);j.flattenToArray(f._array);k.uniformMatrix4fv(l,
|
|
|
+false,f._array)}else if(m==="m4v"){if(f._array===void 0)f._array=new Float32Array(16*j.length);m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(f._array,m*16);k.uniformMatrix4fv(l,false,f._array)}else if(m==="t"){k.uniform1i(l,j);if(l=f.texture)if(l.image instanceof Array&&l.image.length===6){f=l;if(f.image.length===6)if(f.needsUpdate){if(!f.image.__webglTextureCube)f.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.image.__webglTextureCube);
|
|
|
+k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,f.flipY);j=[];for(l=0;l<6;l++){m=j;n=l;if(D.autoScaleCubemaps){q=f.image[l];u=bc;if(!(q.width<=u&&q.height<=u)){v=Math.max(q.width,q.height);s=Math.floor(q.width*u/v);u=Math.floor(q.height*u/v);v=document.createElement("canvas");v.width=s;v.height=u;v.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=v}}else q=f.image[l];m[n]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=C(f.format);q=C(f.type);t(k.TEXTURE_CUBE_MAP,f,m);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+l,0,n,n,q,j[l]);f.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);f.needsUpdate=false;if(f.onUpdate)f.onUpdate()}else{k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){f=l;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.__webglTexture)}else D.setTexture(l,j)}else if(m==="tv"){if(f._array===void 0){f._array=[];m=0;for(n=f.texture.length;m<n;m++)f._array[m]=j+m}k.uniform1iv(l,f._array);
|
|
|
+m=0;for(n=f.texture.length;m<n;m++)(l=f.texture[m])&&D.setTexture(l,f._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&k.uniformMatrix4fv(h.boneGlobalMatrices,
|
|
|
+false,e.boneMatrices)}k.uniformMatrix4fv(h.modelViewMatrix,false,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,e._normalMatrix.elements);h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,false,e.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Ta!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);
|
|
|
+Ta=a}if(a&&(Wa!==b||lb!==c)){k.polygonOffset(b,c);Wa=b;lb=c}}function w(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(b);return null}return c}function t(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,C(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,C(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,
|
|
|
+C(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,
|
|
|
+k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function F(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function C(a){return a===THREE.RepeatWrapping?k.REPEAT:a===THREE.ClampToEdgeWrapping?
|
|
|
+k.CLAMP_TO_EDGE:a===THREE.MirroredRepeatWrapping?k.MIRRORED_REPEAT:a===THREE.NearestFilter?k.NEAREST:a===THREE.NearestMipMapNearestFilter?k.NEAREST_MIPMAP_NEAREST:a===THREE.NearestMipMapLinearFilter?k.NEAREST_MIPMAP_LINEAR:a===THREE.LinearFilter?k.LINEAR:a===THREE.LinearMipMapNearestFilter?k.LINEAR_MIPMAP_NEAREST:a===THREE.LinearMipMapLinearFilter?k.LINEAR_MIPMAP_LINEAR:a===THREE.UnsignedByteType?k.UNSIGNED_BYTE:a===THREE.UnsignedShort4444Type?k.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort5551Type?
|
|
|
+k.UNSIGNED_SHORT_5_5_5_1:a===THREE.UnsignedShort565Type?k.UNSIGNED_SHORT_5_6_5:a===THREE.ByteType?k.BYTE:a===THREE.ShortType?k.SHORT:a===THREE.UnsignedShortType?k.UNSIGNED_SHORT:a===THREE.IntType?k.INT:a===THREE.UnsignedIntType?k.UNSIGNED_INT:a===THREE.FloatType?k.FLOAT:a===THREE.AlphaFormat?k.ALPHA:a===THREE.RGBFormat?k.RGB:a===THREE.RGBAFormat?k.RGBA:a===THREE.LuminanceFormat?k.LUMINANCE:a===THREE.LuminanceAlphaFormat?k.LUMINANCE_ALPHA:a===THREE.AddEquation?k.FUNC_ADD:a===THREE.SubtractEquation?
|
|
|
+k.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?k.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?k.ZERO:a===THREE.OneFactor?k.ONE:a===THREE.SrcColorFactor?k.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?k.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?k.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?k.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?k.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?k.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?k.DST_COLOR:a===THREE.OneMinusDstColorFactor?k.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?
|
|
|
+k.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z=a.canvas!==void 0?a.canvas:document.createElement("canvas"),v=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,N=a.antialias!==void 0?a.antialias:false,R=a.stencil!==void 0?a.stencil:true,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),G=a.clearAlpha!==
|
|
|
void 0?a.clearAlpha:0,Q=a.maxLights!==void 0?a.maxLights:4;this.domElement=z;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=
|
|
|
-true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,j,P=[],L=0,S=null,aa=null,K=-1,ca=null,ha=null,O=0,Z=-1,$=-1,X=-1,ia=-1,ya=-1,Ia=-1,Pa=-1,Qa=-1,Ua=null,fb=null,gb=null,$a=null,ob=0,kb=0,pb=0,hb=0,bb=0,Ca=0,za=new THREE.Frustum,lb=new THREE.Matrix4,wa=new THREE.Matrix4,Ra=new THREE.Vector4,Fa=new THREE.Vector3,ja=true,qb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
|
|
|
-point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};j=function(){var a;try{if(!(a=z.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:I,antialias:N,stencil:R,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";}catch(b){console.error(b)}a.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");return a}();j.clearColor(0,0,0,1);j.clearDepth(1);
|
|
|
-j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(B.r,B.g,B.b,G);this.context=j;var ab=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var bc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return ab>0};this.setSize=
|
|
|
-function(a,b){z.width=a;z.height=b;this.setViewport(0,0,z.width,z.height)};this.setViewport=function(a,b,c,d){ob=a;kb=b;pb=c;hb=d;j.viewport(ob,kb,pb,hb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);G=b;j.clearColor(B.r,B.g,B.b,G)};this.setClearColor=function(a,b){B.copy(a);G=b;j.clearColor(B.r,B.g,B.b,G)};this.getClearColor=function(){return B};this.getClearAlpha=
|
|
|
-function(){return G};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|j.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|j.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;
|
|
|
-delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
|
|
|
-j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}D.info.memory.geometries--}else if(a instanceof
|
|
|
-THREE.Ribbon){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
|
|
|
-false;j.deleteTexture(a.__webglTexture);D.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){j.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){j.deleteFramebuffer(a.__webglFramebuffer[b]);j.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{j.deleteFramebuffer(a.__webglFramebuffer);j.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=
|
|
|
-false,a=0;for(c=P.length;a<c;a++){d=P[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=P.length;a<c;a++){d=P[a];d.program!==b&&e.push(d)}P=e;j.deleteProgram(b);D.info.memory.programs--}}};this.updateShadowMap=function(a,b){S=null;K=ca=Qa=Pa=X=-1;ja=true;$=Z=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
|
|
|
-j.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=j.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=j.createBuffer();if(a.hasPositions){j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.position);j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,false,0,0)}if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
-e,f,g,h,i,k,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];i=n[o+4];l=n[o+5];h=n[o+6];k=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+i+k)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,false,0,0)}if(a.hasUvs&&c.map){j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-a.uvArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.uv);j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.color);j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,false,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=
|
|
|
-q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){if(b){var g=e.vertexPositionBuffer.itemSize;j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer);j.vertexAttribPointer(a.position,g,j.FLOAT,false,0,f[d].index*g*4);if(a.normal>=0&&e.vertexNormalBuffer){g=e.vertexNormalBuffer.itemSize;j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer);j.vertexAttribPointer(a.normal,
|
|
|
-g,j.FLOAT,false,0,f[d].index*g*4)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){g=e.vertexUvBuffer.itemSize;j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer);j.vertexAttribPointer(a.uv,g,j.FLOAT,false,0,f[d].index*g*4);j.enableVertexAttribArray(a.uv)}else j.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){g=e.vertexColorBuffer.itemSize;j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer);j.vertexAttribPointer(a.color,g,j.FLOAT,false,0,f[d].index*g*4)}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-e.vertexIndexBuffer)}j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer);j.vertexAttribPointer(b.position,
|
|
|
-3,j.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}else if(c.position>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var k=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;k<d.numSupportedMorphTargets&&k<i.length;){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglMorphTargetsBuffers[i[k]]);j.vertexAttribPointer(c["morphTarget"+k],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[k]]);j.vertexAttribPointer(c["morphNormal"+k],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=g[i[k]];k++}}else{i=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){k=g[l];k>0&&i.push([l,k])}if(i.length>d.numSupportedMorphTargets){i.sort(h);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?
|
|
|
-i.sort(h):i.length===0&&i.push([0,0]);for(k=0;k<d.numSupportedMorphTargets;){if(i[k]){l=i[k][0];j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+k],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);j.vertexAttribPointer(c["morphNormal"+k],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[k]=g[l]}else{j.vertexAttribPointer(c["morphTarget"+k],3,j.FLOAT,false,0,0);d.morphNormals&&j.vertexAttribPointer(c["morphNormal"+
|
|
|
-k],3,j.FLOAT,false,0,0);f.__webglMorphTargetInfluences[k]=0}k++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){j.bindBuffer(j.ARRAY_BUFFER,c.buffer);j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,false,0,0)}}}if(b.color>=0){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglColorBuffer);j.vertexAttribPointer(b.color,3,j.FLOAT,false,0,0)}if(b.normal>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer);j.vertexAttribPointer(b.normal,3,j.FLOAT,false,0,0)}if(b.tangent>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer);j.vertexAttribPointer(b.tangent,4,j.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer);j.vertexAttribPointer(b.uv,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv)}else j.disableVertexAttribArray(b.uv);
|
|
|
-if(b.uv2>=0)if(e.__webglUV2Buffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer);j.vertexAttribPointer(b.uv2,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv2)}else j.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer);j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,
|
|
|
-false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==$a){j.lineWidth(d);$a=d}a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)}else{a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
|
|
|
-j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)}D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+e.__webglFaceCount;D.info.render.faces=D.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;d=d.linewidth;if(d!==$a){j.lineWidth(d);$a=d}j.drawArrays(f,0,e.__webglLineCount);D.info.render.calls++}else if(f instanceof THREE.ParticleSystem){j.drawArrays(j.POINTS,0,e.__webglParticleCount);D.info.render.calls++;
|
|
|
-D.info.render.points=D.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount);D.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;K=-1;ja=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=
|
|
|
-new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);lb.multiply(b.projectionMatrix,b.matrixWorldInverse);za.setFromMatrix(lb);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
-this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||za.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=q.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=
|
|
|
-t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{Ra.copy(h.matrixWorld.getPosition());lb.multiplyVector3(Ra);f.z=Ra.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,
|
|
|
-d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,
|
|
|
-a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture);j.generateMipmap(j.TEXTURE_CUBE_MAP);j.bindTexture(j.TEXTURE_CUBE_MAP,null)}else{j.bindTexture(j.TEXTURE_2D,c.__webglTexture);j.generateMipmap(j.TEXTURE_2D);j.bindTexture(j.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);ca=
|
|
|
--1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,za):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,k=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){k=
|
|
|
-g.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];v=u.materialIndex;x=v!==void 0?v:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B});
|
|
|
-w=u instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+w>65535){F[x].counter=F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+w}q.geometryGroupsList=[];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=
|
|
|
-O++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(i in k.geometryGroups){l=k.geometryGroups[i];if(!l.__webglVertexBuffer){var K=l;K.__webglVertexBuffer=j.createBuffer();K.__webglNormalBuffer=j.createBuffer();K.__webglTangentBuffer=j.createBuffer();K.__webglColorBuffer=j.createBuffer();K.__webglUVBuffer=j.createBuffer();K.__webglUV2Buffer=j.createBuffer();K.__webglSkinVertexABuffer=j.createBuffer();K.__webglSkinVertexBBuffer=j.createBuffer();K.__webglSkinIndicesBuffer=j.createBuffer();K.__webglSkinWeightsBuffer=
|
|
|
-j.createBuffer();K.__webglFaceBuffer=j.createBuffer();K.__webglLineBuffer=j.createBuffer();var Z=void 0,I=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];Z=0;for(I=K.numMorphTargets;Z<I;Z++)K.__webglMorphTargetsBuffers.push(j.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];Z=0;for(I=K.numMorphNormals;Z<I;Z++)K.__webglMorphNormalsBuffers.push(j.createBuffer())}D.info.memory.geometries++;var G=l,L=g,X=L.geometry,N=G.faces3,$=G.faces4,S=N.length*3+$.length*4,Q=N.length*
|
|
|
-1+$.length*2,R=N.length*3+$.length*4,P=c(L,G),aa=e(P),Y=d(P),ha=P.vertexColors?P.vertexColors:false;G.__vertexArray=new Float32Array(S*3);if(Y)G.__normalArray=new Float32Array(S*3);if(X.hasTangents)G.__tangentArray=new Float32Array(S*4);if(ha)G.__colorArray=new Float32Array(S*3);if(aa){if(X.faceUvs.length>0||X.faceVertexUvs.length>0)G.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(S*2)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length){G.__skinVertexAArray=
|
|
|
-new Float32Array(S*4);G.__skinVertexBArray=new Float32Array(S*4);G.__skinIndexArray=new Float32Array(S*4);G.__skinWeightArray=new Float32Array(S*4)}G.__faceArray=new Uint16Array(Q*3);G.__lineArray=new Uint16Array(R*2);var ca=void 0,ia=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ca=0;for(ia=G.numMorphTargets;ca<ia;ca++)G.__morphTargetsArrays.push(new Float32Array(S*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ca=0;for(ia=G.numMorphNormals;ca<ia;ca++)G.__morphNormalsArrays.push(new Float32Array(S*
|
|
|
-3))}G.__webglFaceCount=Q*3;G.__webglLineCount=R*2;if(P.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Pa=void 0;for(Pa in P.attributes){var Ia=P.attributes[Pa],ya={},Qa;for(Qa in Ia)ya[Qa]=Ia[Qa];if(!ya.__webglInitialized||ya.createUniqueBuffers){ya.__webglInitialized=true;var ja=1;ya.type==="v2"?ja=2:ya.type==="v3"?ja=3:ya.type==="v4"?ja=4:ya.type==="c"&&(ja=3);ya.size=ja;ya.array=new Float32Array(S*ja);ya.buffer=j.createBuffer();ya.buffer.belongsToAttribute=
|
|
|
-Pa;Ia.needsUpdate=true;ya.__original=Ia}G.__webglCustomAttributesList.push(ya)}}G.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}}else if(g instanceof THREE.Ribbon){k=g.geometry;if(!k.__webglVertexBuffer){var Ua=k;Ua.__webglVertexBuffer=j.createBuffer();Ua.__webglColorBuffer=j.createBuffer();D.info.memory.geometries++;var wa=k,za=wa.vertices.length;
|
|
|
-wa.__vertexArray=new Float32Array(za*3);wa.__colorArray=new Float32Array(za*3);wa.__webglVertexCount=za;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){k=g.geometry;if(!k.__webglVertexBuffer){var Fa=k;Fa.__webglVertexBuffer=j.createBuffer();Fa.__webglColorBuffer=j.createBuffer();D.info.memory.geometries++;var Ca=k,fb=g,Ra=Ca.vertices.length;Ca.__vertexArray=new Float32Array(Ra*3);Ca.__colorArray=new Float32Array(Ra*3);Ca.__webglLineCount=Ra;b(Ca,fb);k.verticesNeedUpdate=
|
|
|
-true;k.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){k=g.geometry;if(!k.__webglVertexBuffer){var bb=k;bb.__webglVertexBuffer=j.createBuffer();bb.__webglColorBuffer=j.createBuffer();D.info.geometries++;var $a=k,lb=g,ob=$a.vertices.length;$a.__vertexArray=new Float32Array(ob*3);$a.__colorArray=new Float32Array(ob*3);$a.__sortArray=[];$a.__webglParticleCount=ob;b($a,lb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){k=g.geometry;
|
|
|
-if(k instanceof THREE.BufferGeometry)o(h.__webglObjects,k,g);else for(i in k.geometryGroups){l=k.geometryGroups[i];o(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){k=g.geometry;o(h.__webglObjects,k,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);
|
|
|
-g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var cb=a.__objectsRemoved[0],kb=a;cb instanceof THREE.Mesh||cb instanceof THREE.ParticleSystem||cb instanceof THREE.Ribbon||cb instanceof THREE.Line?r(kb.__webglObjects,cb):cb instanceof THREE.Sprite?n(kb.__webglSprites,cb):cb instanceof THREE.LensFlare?n(kb.__webglFlares,cb):(cb instanceof THREE.ImmediateRenderObject||cb.immediateRenderCallback)&&r(kb.__webglObjectsImmediate,cb);cb.__webglActive=false;a.__objectsRemoved.splice(0,
|
|
|
-1)}for(var pb=0,qb=a.__webglObjects.length;pb<qb;pb++){var mb=a.__webglObjects[pb].object,da=mb.geometry,ab=void 0,gb=void 0,Va=void 0;if(mb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate){var Da=da,hb=j.DYNAMIC_DRAW,bc=!da.dynamic;if(Da.elementsNeedUpdate&&Da.vertexIndexArray!==void 0){j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Da.vertexIndexBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-Da.vertexIndexArray,hb)}if(Da.verticesNeedUpdate&&Da.vertexPositionArray!==void 0){j.bindBuffer(j.ARRAY_BUFFER,Da.vertexPositionBuffer);j.bufferData(j.ARRAY_BUFFER,Da.vertexPositionArray,hb)}if(Da.normalsNeedUpdate&&Da.vertexNormalArray!==void 0){j.bindBuffer(j.ARRAY_BUFFER,Da.vertexNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Da.vertexNormalArray,hb)}if(Da.uvsNeedUpdate&&Da.vertexUvArray!==void 0){j.bindBuffer(j.ARRAY_BUFFER,Da.vertexUvBuffer);j.bufferData(j.ARRAY_BUFFER,Da.vertexUvArray,hb)}if(Da.colorsNeedUpdate&&
|
|
|
-Da.vertexColorArray!==void 0){j.bindBuffer(j.ARRAY_BUFFER,Da.vertexColorBuffer);j.bufferData(j.ARRAY_BUFFER,Da.vertexColorArray,hb)}if(bc){delete Da.vertexIndexArray;delete Da.vertexPositionArray;delete Da.vertexNormalArray;delete Da.vertexUvArray;delete Da.vertexColorArray}}da.verticesNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false}else{for(var Tc=0,od=da.geometryGroupsList.length;Tc<od;Tc++){ab=da.geometryGroupsList[Tc];Va=
|
|
|
-c(mb,ab);gb=Va.attributes&&m(Va);if(da.verticesNeedUpdate||da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||gb){var ea=ab,pd=mb,Xa=j.DYNAMIC_DRAW,qd=!da.dynamic,dc=Va;if(ea.__inittedArrays){var dd=d(dc),Uc=dc.vertexColors?dc.vertexColors:false,ed=e(dc),Fc=dd===THREE.SmoothShading,E=void 0,T=void 0,jb=void 0,M=void 0,kc=void 0,Pb=void 0,nb=void 0,Gc=void 0,Ib=void 0,lc=void 0,mc=void 0,U=void 0,V=void 0,W=void 0,na=
|
|
|
-void 0,rb=void 0,sb=void 0,tb=void 0,rc=void 0,ub=void 0,vb=void 0,wb=void 0,sc=void 0,xb=void 0,yb=void 0,zb=void 0,tc=void 0,Ab=void 0,Bb=void 0,Cb=void 0,uc=void 0,Db=void 0,Eb=void 0,Fb=void 0,vc=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Hc=void 0,Tb=void 0,Ub=void 0,Vb=void 0,Ic=void 0,ka=void 0,fd=void 0,Wb=void 0,nc=void 0,oc=void 0,Ja=void 0,gd=void 0,Ga=void 0,Ha=void 0,Xb=void 0,Jb=void 0,xa=0,Ea=0,Kb=0,Lb=0,db=0,Oa=0,oa=0,Sa=0,Aa=0,J=0,ba=0,A=0,Ya=void 0,Ka=ea.__vertexArray,wc=ea.__uvArray,
|
|
|
-xc=ea.__uv2Array,eb=ea.__normalArray,qa=ea.__tangentArray,La=ea.__colorArray,ra=ea.__skinVertexAArray,sa=ea.__skinVertexBArray,ta=ea.__skinIndexArray,ua=ea.__skinWeightArray,Vc=ea.__morphTargetsArrays,Wc=ea.__morphNormalsArrays,Xc=ea.__webglCustomAttributesList,y=void 0,Gb=ea.__faceArray,Za=ea.__lineArray,Ta=pd.geometry,rd=Ta.elementsNeedUpdate,hd=Ta.uvsNeedUpdate,sd=Ta.normalsNeedUpdate,td=Ta.tangentsNeedUpdate,ud=Ta.colorsNeedUpdate,vd=Ta.morphTargetsNeedUpdate,ec=Ta.vertices,la=ea.faces3,ma=ea.faces4,
|
|
|
-Ba=Ta.faces,Yc=Ta.faceVertexUvs[0],Zc=Ta.faceVertexUvs[1],fc=Ta.skinVerticesA,gc=Ta.skinVerticesB,hc=Ta.skinIndices,Yb=Ta.skinWeights,Zb=Ta.morphTargets,Jc=Ta.morphNormals;if(Ta.verticesNeedUpdate){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=ec[M.a];V=ec[M.b];W=ec[M.c];Ka[Ea]=U.x;Ka[Ea+1]=U.y;Ka[Ea+2]=U.z;Ka[Ea+3]=V.x;Ka[Ea+4]=V.y;Ka[Ea+5]=V.z;Ka[Ea+6]=W.x;Ka[Ea+7]=W.y;Ka[Ea+8]=W.z;Ea=Ea+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=ec[M.a];V=ec[M.b];W=ec[M.c];na=ec[M.d];Ka[Ea]=U.x;Ka[Ea+1]=U.y;Ka[Ea+
|
|
|
-2]=U.z;Ka[Ea+3]=V.x;Ka[Ea+4]=V.y;Ka[Ea+5]=V.z;Ka[Ea+6]=W.x;Ka[Ea+7]=W.y;Ka[Ea+8]=W.z;Ka[Ea+9]=na.x;Ka[Ea+10]=na.y;Ka[Ea+11]=na.z;Ea=Ea+12}j.bindBuffer(j.ARRAY_BUFFER,ea.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ka,Xa)}if(vd){Ja=0;for(gd=Zb.length;Ja<gd;Ja++){E=ba=0;for(T=la.length;E<T;E++){Xb=la[E];M=Ba[Xb];U=Zb[Ja].vertices[M.a];V=Zb[Ja].vertices[M.b];W=Zb[Ja].vertices[M.c];Ga=Vc[Ja];Ga[ba]=U.x;Ga[ba+1]=U.y;Ga[ba+2]=U.z;Ga[ba+3]=V.x;Ga[ba+4]=V.y;Ga[ba+5]=V.z;Ga[ba+6]=W.x;Ga[ba+7]=W.y;Ga[ba+
|
|
|
-8]=W.z;if(dc.morphNormals){if(Fc){Jb=Jc[Ja].vertexNormals[Xb];ub=Jb.a;vb=Jb.b;wb=Jb.c}else wb=vb=ub=Jc[Ja].faceNormals[Xb];Ha=Wc[Ja];Ha[ba]=ub.x;Ha[ba+1]=ub.y;Ha[ba+2]=ub.z;Ha[ba+3]=vb.x;Ha[ba+4]=vb.y;Ha[ba+5]=vb.z;Ha[ba+6]=wb.x;Ha[ba+7]=wb.y;Ha[ba+8]=wb.z}ba=ba+9}E=0;for(T=ma.length;E<T;E++){Xb=ma[E];M=Ba[Xb];U=Zb[Ja].vertices[M.a];V=Zb[Ja].vertices[M.b];W=Zb[Ja].vertices[M.c];na=Zb[Ja].vertices[M.d];Ga=Vc[Ja];Ga[ba]=U.x;Ga[ba+1]=U.y;Ga[ba+2]=U.z;Ga[ba+3]=V.x;Ga[ba+4]=V.y;Ga[ba+5]=V.z;Ga[ba+6]=W.x;
|
|
|
-Ga[ba+7]=W.y;Ga[ba+8]=W.z;Ga[ba+9]=na.x;Ga[ba+10]=na.y;Ga[ba+11]=na.z;if(dc.morphNormals){if(Fc){Jb=Jc[Ja].vertexNormals[Xb];ub=Jb.a;vb=Jb.b;wb=Jb.c;sc=Jb.d}else sc=wb=vb=ub=Jc[Ja].faceNormals[Xb];Ha=Wc[Ja];Ha[ba]=ub.x;Ha[ba+1]=ub.y;Ha[ba+2]=ub.z;Ha[ba+3]=vb.x;Ha[ba+4]=vb.y;Ha[ba+5]=vb.z;Ha[ba+6]=wb.x;Ha[ba+7]=wb.y;Ha[ba+8]=wb.z;Ha[ba+9]=sc.x;Ha[ba+10]=sc.y;Ha[ba+11]=sc.z}ba=ba+12}j.bindBuffer(j.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[Ja]);j.bufferData(j.ARRAY_BUFFER,Vc[Ja],Xa);if(dc.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-ea.__webglMorphNormalsBuffers[Ja]);j.bufferData(j.ARRAY_BUFFER,Wc[Ja],Xa)}}}if(Yb.length){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];Ab=Yb[M.a];Bb=Yb[M.b];Cb=Yb[M.c];ua[J]=Ab.x;ua[J+1]=Ab.y;ua[J+2]=Ab.z;ua[J+3]=Ab.w;ua[J+4]=Bb.x;ua[J+5]=Bb.y;ua[J+6]=Bb.z;ua[J+7]=Bb.w;ua[J+8]=Cb.x;ua[J+9]=Cb.y;ua[J+10]=Cb.z;ua[J+11]=Cb.w;Db=hc[M.a];Eb=hc[M.b];Fb=hc[M.c];ta[J]=Db.x;ta[J+1]=Db.y;ta[J+2]=Db.z;ta[J+3]=Db.w;ta[J+4]=Eb.x;ta[J+5]=Eb.y;ta[J+6]=Eb.z;ta[J+7]=Eb.w;ta[J+8]=Fb.x;ta[J+9]=Fb.y;ta[J+10]=Fb.z;ta[J+11]=
|
|
|
-Fb.w;Qb=fc[M.a];Rb=fc[M.b];Sb=fc[M.c];ra[J]=Qb.x;ra[J+1]=Qb.y;ra[J+2]=Qb.z;ra[J+3]=1;ra[J+4]=Rb.x;ra[J+5]=Rb.y;ra[J+6]=Rb.z;ra[J+7]=1;ra[J+8]=Sb.x;ra[J+9]=Sb.y;ra[J+10]=Sb.z;ra[J+11]=1;Tb=gc[M.a];Ub=gc[M.b];Vb=gc[M.c];sa[J]=Tb.x;sa[J+1]=Tb.y;sa[J+2]=Tb.z;sa[J+3]=1;sa[J+4]=Ub.x;sa[J+5]=Ub.y;sa[J+6]=Ub.z;sa[J+7]=1;sa[J+8]=Vb.x;sa[J+9]=Vb.y;sa[J+10]=Vb.z;sa[J+11]=1;J=J+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];Ab=Yb[M.a];Bb=Yb[M.b];Cb=Yb[M.c];uc=Yb[M.d];ua[J]=Ab.x;ua[J+1]=Ab.y;ua[J+2]=Ab.z;ua[J+3]=
|
|
|
-Ab.w;ua[J+4]=Bb.x;ua[J+5]=Bb.y;ua[J+6]=Bb.z;ua[J+7]=Bb.w;ua[J+8]=Cb.x;ua[J+9]=Cb.y;ua[J+10]=Cb.z;ua[J+11]=Cb.w;ua[J+12]=uc.x;ua[J+13]=uc.y;ua[J+14]=uc.z;ua[J+15]=uc.w;Db=hc[M.a];Eb=hc[M.b];Fb=hc[M.c];vc=hc[M.d];ta[J]=Db.x;ta[J+1]=Db.y;ta[J+2]=Db.z;ta[J+3]=Db.w;ta[J+4]=Eb.x;ta[J+5]=Eb.y;ta[J+6]=Eb.z;ta[J+7]=Eb.w;ta[J+8]=Fb.x;ta[J+9]=Fb.y;ta[J+10]=Fb.z;ta[J+11]=Fb.w;ta[J+12]=vc.x;ta[J+13]=vc.y;ta[J+14]=vc.z;ta[J+15]=vc.w;Qb=fc[M.a];Rb=fc[M.b];Sb=fc[M.c];Hc=fc[M.d];ra[J]=Qb.x;ra[J+1]=Qb.y;ra[J+2]=Qb.z;
|
|
|
-ra[J+3]=1;ra[J+4]=Rb.x;ra[J+5]=Rb.y;ra[J+6]=Rb.z;ra[J+7]=1;ra[J+8]=Sb.x;ra[J+9]=Sb.y;ra[J+10]=Sb.z;ra[J+11]=1;ra[J+12]=Hc.x;ra[J+13]=Hc.y;ra[J+14]=Hc.z;ra[J+15]=1;Tb=gc[M.a];Ub=gc[M.b];Vb=gc[M.c];Ic=gc[M.d];sa[J]=Tb.x;sa[J+1]=Tb.y;sa[J+2]=Tb.z;sa[J+3]=1;sa[J+4]=Ub.x;sa[J+5]=Ub.y;sa[J+6]=Ub.z;sa[J+7]=1;sa[J+8]=Vb.x;sa[J+9]=Vb.y;sa[J+10]=Vb.z;sa[J+11]=1;sa[J+12]=Ic.x;sa[J+13]=Ic.y;sa[J+14]=Ic.z;sa[J+15]=1;J=J+16}if(J>0){j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexABuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-ra,Xa);j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer);j.bufferData(j.ARRAY_BUFFER,sa,Xa);j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer);j.bufferData(j.ARRAY_BUFFER,ta,Xa);j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer);j.bufferData(j.ARRAY_BUFFER,ua,Xa)}}if(ud&&Uc){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];nb=M.vertexColors;Gc=M.color;if(nb.length===3&&Uc===THREE.VertexColors){xb=nb[0];yb=nb[1];zb=nb[2]}else zb=yb=xb=Gc;La[Aa]=xb.r;La[Aa+1]=xb.g;La[Aa+2]=xb.b;La[Aa+3]=
|
|
|
-yb.r;La[Aa+4]=yb.g;La[Aa+5]=yb.b;La[Aa+6]=zb.r;La[Aa+7]=zb.g;La[Aa+8]=zb.b;Aa=Aa+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];nb=M.vertexColors;Gc=M.color;if(nb.length===4&&Uc===THREE.VertexColors){xb=nb[0];yb=nb[1];zb=nb[2];tc=nb[3]}else tc=zb=yb=xb=Gc;La[Aa]=xb.r;La[Aa+1]=xb.g;La[Aa+2]=xb.b;La[Aa+3]=yb.r;La[Aa+4]=yb.g;La[Aa+5]=yb.b;La[Aa+6]=zb.r;La[Aa+7]=zb.g;La[Aa+8]=zb.b;La[Aa+9]=tc.r;La[Aa+10]=tc.g;La[Aa+11]=tc.b;Aa=Aa+12}if(Aa>0){j.bindBuffer(j.ARRAY_BUFFER,ea.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-La,Xa)}}if(td&&Ta.hasTangents){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];Ib=M.vertexTangents;rb=Ib[0];sb=Ib[1];tb=Ib[2];qa[oa]=rb.x;qa[oa+1]=rb.y;qa[oa+2]=rb.z;qa[oa+3]=rb.w;qa[oa+4]=sb.x;qa[oa+5]=sb.y;qa[oa+6]=sb.z;qa[oa+7]=sb.w;qa[oa+8]=tb.x;qa[oa+9]=tb.y;qa[oa+10]=tb.z;qa[oa+11]=tb.w;oa=oa+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];Ib=M.vertexTangents;rb=Ib[0];sb=Ib[1];tb=Ib[2];rc=Ib[3];qa[oa]=rb.x;qa[oa+1]=rb.y;qa[oa+2]=rb.z;qa[oa+3]=rb.w;qa[oa+4]=sb.x;qa[oa+5]=sb.y;qa[oa+6]=sb.z;qa[oa+7]=sb.w;
|
|
|
-qa[oa+8]=tb.x;qa[oa+9]=tb.y;qa[oa+10]=tb.z;qa[oa+11]=tb.w;qa[oa+12]=rc.x;qa[oa+13]=rc.y;qa[oa+14]=rc.z;qa[oa+15]=rc.w;oa=oa+16}j.bindBuffer(j.ARRAY_BUFFER,ea.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,qa,Xa)}if(sd&&dd){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];kc=M.vertexNormals;Pb=M.normal;if(kc.length===3&&Fc)for(ka=0;ka<3;ka++){Wb=kc[ka];eb[Oa]=Wb.x;eb[Oa+1]=Wb.y;eb[Oa+2]=Wb.z;Oa=Oa+3}else for(ka=0;ka<3;ka++){eb[Oa]=Pb.x;eb[Oa+1]=Pb.y;eb[Oa+2]=Pb.z;Oa=Oa+3}}E=0;for(T=ma.length;E<T;E++){M=
|
|
|
-Ba[ma[E]];kc=M.vertexNormals;Pb=M.normal;if(kc.length===4&&Fc)for(ka=0;ka<4;ka++){Wb=kc[ka];eb[Oa]=Wb.x;eb[Oa+1]=Wb.y;eb[Oa+2]=Wb.z;Oa=Oa+3}else for(ka=0;ka<4;ka++){eb[Oa]=Pb.x;eb[Oa+1]=Pb.y;eb[Oa+2]=Pb.z;Oa=Oa+3}}j.bindBuffer(j.ARRAY_BUFFER,ea.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,eb,Xa)}if(hd&&Yc&&ed){E=0;for(T=la.length;E<T;E++){jb=la[E];M=Ba[jb];lc=Yc[jb];if(lc!==void 0)for(ka=0;ka<3;ka++){nc=lc[ka];wc[Kb]=nc.u;wc[Kb+1]=nc.v;Kb=Kb+2}}E=0;for(T=ma.length;E<T;E++){jb=ma[E];M=Ba[jb];lc=
|
|
|
-Yc[jb];if(lc!==void 0)for(ka=0;ka<4;ka++){nc=lc[ka];wc[Kb]=nc.u;wc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUVBuffer);j.bufferData(j.ARRAY_BUFFER,wc,Xa)}}if(hd&&Zc&&ed){E=0;for(T=la.length;E<T;E++){jb=la[E];M=Ba[jb];mc=Zc[jb];if(mc!==void 0)for(ka=0;ka<3;ka++){oc=mc[ka];xc[Lb]=oc.u;xc[Lb+1]=oc.v;Lb=Lb+2}}E=0;for(T=ma.length;E<T;E++){jb=ma[E];M=Ba[jb];mc=Zc[jb];if(mc!==void 0)for(ka=0;ka<4;ka++){oc=mc[ka];xc[Lb]=oc.u;xc[Lb+1]=oc.v;Lb=Lb+2}}if(Lb>0){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-ea.__webglUV2Buffer);j.bufferData(j.ARRAY_BUFFER,xc,Xa)}}if(rd){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];Gb[db]=xa;Gb[db+1]=xa+1;Gb[db+2]=xa+2;db=db+3;Za[Sa]=xa;Za[Sa+1]=xa+1;Za[Sa+2]=xa;Za[Sa+3]=xa+2;Za[Sa+4]=xa+1;Za[Sa+5]=xa+2;Sa=Sa+6;xa=xa+3}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];Gb[db]=xa;Gb[db+1]=xa+1;Gb[db+2]=xa+3;Gb[db+3]=xa+1;Gb[db+4]=xa+2;Gb[db+5]=xa+3;db=db+6;Za[Sa]=xa;Za[Sa+1]=xa+1;Za[Sa+2]=xa;Za[Sa+3]=xa+3;Za[Sa+4]=xa+1;Za[Sa+5]=xa+2;Za[Sa+6]=xa+2;Za[Sa+7]=xa+3;Sa=Sa+8;xa=xa+4}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-ea.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Gb,Xa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Za,Xa)}if(Xc){ka=0;for(fd=Xc.length;ka<fd;ka++){y=Xc[ka];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];A=A+3}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];y.array[A]=y.value[M.a];y.array[A+
|
|
|
-1]=y.value[M.b];y.array[A+2]=y.value[M.c];y.array[A+3]=y.value[M.d];A=A+4}}else{if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){Ya=y.value[la[E]];y.array[A]=Ya;y.array[A+1]=Ya;y.array[A+2]=Ya;A=A+3}E=0;for(T=ma.length;E<T;E++){Ya=y.value[ma[E]];y.array[A]=Ya;y.array[A+1]=Ya;y.array[A+2]=Ya;y.array[A+3]=Ya;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];y.array[A]=U.x;y.array[A+1]=U.y;
|
|
|
-y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;A=A+6}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}else{if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){W=V=U=Ya=y.value[la[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;
|
|
|
-A=A+6}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}}else if(y.size===3){var fa;fa=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+
|
|
|
-4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];A=A+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];y.array[A+9]=na[fa[0]];y.array[A+10]=na[fa[1]];y.array[A+11]=na[fa[2]];A=A+12}}else if(y.boundTo===
|
|
|
-"faces"){E=0;for(T=la.length;E<T;E++){W=V=U=Ya=y.value[la[E]];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];A=A+9}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+
|
|
|
-8]=W[fa[2]];y.array[A+9]=na[fa[0]];y.array[A+10]=na[fa[1]];y.array[A+11]=na[fa[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;A=A+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];
|
|
|
-V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}else if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){W=V=U=Ya=y.value[la[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+
|
|
|
-5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;A=A+12}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-y.array,Xa)}}}if(qd){delete ea.__inittedArrays;delete ea.__colorArray;delete ea.__normalArray;delete ea.__tangentArray;delete ea.__uvArray;delete ea.__uv2Array;delete ea.__faceArray;delete ea.__vertexArray;delete ea.__lineArray;delete ea.__skinVertexAArray;delete ea.__skinVertexBArray;delete ea.__skinIndexArray;delete ea.__skinWeightArray}}}}da.verticesNeedUpdate=false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=
|
|
|
-false;da.tangentsNeedUpdate=false;Va.attributes&&p(Va)}else if(mb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var $b=da,id=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,ac=void 0,Lc=void 0,jd=$b.vertices,kd=$b.colors,wd=jd.length,xd=kd.length,Mc=$b.__vertexArray,Nc=$b.__colorArray,yd=$b.colorsNeedUpdate;if($b.verticesNeedUpdate){for(yc=0;yc<wd;yc++){Kc=jd[yc];ac=yc*3;Mc[ac]=Kc.x;Mc[ac+1]=Kc.y;Mc[ac+2]=Kc.z}j.bindBuffer(j.ARRAY_BUFFER,$b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Mc,id)}if(yd){for(zc=0;zc<xd;zc++){Lc=kd[zc];ac=zc*3;Nc[ac]=Lc.r;Nc[ac+1]=Lc.g;Nc[ac+2]=Lc.b}j.bindBuffer(j.ARRAY_BUFFER,$b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Nc,id)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false}else if(mb instanceof THREE.Line){Va=c(mb,ab);gb=Va.attributes&&m(Va);if(da.verticesNeedUpdate||da.colorsNeedUpdate||gb){var Mb=da,$c=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,va=void 0,Pc=void 0,ld=Mb.vertices,md=Mb.colors,zd=ld.length,Ad=md.length,Qc=Mb.__vertexArray,
|
|
|
-Rc=Mb.__colorArray,Bd=Mb.colorsNeedUpdate,ad=Mb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Na=void 0,pc=void 0,Wa=void 0,pa=void 0;if(Mb.verticesNeedUpdate){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];va=Ac*3;Qc[va]=Oc.x;Qc[va+1]=Oc.y;Qc[va+2]=Oc.z}j.bindBuffer(j.ARRAY_BUFFER,Mb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,$c)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];va=Bc*3;Rc[va]=Pc.r;Rc[va+1]=Pc.g;Rc[va+2]=Pc.b}j.bindBuffer(j.ARRAY_BUFFER,Mb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,$c)}if(ad){Sc=
|
|
|
-0;for(nd=ad.length;Sc<nd;Sc++){pa=ad[Sc];if(pa.needsUpdate&&(pa.boundTo===void 0||pa.boundTo==="vertices")){va=0;pc=pa.value.length;if(pa.size===1)for(Na=0;Na<pc;Na++)pa.array[Na]=pa.value[Na];else if(pa.size===2)for(Na=0;Na<pc;Na++){Wa=pa.value[Na];pa.array[va]=Wa.x;pa.array[va+1]=Wa.y;va=va+2}else if(pa.size===3)if(pa.type==="c")for(Na=0;Na<pc;Na++){Wa=pa.value[Na];pa.array[va]=Wa.r;pa.array[va+1]=Wa.g;pa.array[va+2]=Wa.b;va=va+3}else for(Na=0;Na<pc;Na++){Wa=pa.value[Na];pa.array[va]=Wa.x;pa.array[va+
|
|
|
-1]=Wa.y;pa.array[va+2]=Wa.z;va=va+3}else if(pa.size===4)for(Na=0;Na<pc;Na++){Wa=pa.value[Na];pa.array[va]=Wa.x;pa.array[va+1]=Wa.y;pa.array[va+2]=Wa.z;pa.array[va+3]=Wa.w;va=va+4}j.bindBuffer(j.ARRAY_BUFFER,pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,$c)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Va.attributes&&p(Va)}else if(mb instanceof THREE.ParticleSystem){Va=c(mb,ab);gb=Va.attributes&&m(Va);(da.verticesNeedUpdate||da.colorsNeedUpdate||mb.sortParticles||gb)&&f(da,j.DYNAMIC_DRAW,
|
|
|
-mb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Va.attributes&&p(Va)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];
|
|
|
-a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,k,l,m,n;i=m=n=h=0;for(k=b.length;i<k;i++){l=b[i];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=Q){k=m;l=n;m=h}else{k=Math.ceil(Q*m/(n+m));m=l=Q-k}var o=0,h=0;for(n=b.length;h<n;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&o++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&
|
|
|
-o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{i=a.fragmentShader;n=a.vertexShader;var h=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,
|
|
|
-shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(i);d.push(n)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=P.length;q<d;q++){k=P[q];if(k.code===g){k.usedTimes++;r=k.program;break a}}q=j.createProgram();d=["precision "+v+" float;",ab>
|
|
|
-0?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":
|
|
|
-"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-k=["precision "+v+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
|
|
|
+true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,k,P=[],L=0,S=null,aa=null,K=-1,ca=null,ha=null,O=0,Z=-1,$=-1,X=-1,ia=-1,za=-1,Ga=-1,Oa=-1,Pa=-1,Ta=null,Wa=null,lb=null,$a=null,mb=0,Fb=0,ab=0,nb=0,bb=0,Ha=0,wa=new THREE.Frustum,ib=new THREE.Matrix4,xa=new THREE.Matrix4,Qa=new THREE.Vector4,Da=new THREE.Vector3,ja=true,ob={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},
|
|
|
+point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};k=function(){var a;try{if(!(a=z.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:I,antialias:N,stencil:R,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";}catch(b){console.error(b)}a.getExtension("OES_texture_float")||console.log("THREE.WebGLRenderer: Float textures not supported.");return a}();k.clearColor(0,0,0,1);k.clearDepth(1);
|
|
|
+k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(B.r,B.g,B.b,G);this.context=k;var fb=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var bc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return k};this.supportsVertexTextures=function(){return fb>0};this.setSize=
|
|
|
+function(a,b){z.width=a;z.height=b;this.setViewport(0,0,z.width,z.height)};this.setViewport=function(a,b,c,d){mb=a;Fb=b;ab=c;nb=d;k.viewport(mb,Fb,ab,nb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);G=b;k.clearColor(B.r,B.g,B.b,G)};this.setClearColor=function(a,b){B.copy(a);G=b;k.clearColor(B.r,B.g,B.b,G)};this.getClearColor=function(){return B};this.getClearAlpha=
|
|
|
+function(){return G};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;
|
|
|
+delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);
|
|
|
+k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}D.info.memory.geometries--}else if(a instanceof
|
|
|
+THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);D.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
|
|
|
+false;k.deleteTexture(a.__webglTexture);D.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=
|
|
|
+false,a=0;for(c=P.length;a<c;a++){d=P[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=P.length;a<c;a++){d=P[a];d.program!==b&&e.push(d)}P=e;k.deleteProgram(b);D.info.memory.programs--}}};this.updateShadowMap=function(a,b){S=null;K=ca=Pa=Oa=X=-1;ja=true;$=Z=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
|
|
|
+k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=k.createBuffer();if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
+e,f,g,h,i,j,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];i=n[o+4];l=n[o+5];h=n[o+6];j=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+i+j)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
+a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=
|
|
|
+q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,g*i*4);h=e.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,i,k.FLOAT,false,0,g*i*4)}h=e.attributes.uv;
|
|
|
+if(a.uv>=0&&h)if(h.buffer){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,i,k.FLOAT,false,0,g*i*4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);h=e.attributes.color;if(a.color>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.color,i,k.FLOAT,false,0,g*i*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=
|
|
|
+D.info.render.vertices+f[d].count;D.info.render.faces=D.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<i.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[j]]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);
|
|
|
+if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[j]]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[i[j]];j++}}else{i=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){j=g[l];j>0&&i.push([l,j])}if(i.length>d.numSupportedMorphTargets){i.sort(h);i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(h):i.length===0&&i.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(i[j]){l=
|
|
|
+i[j][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[l]}else{k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==
|
|
|
+null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=
|
|
|
+0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);
|
|
|
+k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,
|
|
|
+4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==$a){k.lineWidth(d);$a=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}D.info.render.calls++;
|
|
|
+D.info.render.vertices=D.info.render.vertices+e.__webglFaceCount;D.info.render.faces=D.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==$a){k.lineWidth(d);$a=d}k.drawArrays(f,0,e.__webglLineCount);D.info.render.calls++}else if(f instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);D.info.render.calls++;D.info.render.points=D.info.render.points+e.__webglParticleCount}else if(f instanceof
|
|
|
+THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);D.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;K=-1;ja=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ib.multiply(b.projectionMatrix,b.matrixWorldInverse);wa.setFromMatrix(ib);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;
|
|
|
+for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||wa.contains(h))){s(h,b);var p=f,r=p.object,q=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=q.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=
|
|
|
+null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{Qa.copy(h.matrixWorld.getPosition());ib.multiplyVector3(Qa);f.z=Qa.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){s(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);
|
|
|
+this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
|
|
|
+c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);ca=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,
|
|
|
+k,wa):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=
|
|
|
+j,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,x=void 0,z=void 0,F={},C=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];v=u.materialIndex;x=v!==void 0?v:-1;F[x]===void 0&&(F[x]={hash:x,counter:0});z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B});w=u instanceof THREE.Face3?3:4;if(q.geometryGroups[z].vertices+w>65535){F[x].counter=
|
|
|
+F[x].counter+1;z=F[x].hash+"_"+F[x].counter;q.geometryGroups[z]===void 0&&(q.geometryGroups[z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[z].faces3.push(s):q.geometryGroups[z].faces4.push(s);q.geometryGroups[z].vertices=q.geometryGroups[z].vertices+w}q.geometryGroupsList=[];var H=void 0;for(H in q.geometryGroups){q.geometryGroups[H].id=O++;q.geometryGroupsList.push(q.geometryGroups[H])}}for(i in j.geometryGroups){l=
|
|
|
+j.geometryGroups[i];if(!l.__webglVertexBuffer){var K=l;K.__webglVertexBuffer=k.createBuffer();K.__webglNormalBuffer=k.createBuffer();K.__webglTangentBuffer=k.createBuffer();K.__webglColorBuffer=k.createBuffer();K.__webglUVBuffer=k.createBuffer();K.__webglUV2Buffer=k.createBuffer();K.__webglSkinVertexABuffer=k.createBuffer();K.__webglSkinVertexBBuffer=k.createBuffer();K.__webglSkinIndicesBuffer=k.createBuffer();K.__webglSkinWeightsBuffer=k.createBuffer();K.__webglFaceBuffer=k.createBuffer();K.__webglLineBuffer=
|
|
|
+k.createBuffer();var Z=void 0,I=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];Z=0;for(I=K.numMorphTargets;Z<I;Z++)K.__webglMorphTargetsBuffers.push(k.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];Z=0;for(I=K.numMorphNormals;Z<I;Z++)K.__webglMorphNormalsBuffers.push(k.createBuffer())}D.info.memory.geometries++;var G=l,L=g,X=L.geometry,N=G.faces3,$=G.faces4,S=N.length*3+$.length*4,Q=N.length*1+$.length*2,R=N.length*3+$.length*4,P=c(L,G),aa=e(P),Y=d(P),ha=P.vertexColors?
|
|
|
+P.vertexColors:false;G.__vertexArray=new Float32Array(S*3);if(Y)G.__normalArray=new Float32Array(S*3);if(X.hasTangents)G.__tangentArray=new Float32Array(S*4);if(ha)G.__colorArray=new Float32Array(S*3);if(aa){if(X.faceUvs.length>0||X.faceVertexUvs.length>0)G.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(S*2)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(S*4);G.__skinVertexBArray=
|
|
|
+new Float32Array(S*4);G.__skinIndexArray=new Float32Array(S*4);G.__skinWeightArray=new Float32Array(S*4)}G.__faceArray=new Uint16Array(Q*3);G.__lineArray=new Uint16Array(R*2);var ca=void 0,ia=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ca=0;for(ia=G.numMorphTargets;ca<ia;ca++)G.__morphTargetsArrays.push(new Float32Array(S*3))}if(G.numMorphNormals){G.__morphNormalsArrays=[];ca=0;for(ia=G.numMorphNormals;ca<ia;ca++)G.__morphNormalsArrays.push(new Float32Array(S*3))}G.__webglFaceCount=Q*3;
|
|
|
+G.__webglLineCount=R*2;if(P.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Oa=void 0;for(Oa in P.attributes){var Ga=P.attributes[Oa],za={},Pa;for(Pa in Ga)za[Pa]=Ga[Pa];if(!za.__webglInitialized||za.createUniqueBuffers){za.__webglInitialized=true;var ja=1;za.type==="v2"?ja=2:za.type==="v3"?ja=3:za.type==="v4"?ja=4:za.type==="c"&&(ja=3);za.size=ja;za.array=new Float32Array(S*ja);za.buffer=k.createBuffer();za.buffer.belongsToAttribute=Oa;Ga.needsUpdate=true;
|
|
|
+za.__original=Ga}G.__webglCustomAttributesList.push(za)}}G.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangentsNeedUpdate=true;j.colorsNeedUpdate=true}}}else if(j instanceof THREE.BufferGeometry){var Ta=j,xa=void 0,wa=void 0,Da=void 0;for(xa in Ta.attributes){Da=xa==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;wa=Ta.attributes[xa];wa.buffer=k.createBuffer();k.bindBuffer(Da,wa.buffer);k.bufferData(Da,
|
|
|
+wa.array,k.STATIC_DRAW)}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Ha=j;Ha.__webglVertexBuffer=k.createBuffer();Ha.__webglColorBuffer=k.createBuffer();D.info.memory.geometries++;var Wa=j,Qa=Wa.vertices.length;Wa.__vertexArray=new Float32Array(Qa*3);Wa.__colorArray=new Float32Array(Qa*3);Wa.__webglVertexCount=Qa;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var bb=j;bb.__webglVertexBuffer=
|
|
|
+k.createBuffer();bb.__webglColorBuffer=k.createBuffer();D.info.memory.geometries++;var $a=j,ib=g,mb=$a.vertices.length;$a.__vertexArray=new Float32Array(mb*3);$a.__colorArray=new Float32Array(mb*3);$a.__webglLineCount=mb;b($a,ib);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Fb=j;Fb.__webglVertexBuffer=k.createBuffer();Fb.__webglColorBuffer=k.createBuffer();D.info.geometries++;var ab=j,ob=g,fb=ab.vertices.length;
|
|
|
+ab.__vertexArray=new Float32Array(fb*3);ab.__colorArray=new Float32Array(fb*3);ab.__sortArray=[];ab.__webglParticleCount=fb;b(ab,ob);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)o(h.__webglObjects,j,g);else for(i in j.geometryGroups){l=j.geometryGroups[i];o(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;o(h.__webglObjects,
|
|
|
+j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var cb=a.__objectsRemoved[0],lb=a;cb instanceof THREE.Mesh||cb instanceof THREE.ParticleSystem||cb instanceof THREE.Ribbon||cb instanceof THREE.Line?r(lb.__webglObjects,
|
|
|
+cb):cb instanceof THREE.Sprite?n(lb.__webglSprites,cb):cb instanceof THREE.LensFlare?n(lb.__webglFlares,cb):(cb instanceof THREE.ImmediateRenderObject||cb.immediateRenderCallback)&&r(lb.__webglObjectsImmediate,cb);cb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var nb=0,bc=a.__webglObjects.length;nb<bc;nb++){var jb=a.__webglObjects[nb].object,da=jb.geometry,sc=void 0,kc=void 0,Ua=void 0;if(jb instanceof THREE.Mesh)if(da instanceof THREE.BufferGeometry){if(da.verticesNeedUpdate||da.elementsNeedUpdate||
|
|
|
+da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate){var Ob=da,tc=k.DYNAMIC_DRAW,yd=!da.dynamic,uc=Ob.attributes,Xc=uc.index,Yc=uc.position,Zc=uc.normal,$c=uc.uv,ad=uc.color;if(Ob.elementsNeedUpdate&&Xc!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Xc.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Xc.array,tc)}if(Ob.verticesNeedUpdate&&Yc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,Yc.buffer);k.bufferData(k.ARRAY_BUFFER,Yc.array,tc)}if(Ob.normalsNeedUpdate&&Zc!==void 0){k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+Zc.buffer);k.bufferData(k.ARRAY_BUFFER,Zc.array,tc)}if(Ob.uvsNeedUpdate&&$c!==void 0){k.bindBuffer(k.ARRAY_BUFFER,$c.buffer);k.bufferData(k.ARRAY_BUFFER,$c.array,tc)}if(Ob.colorsNeedUpdate&&ad!==void 0){k.bindBuffer(k.ARRAY_BUFFER,ad.buffer);k.bufferData(k.ARRAY_BUFFER,ad.array,tc)}if(yd){var md=void 0;for(md in Ob.attributes)delete Ob.attributes[md].array}}da.verticesNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false}else{for(var bd=
|
|
|
+0,zd=da.geometryGroupsList.length;bd<zd;bd++){sc=da.geometryGroupsList[bd];Ua=c(jb,sc);kc=Ua.attributes&&m(Ua);if(da.verticesNeedUpdate||da.morphTargetsNeedUpdate||da.elementsNeedUpdate||da.uvsNeedUpdate||da.normalsNeedUpdate||da.colorsNeedUpdate||da.tangentsNeedUpdate||kc){var ea=sc,Ad=jb,Xa=k.DYNAMIC_DRAW,Bd=!da.dynamic,dc=Ua;if(ea.__inittedArrays){var nd=d(dc),cd=dc.vertexColors?dc.vertexColors:false,od=e(dc),Jc=nd===THREE.SmoothShading,E=void 0,T=void 0,hb=void 0,M=void 0,lc=void 0,Pb=void 0,
|
|
|
+kb=void 0,Kc=void 0,Hb=void 0,mc=void 0,nc=void 0,U=void 0,V=void 0,W=void 0,na=void 0,pb=void 0,qb=void 0,rb=void 0,vc=void 0,sb=void 0,tb=void 0,ub=void 0,wc=void 0,vb=void 0,wb=void 0,xb=void 0,xc=void 0,yb=void 0,zb=void 0,Ab=void 0,yc=void 0,Bb=void 0,Cb=void 0,Db=void 0,zc=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Lc=void 0,Tb=void 0,Ub=void 0,Vb=void 0,Mc=void 0,ka=void 0,pd=void 0,Wb=void 0,oc=void 0,pc=void 0,Ia=void 0,qd=void 0,Ea=void 0,Fa=void 0,Xb=void 0,Ib=void 0,ya=0,Ca=0,Jb=0,Kb=0,db=0,
|
|
|
+Na=0,oa=0,Ra=0,Aa=0,J=0,ba=0,A=0,Ya=void 0,Ja=ea.__vertexArray,Ac=ea.__uvArray,Bc=ea.__uv2Array,eb=ea.__normalArray,qa=ea.__tangentArray,Ka=ea.__colorArray,ra=ea.__skinVertexAArray,sa=ea.__skinVertexBArray,ta=ea.__skinIndexArray,ua=ea.__skinWeightArray,dd=ea.__morphTargetsArrays,ed=ea.__morphNormalsArrays,fd=ea.__webglCustomAttributesList,y=void 0,Eb=ea.__faceArray,Za=ea.__lineArray,Sa=Ad.geometry,Cd=Sa.elementsNeedUpdate,rd=Sa.uvsNeedUpdate,Dd=Sa.normalsNeedUpdate,Ed=Sa.tangentsNeedUpdate,Fd=Sa.colorsNeedUpdate,
|
|
|
+Gd=Sa.morphTargetsNeedUpdate,ec=Sa.vertices,la=ea.faces3,ma=ea.faces4,Ba=Sa.faces,gd=Sa.faceVertexUvs[0],hd=Sa.faceVertexUvs[1],fc=Sa.skinVerticesA,gc=Sa.skinVerticesB,hc=Sa.skinIndices,Yb=Sa.skinWeights,Zb=Sa.morphTargets,Nc=Sa.morphNormals;if(Sa.verticesNeedUpdate){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=ec[M.a];V=ec[M.b];W=ec[M.c];Ja[Ca]=U.x;Ja[Ca+1]=U.y;Ja[Ca+2]=U.z;Ja[Ca+3]=V.x;Ja[Ca+4]=V.y;Ja[Ca+5]=V.z;Ja[Ca+6]=W.x;Ja[Ca+7]=W.y;Ja[Ca+8]=W.z;Ca=Ca+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];
|
|
|
+U=ec[M.a];V=ec[M.b];W=ec[M.c];na=ec[M.d];Ja[Ca]=U.x;Ja[Ca+1]=U.y;Ja[Ca+2]=U.z;Ja[Ca+3]=V.x;Ja[Ca+4]=V.y;Ja[Ca+5]=V.z;Ja[Ca+6]=W.x;Ja[Ca+7]=W.y;Ja[Ca+8]=W.z;Ja[Ca+9]=na.x;Ja[Ca+10]=na.y;Ja[Ca+11]=na.z;Ca=Ca+12}k.bindBuffer(k.ARRAY_BUFFER,ea.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ja,Xa)}if(Gd){Ia=0;for(qd=Zb.length;Ia<qd;Ia++){E=ba=0;for(T=la.length;E<T;E++){Xb=la[E];M=Ba[Xb];U=Zb[Ia].vertices[M.a];V=Zb[Ia].vertices[M.b];W=Zb[Ia].vertices[M.c];Ea=dd[Ia];Ea[ba]=U.x;Ea[ba+1]=U.y;Ea[ba+2]=U.z;
|
|
|
+Ea[ba+3]=V.x;Ea[ba+4]=V.y;Ea[ba+5]=V.z;Ea[ba+6]=W.x;Ea[ba+7]=W.y;Ea[ba+8]=W.z;if(dc.morphNormals){if(Jc){Ib=Nc[Ia].vertexNormals[Xb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Nc[Ia].faceNormals[Xb];Fa=ed[Ia];Fa[ba]=sb.x;Fa[ba+1]=sb.y;Fa[ba+2]=sb.z;Fa[ba+3]=tb.x;Fa[ba+4]=tb.y;Fa[ba+5]=tb.z;Fa[ba+6]=ub.x;Fa[ba+7]=ub.y;Fa[ba+8]=ub.z}ba=ba+9}E=0;for(T=ma.length;E<T;E++){Xb=ma[E];M=Ba[Xb];U=Zb[Ia].vertices[M.a];V=Zb[Ia].vertices[M.b];W=Zb[Ia].vertices[M.c];na=Zb[Ia].vertices[M.d];Ea=dd[Ia];Ea[ba]=U.x;Ea[ba+
|
|
|
+1]=U.y;Ea[ba+2]=U.z;Ea[ba+3]=V.x;Ea[ba+4]=V.y;Ea[ba+5]=V.z;Ea[ba+6]=W.x;Ea[ba+7]=W.y;Ea[ba+8]=W.z;Ea[ba+9]=na.x;Ea[ba+10]=na.y;Ea[ba+11]=na.z;if(dc.morphNormals){if(Jc){Ib=Nc[Ia].vertexNormals[Xb];sb=Ib.a;tb=Ib.b;ub=Ib.c;wc=Ib.d}else wc=ub=tb=sb=Nc[Ia].faceNormals[Xb];Fa=ed[Ia];Fa[ba]=sb.x;Fa[ba+1]=sb.y;Fa[ba+2]=sb.z;Fa[ba+3]=tb.x;Fa[ba+4]=tb.y;Fa[ba+5]=tb.z;Fa[ba+6]=ub.x;Fa[ba+7]=ub.y;Fa[ba+8]=ub.z;Fa[ba+9]=wc.x;Fa[ba+10]=wc.y;Fa[ba+11]=wc.z}ba=ba+12}k.bindBuffer(k.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[Ia]);
|
|
|
+k.bufferData(k.ARRAY_BUFFER,dd[Ia],Xa);if(dc.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,ea.__webglMorphNormalsBuffers[Ia]);k.bufferData(k.ARRAY_BUFFER,ed[Ia],Xa)}}}if(Yb.length){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];yb=Yb[M.a];zb=Yb[M.b];Ab=Yb[M.c];ua[J]=yb.x;ua[J+1]=yb.y;ua[J+2]=yb.z;ua[J+3]=yb.w;ua[J+4]=zb.x;ua[J+5]=zb.y;ua[J+6]=zb.z;ua[J+7]=zb.w;ua[J+8]=Ab.x;ua[J+9]=Ab.y;ua[J+10]=Ab.z;ua[J+11]=Ab.w;Bb=hc[M.a];Cb=hc[M.b];Db=hc[M.c];ta[J]=Bb.x;ta[J+1]=Bb.y;ta[J+2]=Bb.z;ta[J+3]=Bb.w;ta[J+4]=Cb.x;
|
|
|
+ta[J+5]=Cb.y;ta[J+6]=Cb.z;ta[J+7]=Cb.w;ta[J+8]=Db.x;ta[J+9]=Db.y;ta[J+10]=Db.z;ta[J+11]=Db.w;Qb=fc[M.a];Rb=fc[M.b];Sb=fc[M.c];ra[J]=Qb.x;ra[J+1]=Qb.y;ra[J+2]=Qb.z;ra[J+3]=1;ra[J+4]=Rb.x;ra[J+5]=Rb.y;ra[J+6]=Rb.z;ra[J+7]=1;ra[J+8]=Sb.x;ra[J+9]=Sb.y;ra[J+10]=Sb.z;ra[J+11]=1;Tb=gc[M.a];Ub=gc[M.b];Vb=gc[M.c];sa[J]=Tb.x;sa[J+1]=Tb.y;sa[J+2]=Tb.z;sa[J+3]=1;sa[J+4]=Ub.x;sa[J+5]=Ub.y;sa[J+6]=Ub.z;sa[J+7]=1;sa[J+8]=Vb.x;sa[J+9]=Vb.y;sa[J+10]=Vb.z;sa[J+11]=1;J=J+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];
|
|
|
+yb=Yb[M.a];zb=Yb[M.b];Ab=Yb[M.c];yc=Yb[M.d];ua[J]=yb.x;ua[J+1]=yb.y;ua[J+2]=yb.z;ua[J+3]=yb.w;ua[J+4]=zb.x;ua[J+5]=zb.y;ua[J+6]=zb.z;ua[J+7]=zb.w;ua[J+8]=Ab.x;ua[J+9]=Ab.y;ua[J+10]=Ab.z;ua[J+11]=Ab.w;ua[J+12]=yc.x;ua[J+13]=yc.y;ua[J+14]=yc.z;ua[J+15]=yc.w;Bb=hc[M.a];Cb=hc[M.b];Db=hc[M.c];zc=hc[M.d];ta[J]=Bb.x;ta[J+1]=Bb.y;ta[J+2]=Bb.z;ta[J+3]=Bb.w;ta[J+4]=Cb.x;ta[J+5]=Cb.y;ta[J+6]=Cb.z;ta[J+7]=Cb.w;ta[J+8]=Db.x;ta[J+9]=Db.y;ta[J+10]=Db.z;ta[J+11]=Db.w;ta[J+12]=zc.x;ta[J+13]=zc.y;ta[J+14]=zc.z;ta[J+
|
|
|
+15]=zc.w;Qb=fc[M.a];Rb=fc[M.b];Sb=fc[M.c];Lc=fc[M.d];ra[J]=Qb.x;ra[J+1]=Qb.y;ra[J+2]=Qb.z;ra[J+3]=1;ra[J+4]=Rb.x;ra[J+5]=Rb.y;ra[J+6]=Rb.z;ra[J+7]=1;ra[J+8]=Sb.x;ra[J+9]=Sb.y;ra[J+10]=Sb.z;ra[J+11]=1;ra[J+12]=Lc.x;ra[J+13]=Lc.y;ra[J+14]=Lc.z;ra[J+15]=1;Tb=gc[M.a];Ub=gc[M.b];Vb=gc[M.c];Mc=gc[M.d];sa[J]=Tb.x;sa[J+1]=Tb.y;sa[J+2]=Tb.z;sa[J+3]=1;sa[J+4]=Ub.x;sa[J+5]=Ub.y;sa[J+6]=Ub.z;sa[J+7]=1;sa[J+8]=Vb.x;sa[J+9]=Vb.y;sa[J+10]=Vb.z;sa[J+11]=1;sa[J+12]=Mc.x;sa[J+13]=Mc.y;sa[J+14]=Mc.z;sa[J+15]=1;J=J+
|
|
|
+16}if(J>0){k.bindBuffer(k.ARRAY_BUFFER,ea.__webglSkinVertexABuffer);k.bufferData(k.ARRAY_BUFFER,ra,Xa);k.bindBuffer(k.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer);k.bufferData(k.ARRAY_BUFFER,sa,Xa);k.bindBuffer(k.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,ta,Xa);k.bindBuffer(k.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,ua,Xa)}}if(Fd&&cd){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];kb=M.vertexColors;Kc=M.color;if(kb.length===3&&cd===THREE.VertexColors){vb=
|
|
|
+kb[0];wb=kb[1];xb=kb[2]}else xb=wb=vb=Kc;Ka[Aa]=vb.r;Ka[Aa+1]=vb.g;Ka[Aa+2]=vb.b;Ka[Aa+3]=wb.r;Ka[Aa+4]=wb.g;Ka[Aa+5]=wb.b;Ka[Aa+6]=xb.r;Ka[Aa+7]=xb.g;Ka[Aa+8]=xb.b;Aa=Aa+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];kb=M.vertexColors;Kc=M.color;if(kb.length===4&&cd===THREE.VertexColors){vb=kb[0];wb=kb[1];xb=kb[2];xc=kb[3]}else xc=xb=wb=vb=Kc;Ka[Aa]=vb.r;Ka[Aa+1]=vb.g;Ka[Aa+2]=vb.b;Ka[Aa+3]=wb.r;Ka[Aa+4]=wb.g;Ka[Aa+5]=wb.b;Ka[Aa+6]=xb.r;Ka[Aa+7]=xb.g;Ka[Aa+8]=xb.b;Ka[Aa+9]=xc.r;Ka[Aa+10]=xc.g;Ka[Aa+
|
|
|
+11]=xc.b;Aa=Aa+12}if(Aa>0){k.bindBuffer(k.ARRAY_BUFFER,ea.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ka,Xa)}}if(Ed&&Sa.hasTangents){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];Hb=M.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];qa[oa]=pb.x;qa[oa+1]=pb.y;qa[oa+2]=pb.z;qa[oa+3]=pb.w;qa[oa+4]=qb.x;qa[oa+5]=qb.y;qa[oa+6]=qb.z;qa[oa+7]=qb.w;qa[oa+8]=rb.x;qa[oa+9]=rb.y;qa[oa+10]=rb.z;qa[oa+11]=rb.w;oa=oa+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];Hb=M.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];vc=Hb[3];qa[oa]=
|
|
|
+pb.x;qa[oa+1]=pb.y;qa[oa+2]=pb.z;qa[oa+3]=pb.w;qa[oa+4]=qb.x;qa[oa+5]=qb.y;qa[oa+6]=qb.z;qa[oa+7]=qb.w;qa[oa+8]=rb.x;qa[oa+9]=rb.y;qa[oa+10]=rb.z;qa[oa+11]=rb.w;qa[oa+12]=vc.x;qa[oa+13]=vc.y;qa[oa+14]=vc.z;qa[oa+15]=vc.w;oa=oa+16}k.bindBuffer(k.ARRAY_BUFFER,ea.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,qa,Xa)}if(Dd&&nd){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];lc=M.vertexNormals;Pb=M.normal;if(lc.length===3&&Jc)for(ka=0;ka<3;ka++){Wb=lc[ka];eb[Na]=Wb.x;eb[Na+1]=Wb.y;eb[Na+2]=Wb.z;Na=Na+3}else for(ka=
|
|
|
+0;ka<3;ka++){eb[Na]=Pb.x;eb[Na+1]=Pb.y;eb[Na+2]=Pb.z;Na=Na+3}}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];lc=M.vertexNormals;Pb=M.normal;if(lc.length===4&&Jc)for(ka=0;ka<4;ka++){Wb=lc[ka];eb[Na]=Wb.x;eb[Na+1]=Wb.y;eb[Na+2]=Wb.z;Na=Na+3}else for(ka=0;ka<4;ka++){eb[Na]=Pb.x;eb[Na+1]=Pb.y;eb[Na+2]=Pb.z;Na=Na+3}}k.bindBuffer(k.ARRAY_BUFFER,ea.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,eb,Xa)}if(rd&&gd&&od){E=0;for(T=la.length;E<T;E++){hb=la[E];M=Ba[hb];mc=gd[hb];if(mc!==void 0)for(ka=0;ka<3;ka++){oc=
|
|
|
+mc[ka];Ac[Jb]=oc.u;Ac[Jb+1]=oc.v;Jb=Jb+2}}E=0;for(T=ma.length;E<T;E++){hb=ma[E];M=Ba[hb];mc=gd[hb];if(mc!==void 0)for(ka=0;ka<4;ka++){oc=mc[ka];Ac[Jb]=oc.u;Ac[Jb+1]=oc.v;Jb=Jb+2}}if(Jb>0){k.bindBuffer(k.ARRAY_BUFFER,ea.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,Ac,Xa)}}if(rd&&hd&&od){E=0;for(T=la.length;E<T;E++){hb=la[E];M=Ba[hb];nc=hd[hb];if(nc!==void 0)for(ka=0;ka<3;ka++){pc=nc[ka];Bc[Kb]=pc.u;Bc[Kb+1]=pc.v;Kb=Kb+2}}E=0;for(T=ma.length;E<T;E++){hb=ma[E];M=Ba[hb];nc=hd[hb];if(nc!==void 0)for(ka=
|
|
|
+0;ka<4;ka++){pc=nc[ka];Bc[Kb]=pc.u;Bc[Kb+1]=pc.v;Kb=Kb+2}}if(Kb>0){k.bindBuffer(k.ARRAY_BUFFER,ea.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,Bc,Xa)}}if(Cd){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];Eb[db]=ya;Eb[db+1]=ya+1;Eb[db+2]=ya+2;db=db+3;Za[Ra]=ya;Za[Ra+1]=ya+1;Za[Ra+2]=ya;Za[Ra+3]=ya+2;Za[Ra+4]=ya+1;Za[Ra+5]=ya+2;Ra=Ra+6;ya=ya+3}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];Eb[db]=ya;Eb[db+1]=ya+1;Eb[db+2]=ya+3;Eb[db+3]=ya+1;Eb[db+4]=ya+2;Eb[db+5]=ya+3;db=db+6;Za[Ra]=ya;Za[Ra+1]=ya+1;Za[Ra+2]=
|
|
|
+ya;Za[Ra+3]=ya+3;Za[Ra+4]=ya+1;Za[Ra+5]=ya+2;Za[Ra+6]=ya+2;Za[Ra+7]=ya+3;Ra=Ra+8;ya=ya+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Eb,Xa);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Za,Xa)}if(fd){ka=0;for(pd=fd.length;ka<pd;ka++){y=fd[ka];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];y.array[A]=y.value[M.a];y.array[A+
|
|
|
+1]=y.value[M.b];y.array[A+2]=y.value[M.c];A=A+3}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];y.array[A]=y.value[M.a];y.array[A+1]=y.value[M.b];y.array[A+2]=y.value[M.c];y.array[A+3]=y.value[M.d];A=A+4}}else{if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){Ya=y.value[la[E]];y.array[A]=Ya;y.array[A+1]=Ya;y.array[A+2]=Ya;A=A+3}E=0;for(T=ma.length;E<T;E++){Ya=y.value[ma[E]];y.array[A]=Ya;y.array[A+1]=Ya;y.array[A+2]=Ya;y.array[A+3]=Ya;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){E=
|
|
|
+0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;A=A+6}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}else{if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){W=V=U=Ya=
|
|
|
+y.value[la[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;A=A+6}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=V.x;y.array[A+3]=V.y;y.array[A+4]=W.x;y.array[A+5]=W.y;y.array[A+6]=na.x;y.array[A+7]=na.y;A=A+8}}}else if(y.size===3){var fa;fa=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];
|
|
|
+W=y.value[M.c];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];A=A+9}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+
|
|
|
+8]=W[fa[2]];y.array[A+9]=na[fa[0]];y.array[A+10]=na[fa[1]];y.array[A+11]=na[fa[2]];A=A+12}}else if(y.boundTo==="faces"){E=0;for(T=la.length;E<T;E++){W=V=U=Ya=y.value[la[E]];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];A=A+9}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U[fa[0]];y.array[A+1]=U[fa[1]];y.array[A+2]=U[fa[2]];y.array[A+
|
|
|
+3]=V[fa[0]];y.array[A+4]=V[fa[1]];y.array[A+5]=V[fa[2]];y.array[A+6]=W[fa[0]];y.array[A+7]=W[fa[1]];y.array[A+8]=W[fa[2]];y.array[A+9]=na[fa[0]];y.array[A+10]=na[fa[1]];y.array[A+11]=na[fa[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){E=0;for(T=la.length;E<T;E++){M=Ba[la[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=
|
|
|
+W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;A=A+12}E=0;for(T=ma.length;E<T;E++){M=Ba[ma[E]];U=y.value[M.a];V=y.value[M.b];W=y.value[M.c];na=y.value[M.d];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}else if(y.boundTo==="faces"){E=0;for(T=la.length;E<
|
|
|
+T;E++){W=V=U=Ya=y.value[la[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;A=A+12}E=0;for(T=ma.length;E<T;E++){na=W=V=U=Ya=y.value[ma[E]];y.array[A]=U.x;y.array[A+1]=U.y;y.array[A+2]=U.z;y.array[A+3]=U.w;y.array[A+4]=V.x;y.array[A+5]=V.y;y.array[A+6]=V.z;y.array[A+7]=V.w;y.array[A+8]=W.x;y.array[A+9]=W.y;y.array[A+10]=W.z;y.array[A+11]=W.w;
|
|
|
+y.array[A+12]=na.x;y.array[A+13]=na.y;y.array[A+14]=na.z;y.array[A+15]=na.w;A=A+16}}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,Xa)}}}if(Bd){delete ea.__inittedArrays;delete ea.__colorArray;delete ea.__normalArray;delete ea.__tangentArray;delete ea.__uvArray;delete ea.__uv2Array;delete ea.__faceArray;delete ea.__vertexArray;delete ea.__lineArray;delete ea.__skinVertexAArray;delete ea.__skinVertexBArray;delete ea.__skinIndexArray;delete ea.__skinWeightArray}}}}da.verticesNeedUpdate=
|
|
|
+false;da.morphTargetsNeedUpdate=false;da.elementsNeedUpdate=false;da.uvsNeedUpdate=false;da.normalsNeedUpdate=false;da.colorsNeedUpdate=false;da.tangentsNeedUpdate=false;Ua.attributes&&p(Ua)}else if(jb instanceof THREE.Ribbon){if(da.verticesNeedUpdate||da.colorsNeedUpdate){var $b=da,sd=k.DYNAMIC_DRAW,Cc=void 0,Dc=void 0,Oc=void 0,ac=void 0,Pc=void 0,td=$b.vertices,ud=$b.colors,Hd=td.length,Id=ud.length,Qc=$b.__vertexArray,Rc=$b.__colorArray,Jd=$b.colorsNeedUpdate;if($b.verticesNeedUpdate){for(Cc=
|
|
|
+0;Cc<Hd;Cc++){Oc=td[Cc];ac=Cc*3;Qc[ac]=Oc.x;Qc[ac+1]=Oc.y;Qc[ac+2]=Oc.z}k.bindBuffer(k.ARRAY_BUFFER,$b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Qc,sd)}if(Jd){for(Dc=0;Dc<Id;Dc++){Pc=ud[Dc];ac=Dc*3;Rc[ac]=Pc.r;Rc[ac+1]=Pc.g;Rc[ac+2]=Pc.b}k.bindBuffer(k.ARRAY_BUFFER,$b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Rc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false}else if(jb instanceof THREE.Line){Ua=c(jb,sc);kc=Ua.attributes&&m(Ua);if(da.verticesNeedUpdate||da.colorsNeedUpdate||
|
|
|
+kc){var Lb=da,id=k.DYNAMIC_DRAW,Ec=void 0,Fc=void 0,Sc=void 0,va=void 0,Tc=void 0,vd=Lb.vertices,wd=Lb.colors,Kd=vd.length,Ld=wd.length,Uc=Lb.__vertexArray,Vc=Lb.__colorArray,Md=Lb.colorsNeedUpdate,jd=Lb.__webglCustomAttributesList,Wc=void 0,xd=void 0,Ma=void 0,qc=void 0,Va=void 0,pa=void 0;if(Lb.verticesNeedUpdate){for(Ec=0;Ec<Kd;Ec++){Sc=vd[Ec];va=Ec*3;Uc[va]=Sc.x;Uc[va+1]=Sc.y;Uc[va+2]=Sc.z}k.bindBuffer(k.ARRAY_BUFFER,Lb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Uc,id)}if(Md){for(Fc=0;Fc<
|
|
|
+Ld;Fc++){Tc=wd[Fc];va=Fc*3;Vc[va]=Tc.r;Vc[va+1]=Tc.g;Vc[va+2]=Tc.b}k.bindBuffer(k.ARRAY_BUFFER,Lb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Vc,id)}if(jd){Wc=0;for(xd=jd.length;Wc<xd;Wc++){pa=jd[Wc];if(pa.needsUpdate&&(pa.boundTo===void 0||pa.boundTo==="vertices")){va=0;qc=pa.value.length;if(pa.size===1)for(Ma=0;Ma<qc;Ma++)pa.array[Ma]=pa.value[Ma];else if(pa.size===2)for(Ma=0;Ma<qc;Ma++){Va=pa.value[Ma];pa.array[va]=Va.x;pa.array[va+1]=Va.y;va=va+2}else if(pa.size===3)if(pa.type==="c")for(Ma=
|
|
|
+0;Ma<qc;Ma++){Va=pa.value[Ma];pa.array[va]=Va.r;pa.array[va+1]=Va.g;pa.array[va+2]=Va.b;va=va+3}else for(Ma=0;Ma<qc;Ma++){Va=pa.value[Ma];pa.array[va]=Va.x;pa.array[va+1]=Va.y;pa.array[va+2]=Va.z;va=va+3}else if(pa.size===4)for(Ma=0;Ma<qc;Ma++){Va=pa.value[Ma];pa.array[va]=Va.x;pa.array[va+1]=Va.y;pa.array[va+2]=Va.z;pa.array[va+3]=Va.w;va=va+4}k.bindBuffer(k.ARRAY_BUFFER,pa.buffer);k.bufferData(k.ARRAY_BUFFER,pa.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Ua.attributes&&p(Ua)}else if(jb instanceof
|
|
|
+THREE.ParticleSystem){Ua=c(jb,sc);kc=Ua.attributes&&m(Ua);(da.verticesNeedUpdate||da.colorsNeedUpdate||jb.sortParticles||kc)&&f(da,k.DYNAMIC_DRAW,jb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Ua.attributes&&p(Ua)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?
|
|
|
+g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,j,l,m,n;i=m=n=h=0;for(j=b.length;i<j;i++){l=b[i];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=Q){j=m;l=n;m=h}else{j=Math.ceil(Q*m/(n+m));
|
|
|
+m=l=Q-j}var o=0,h=0;for(n=b.length;h<n;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&o++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{i=a.fragmentShader;n=a.vertexShader;var h=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,morphTargets:a.morphTargets,
|
|
|
+morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:j,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(i);d.push(n)}for(q in c){d.push(q);
|
|
|
+d.push(c[q])}g=d.join();q=0;for(d=P.length;q<d;q++){j=P[q];if(j.code===g){j.usedTimes++;r=j.program;break a}}q=k.createProgram();d=["precision "+v+" float;",fb>0?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
|
|
|
+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
|
|
|
+"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+j=["precision "+v+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":
|
|
|
"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
-i=w("fragment",k+i);d=w("vertex",d+n);j.attachShader(q,d);j.attachShader(q,i);j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");j.deleteShader(i);j.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);
|
|
|
-s=d;d=0;for(h=s.length;d<h;d++){n=s[d];q.uniforms[n]=j.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=j.getAttribLocation(q,c)}q.id=L++;P.push({program:q,code:g,usedTimes:1});D.info.memory.programs=P.length;r=q}a.program=r;r=a.program.attributes;
|
|
|
-r.position>=0&&j.enableVertexAttribArray(r.position);r.color>=0&&j.enableVertexAttribArray(r.color);r.normal>=0&&j.enableVertexAttribArray(r.normal);r.tangent>=0&&j.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){j.enableVertexAttribArray(r.skinVertexA);j.enableVertexAttribArray(r.skinVertexB);j.enableVertexAttribArray(r.skinIndex);j.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=
|
|
|
-0&&j.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(r[s]>=0){j.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(r[s]>=0){j.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
|
|
|
-b){if(a){!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW);a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK);j.enable(j.CULL_FACE)}else j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(Z!==a.doubleSided){a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE);Z=a.doubleSided}if($!==a.flipSided){a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW);$=a.flipSided}};this.setDepthTest=function(a){if(Pa!==a){a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST);
|
|
|
-Pa=a}};this.setDepthWrite=function(a){if(Qa!==a){j.depthMask(a);Qa=a}};this.setBlending=function(a,b,c,d){if(a!==X){if(a===THREE.NoBlending)j.disable(j.BLEND);else if(a===THREE.AdditiveBlending){j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE)}else if(a===THREE.SubtractiveBlending){j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR)}else if(a===
|
|
|
-THREE.CustomBlending)j.enable(j.BLEND);else{j.enable(j.BLEND);j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD);j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}X=a}if(a===THREE.CustomBlending){if(b!==ia){j.blendEquation(C(b));ia=b}if(c!==ya||d!==Ia){j.blendFunc(C(c),C(d));ya=c;Ia=d}}else Ia=ya=ia=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=j.createTexture();D.info.memory.textures++}j.activeTexture(j.TEXTURE0+
|
|
|
-b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=C(a.format),f=C(a.type);t(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{j.activeTexture(j.TEXTURE0+
|
|
|
-b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=j.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=C(a.format),e=C(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);t(j.TEXTURE_CUBE_MAP,a,c);
|
|
|
-for(var f=0;f<6;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=j.createFramebuffer();a.__webglRenderbuffer=
|
|
|
-j.createRenderbuffer();j.bindTexture(j.TEXTURE_2D,a.__webglTexture);t(j.TEXTURE_2D,a,c);j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=j.TEXTURE_2D;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&j.generateMipmap(j.TEXTURE_2D)}b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=pb;a=hb;d=ob;e=kb}if(b!==aa){j.bindFramebuffer(j.FRAMEBUFFER,b);j.viewport(d,e,c,a);aa=b}bb=c;Ca=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
+i=w("fragment",j+i);d=w("vertex",d+n);k.attachShader(q,d);k.attachShader(q,i);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(i);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);
|
|
|
+s=d;d=0;for(h=s.length;d<h;d++){n=s[d];q.uniforms[n]=k.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=k.getAttribLocation(q,c)}q.id=L++;P.push({program:q,code:g,usedTimes:1});D.info.memory.programs=P.length;r=q}a.program=r;r=a.program.attributes;
|
|
|
+r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=
|
|
|
+0&&k.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
|
|
|
+b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(Z!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);Z=a.doubleSided}if($!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);$=a.flipSided}};this.setDepthTest=function(a){if(Oa!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
|
|
|
+Oa=a}};this.setDepthWrite=function(a){if(Pa!==a){k.depthMask(a);Pa=a}};this.setBlending=function(a,b,c,d){if(a!==X){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===
|
|
|
+THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}X=a}if(a===THREE.CustomBlending){if(b!==ia){k.blendEquation(C(b));ia=b}if(c!==za||d!==Ga){k.blendFunc(C(c),C(d));za=c;Ga=d}}else Ga=za=ia=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();D.info.memory.textures++}k.activeTexture(k.TEXTURE0+
|
|
|
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=C(a.format),f=C(a.type);t(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+
|
|
|
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=C(a.format),e=C(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);t(k.TEXTURE_CUBE_MAP,a,c);
|
|
|
+for(var f=0;f<6;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=
|
|
|
+k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);t(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
+null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=ab;a=nb;d=mb;e=Fb}if(b!==aa){k.bindFramebuffer(k.FRAMEBUFFER,b);k.viewport(d,e,c,a);aa=b}bb=c;Ha=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
@@ -446,31 +447,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(r=k.length;p<r;p++){var g=
|
|
|
-k[p],q,s,u=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++){s=u[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(n=w.length;h<n;h++){s=w[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;w=m[n];if(w===void 0){w=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(r=j.length;p<r;p++){var g=
|
|
|
+j[p],q,s,u=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++){s=u[h].clone();d&&d.multiplyVector3(s);q.vertexNormals.push(s)}q.color.copy(g.color);h=0;for(n=w.length;h<n;h++){s=w[h];q.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;w=m[n];if(w===void 0){w=
|
|
|
a.materials.length;m[n]=w;a.materials.push(h)}q.materialIndex=w}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
|
|
|
for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
|
|
|
THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
|
|
|
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,o,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,m)}else if(d instanceof THREE.Face4){l=
|
|
|
-g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}i=i+d._area;k[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}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();
|
|
|
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],l,o,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,m)}else if(d instanceof THREE.Face4){l=
|
|
|
+g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}i=i+d._area;j[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}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).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
|
|
|
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,l=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;m.a=i;m.b=k;m.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
-m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];k=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),k.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
|
|
|
-e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
|
|
|
-h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,l,o,m,p,r,n,q,s,u,w,t,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=k.distanceTo(l);r=l.distanceTo(o);m=k.distanceTo(o);if(p>
|
|
|
-b||r>b||m>b){i=a.vertices.length;w=e.clone();t=e.clone();if(p>=r&&p>=m){k=k.clone();k.lerpSelf(l,0.5);w.a=f;w.b=i;w.c=h;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);w.vertexNormals[1].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);w.vertexColors[1].copy(f);t.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=m){k=l.clone();k.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=
|
|
|
-i;t.a=i;t.b=h;t.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f);t.vertexNormals[1].copy(e.vertexNormals[2]);t.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);t.vertexColors[0].copy(f);t.vertexColors[1].copy(e.vertexColors[2]);t.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
|
|
|
-k.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=i;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);t.vertexColors[0].copy(f)}e=2}x.push(w,t);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];t=k[0];h=k[1];w=k[2];if(e===
|
|
|
-0){l=t.clone();l.lerpSelf(h,0.5);k=[t.clone(),l.clone(),w.clone()];h=[l.clone(),h.clone(),w.clone()]}else if(e===1){l=h.clone();l.lerpSelf(w,0.5);k=[t.clone(),h.clone(),l.clone()];h=[l.clone(),w.clone(),t.clone()]}else{l=t.clone();l.lerpSelf(w,0.5);k=[t.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),w.clone()]}F[f].push(k,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];m=
|
|
|
-a.vertices[i];p=k.distanceTo(l);r=l.distanceTo(o);n=o.distanceTo(m);q=k.distanceTo(m);if(p>b||r>b||n>b||q>b){s=a.vertices.length;u=a.vertices.length+1;w=e.clone();t=e.clone();if(p>=r&&p>=n&&p>=q||n>=r&&n>=p&&n>=q){p=k.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(m,0.5);w.a=f;w.b=s;w.c=u;w.d=i;t.a=s;t.b=g;t.c=h;t.d=u;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);w.vertexNormals[1].copy(f);
|
|
|
-w.vertexNormals[2].copy(g);t.vertexNormals[0].copy(f);t.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);t.vertexColors[0].copy(f);t.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=m.clone();l.lerpSelf(k,0.5);w.a=f;w.b=g;w.c=s;w.d=u;t.a=u;t.b=s;t.c=h;t.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
|
|
|
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;m.a=i;m.b=j;m.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];j=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),j.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
|
|
|
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
|
|
|
+h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,o,m,p,r,n,q,s,u,w,t,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=j.distanceTo(l);r=l.distanceTo(o);m=j.distanceTo(o);if(p>
|
|
|
+b||r>b||m>b){i=a.vertices.length;w=e.clone();t=e.clone();if(p>=r&&p>=m){j=j.clone();j.lerpSelf(l,0.5);w.a=f;w.b=i;w.c=h;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);w.vertexNormals[1].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);w.vertexColors[1].copy(f);t.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=m){j=l.clone();j.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=
|
|
|
+i;t.a=i;t.b=h;t.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f);t.vertexNormals[1].copy(e.vertexNormals[2]);t.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);t.vertexColors[0].copy(f);t.vertexColors[1].copy(e.vertexColors[2]);t.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
|
|
|
+j.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=i;t.a=i;t.b=g;t.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);t.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);t.vertexColors[0].copy(f)}e=2}x.push(w,t);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];t=j[0];h=j[1];w=j[2];if(e===
|
|
|
+0){l=t.clone();l.lerpSelf(h,0.5);j=[t.clone(),l.clone(),w.clone()];h=[l.clone(),h.clone(),w.clone()]}else if(e===1){l=h.clone();l.lerpSelf(w,0.5);j=[t.clone(),h.clone(),l.clone()];h=[l.clone(),w.clone(),t.clone()]}else{l=t.clone();l.lerpSelf(w,0.5);j=[t.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),w.clone()]}F[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];m=
|
|
|
+a.vertices[i];p=j.distanceTo(l);r=l.distanceTo(o);n=o.distanceTo(m);q=j.distanceTo(m);if(p>b||r>b||n>b||q>b){s=a.vertices.length;u=a.vertices.length+1;w=e.clone();t=e.clone();if(p>=r&&p>=n&&p>=q||n>=r&&n>=p&&n>=q){p=j.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(m,0.5);w.a=f;w.b=s;w.c=u;w.d=i;t.a=s;t.b=g;t.c=h;t.d=u;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);w.vertexNormals[1].copy(f);
|
|
|
+w.vertexNormals[2].copy(g);t.vertexNormals[0].copy(f);t.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);t.vertexColors[0].copy(f);t.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=m.clone();l.lerpSelf(j,0.5);w.a=f;w.b=g;w.c=s;w.d=u;t.a=u;t.b=s;t.c=h;t.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
|
|
|
f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);t.vertexNormals[0].copy(g);t.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);t.vertexColors[0].copy(g);t.vertexColors[1].copy(f)}e=1}x.push(w,t);a.vertices.push(p,l);
|
|
|
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];t=k[0];h=k[1];w=k[2];k=k[3];if(e===0){l=t.clone();l.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(k,0.5);t=[t.clone(),l.clone(),o.clone(),k.clone()];h=[l.clone(),h.clone(),w.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(w,0.5);o=k.clone();o.lerpSelf(t,0.5);t=[t.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),w.clone(),k.clone()]}F[f].push(t,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
|
|
|
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];t=j[0];h=j[1];w=j[2];j=j[3];if(e===0){l=t.clone();l.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(j,0.5);t=[t.clone(),l.clone(),o.clone(),j.clone()];h=[l.clone(),h.clone(),w.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(w,0.5);o=j.clone();o.lerpSelf(t,0.5);t=[t.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),w.clone(),j.clone()]}F[f].push(t,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
|
|
|
x;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);f.flipY=false;b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+
|
|
|
-1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var o=0;o<e;o++){var m=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=
|
|
|
+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var o=0;o<e;o++){var m=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=
|
|
|
l-1<0?0:l-1,n=l+1>d-1?d-1:l+1,q=[],s=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(p*d+n)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);m=[];r=q.length;for(p=0;p<r;p++){var n=q[p],u=q[(p+1)%r],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*
|
|
|
-u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/m.length;q[2]=q[2]/m.length;s=(o*d+l)*4;k[s]=(q[0]+1)/2*255|0;k[s+1]=(q[1]+1)/2*255|0;k[s+2]=q[2]*255|0;k[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,
|
|
|
+u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/m.length;q[2]=q[2]/m.length;s=(o*d+l)*4;j[s]=(q[0]+1)/2*255|0;j[s+1]=(q[1]+1)/2*255|0;j[s+2]=q[2]*255|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,
|
|
|
b,THREE.RGBFormat);a.needsUpdate=true;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 f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(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}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
|
|
@@ -488,19 +489,18 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
|
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
|
|
|
THREE.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(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,o,m,p,r,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,o,m,p,r,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,l);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,o,p,i);THREE.Shape.Utils.b2(u,m,r,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;n=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,l,p,r,n,q);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,o,p,n,i);THREE.Shape.Utils.b3(u,m,r,q,l)}}}}}return{offset:s.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var p=i,r=k,n=l,q=e,s=g,u=void 0,w=void 0,t=void 0,x=void 0,F=void 0,
|
|
|
-C=void 0,z=void 0,v=void 0,H=void 0,w=m[s[p]].x,t=m[s[p]].y,x=m[s[r]].x,F=m[s[r]].y,C=m[s[n]].x,z=m[s[n]].y;if(1.0E-10>(x-w)*(z-t)-(F-t)*(C-w))m=false;else{for(u=0;u<q;u++)if(!(u==p||u==r||u==n)){var v=m[s[u]].x,H=m[s[u]].y,I=void 0,N=void 0,R=void 0,Y=void 0,B=void 0,G=void 0,Q=void 0,D=void 0,j=void 0,P=void 0,L=void 0,S=void 0,I=R=B=void 0,I=C-x,N=z-F,R=w-C,Y=t-z,B=x-w,G=F-t,Q=v-w,D=H-t,j=v-x,P=H-F,L=v-C,S=H-z,I=I*P-N*j,B=B*D-G*Q,R=R*S-Y*L;if(I>=0&&R>=0&&B>=0){m=false;break a}}m=true}}if(m){f.push([a[g[i]],
|
|
|
-a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
-THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};
|
|
|
-THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){if(this.vertexPositionArray!==void 0){a.multiplyVector3Array(this.vertexPositionArray);this.verticesNeedUpdate=true}if(this.vertexNormalArray!==void 0){var b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(this.vertexNormalArray);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,Infinity),max:new THREE.Vector3(-Infinity,
|
|
|
--Infinity,-Infinity)};var a=this.vertexPositionArray;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};var a=this.vertexPositionArray;
|
|
|
-if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){var a=this.vertexIndexArray,b=this.vertexPositionArray;if(b&&a){var c,d,e,f;c=b.length;if(this.vertexNormalArray===void 0)this.vertexNormalArray=new Float32Array(c);else{c=0;for(d=this.vertexNormalArray.length;c<d;c++)this.vertexNormalArray[c]=0}var g=this.offsets,h=this.vertexNormalArray,i,k,l,o,m,p,r=new THREE.Vector3,n=new THREE.Vector3,
|
|
|
-q=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;e=0;for(f=g.length;e<f;++e){d=g[e].start;i=g[e].count;var w=g[e].index;c=d;for(d=d+i;c<d;c=c+3){i=w+a[c];k=w+a[c+1];l=w+a[c+2];o=b[i*3];m=b[i*3+1];p=b[i*3+2];r.set(o,m,p);o=b[k*3];m=b[k*3+1];p=b[k*3+2];n.set(o,m,p);o=b[l*3];m=b[l*3+1];p=b[l*3+2];q.set(o,m,p);s.sub(q,n);u.sub(r,n);s.crossSelf(u);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[k*3]=h[k*3]+s.x;h[k*3+1]=h[k*3+1]+s.y;h[k*3+2]=h[k*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*
|
|
|
-3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}c=0;for(d=h.length;c<d;c=c+3){o=h[c];m=h[c+1];p=h[c+2];a=1/Math.sqrt(o*o+m*m+p*p);h[c]=h[c]*a;h[c+1]=h[c+1]*a;h[c+2]=h[c+2]*a}this.normalsNeedUpdate=true}}};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};
|
|
|
-THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var m;a:{m=a;var p=i,r=j,n=l,q=e,s=g,u=void 0,w=void 0,t=void 0,x=void 0,F=void 0,
|
|
|
+C=void 0,z=void 0,v=void 0,H=void 0,w=m[s[p]].x,t=m[s[p]].y,x=m[s[r]].x,F=m[s[r]].y,C=m[s[n]].x,z=m[s[n]].y;if(1.0E-10>(x-w)*(z-t)-(F-t)*(C-w))m=false;else{for(u=0;u<q;u++)if(!(u==p||u==r||u==n)){var v=m[s[u]].x,H=m[s[u]].y,I=void 0,N=void 0,R=void 0,Y=void 0,B=void 0,G=void 0,Q=void 0,D=void 0,k=void 0,P=void 0,L=void 0,S=void 0,I=R=B=void 0,I=C-x,N=z-F,R=w-C,Y=t-z,B=x-w,G=F-t,Q=v-w,D=H-t,k=v-x,P=H-F,L=v-C,S=H-z,I=I*P-N*k,B=B*D-G*Q,R=R*S-Y*L;if(I>=0&&R>=0&&B>=0){m=false;break a}}m=true}}if(m){f.push([a[g[i]],
|
|
|
+a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};
|
|
|
+THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
|
|
|
+Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f=f+3){c=a[f];d=a[f+1];e=a[f+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(e<b.min.z)b.min.z=e;else if(e>b.max.z)b.max.z=e}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
|
|
|
+{radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f=f+3){b=a[f];d=a[f+1];e=a[f+2];b=Math.sqrt(b*b+d*d+e*e);b>c&&(c=b)}this.boundingSphere.radius=c}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a*3};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
|
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,o,m,p,r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var w=e[c].index;a=b;for(b=b+i;a<b;a=a+3){i=w+f[a];j=w+f[a+1];l=w+f[a+2];o=g[i*3];m=g[i*3+1];p=g[i*3+2];r.set(o,m,p);o=g[j*3];m=g[j*3+1];p=g[j*3+2];n.set(o,m,p);o=g[l*3];m=g[l*3+1];p=g[l*3+2];q.set(o,m,p);s.sub(q,n);u.sub(r,
|
|
|
+n);s.crossSelf(u);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){o=h[a];m=h[a+1];p=h[a+2];c=1/Math.sqrt(o*o+m*m+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}}};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};
|
|
|
+THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
|
|
|
THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
|
|
|
THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-f;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};
|
|
@@ -533,34 +533,34 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+a,h.y+b,c,d,e,f,g)};
|
|
|
THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+a,g.y+b,c,d,e,f)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,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){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,k,l,o,m,p,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
|
|
|
-p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,r,m,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];m=f[1];k=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,k,h);n=THREE.Shape.Utils.b3(n,r,m,l,i);c.push(new THREE.Vector2(g,
|
|
|
-n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];k=f[3];g=f[4];o=!!f[5];p=g-k;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=k+n*p;g=h+m*Math.cos(n);n=i+m*Math.sin(n);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];k=f[4];g=f[5];
|
|
|
-o=!!f[6];p=g-k;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=k+n*p;g=h+m*Math.cos(n);n=i+l*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,j,l,o,m,p,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
|
|
|
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,r,m,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];m=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,j,h);n=THREE.Shape.Utils.b3(n,r,m,l,i);c.push(new THREE.Vector2(g,
|
|
|
+n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];j=f[3];g=f[4];o=!!f[5];p=g-j;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=j+n*p;g=h+m*Math.cos(n);n=i+m*Math.sin(n);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];j=f[4];g=f[5];
|
|
|
+o=!!f[6];p=g-j;r=a*2;for(f=1;f<=r;f++){n=f/r;o||(n=1-n);n=j+n*p;g=h+m*Math.cos(n);n=i+l*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
|
b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
|
|
|
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,o,m,p,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var n=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
|
|
|
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+m>n+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}o=c.slice(0,h);m=c.slice(h);p=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(m)}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,false),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;k[i]!==void 0&&console.log("Duplicate point",i);k[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=k[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=k[i];i!==void 0&&(h[d]=i)}}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,o,m,p,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var n=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[j[g],j[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
|
|
|
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+m>n+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}o=c.slice(0,h);m=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(m)}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,false),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(e)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};
|
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<0)a.hierarchy[c].keys[d].time=
|
|
|
-0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var 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 l=
|
|
|
-{};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){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
+0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l=
|
|
|
+{};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){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
|
|
|
1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
|
e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,l=this.data.JIT.hierarchy,o,m;m=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][k];a.matrixAutoUpdate=
|
|
|
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(o<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,l=this.data.JIT.hierarchy,o,m;m=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][j];a.matrixAutoUpdate=
|
|
|
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(o<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
|
|
|
p,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
|
|
|
THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
|
|
|
-this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][k]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
|
|
|
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][j]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
|
|
@@ -568,8 +568,8 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
|
|
|
e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
|
|
|
-this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
|
|
|
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
|
|
|
true}else if(l.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;){b=c;c=l[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
|
|
|
THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
@@ -609,54 +609,54 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
|
|
|
this.object.matrixWorldNeedsUpdate=true};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
|
|
|
c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,k=0,l=0,o=0,m=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
|
|
|
-function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,j=0,l=0,o=0,m=0,p=0,r=0;this.handleResize=function(){p=window.innerWidth/2;r=window.innerHeight/2};this.update=
|
|
|
+function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
|
|
|
d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
|
|
|
Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
|
|
|
a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
|
|
|
this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
|
|
|
false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;m=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
|
|
|
-1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false);this.handleResize()};
|
|
|
+1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false);this.handleResize()};
|
|
|
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;this.screen={width:0,height:0,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3;var d=
|
|
|
-new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
|
|
|
+new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
|
|
|
b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};
|
|
|
-this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=l:k.y=k.y+(l.y-k.y)*
|
|
|
+this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*
|
|
|
this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=m:o.addSelf(a.sub(m,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
|
|
|
g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
|
|
|
-this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);o=m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
|
|
|
-a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?
|
|
|
+this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=l=c.getMouseOnScreen(a.clientX,a.clientY);o=m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
|
|
|
+a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?
|
|
|
f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false);this.handleResize()};
|
|
|
-THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(t===c){o.set(a.clientX,a.clientY);m.sub(o,l);i.rotateLeft(2*Math.PI*m.x/k*i.userRotateSpeed);i.rotateUp(2*Math.PI*m.y/k*i.userRotateSpeed);l.copy(o)}else if(t===d){r.set(a.clientX,a.clientY);n.sub(r,p);n.y>0?i.zoomIn():i.zoomOut();p.copy(r)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
|
|
|
-t=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var i=this,k=1800,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,n=new THREE.Vector2,q=0,s=0,u=1,w=new THREE.Vector3;e=-1;c=0;d=1;var t=e,x={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
|
|
|
+THREE.OrbitControls=function(a,b){var c,d,e;function f(){return 2*Math.PI/60/60*i.autoRotateSpeed}function g(a){a.preventDefault();if(t===c){o.set(a.clientX,a.clientY);m.sub(o,l);i.rotateLeft(2*Math.PI*m.x/j*i.userRotateSpeed);i.rotateUp(2*Math.PI*m.y/j*i.userRotateSpeed);l.copy(o)}else if(t===d){r.set(a.clientX,a.clientY);n.sub(r,p);n.y>0?i.zoomIn():i.zoomOut();p.copy(r)}}function h(){if(i.userRotate){document.removeEventListener("mousemove",g,false);document.removeEventListener("mouseup",h,false);
|
|
|
+t=e}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var i=this,j=1800,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p=new THREE.Vector2,r=new THREE.Vector2,n=new THREE.Vector2,q=0,s=0,u=1,w=new THREE.Vector3;e=-1;c=0;d=1;var t=e,x={type:"change"};this.rotateLeft=function(a){a===void 0&&(a=f());
|
|
|
s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());q=q-a};this.rotateDown=function(a){a===void 0&&(a=f());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
|
|
|
var c=c+s,d=d+q,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=s=0;u=1;if(w.distanceTo(this.object.position)>0){this.dispatchEvent(x);w.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(i.userRotate){a.preventDefault();
|
|
|
if(a.button===0||a.button===2){t=c;l.set(a.clientX,a.clientY)}else if(a.button===1){t=d;p.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){i.userZoom&&(a.wheelDelta>0?i.zoomOut():i.zoomIn())},false)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,r=h/2,q=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var u=o+1,j=p+1,w=h/o,L=i/p,S=new THREE.Vector3;S[n]=l>0?1:-1;for(h=0;h<j;h++)for(i=0;i<u;i++){var aa=new THREE.Vector3;aa[a]=(i*w-r)*c;aa[b]=(h*L-q)*g;aa[n]=l;k.vertices.push(aa)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
|
|
|
-u*h+s,i+u*(h+1)+s,i+1+u*(h+1)+s,i+1+u*h+s);a.normal.copy(S);a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,o=b/2,m=c/2,p,r,n,q,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;s=3;n=4;u=
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,r=h/2,q=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var u=o+1,k=p+1,w=h/o,L=i/p,S=new THREE.Vector3;S[n]=l>0?1:-1;for(h=0;h<k;h++)for(i=0;i<u;i++){var aa=new THREE.Vector3;aa[a]=(i*w-r)*c;aa[b]=(h*L-q)*g;aa[n]=l;j.vertices.push(aa)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
|
|
|
+u*h+s,i+u*(h+1)+s,i+1+u*(h+1)+s,i+1+u*h+s);a.normal.copy(S);a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var j=this,l=a/2,o=b/2,m=c/2,p,r,n,q,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;s=3;n=4;u=
|
|
|
5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var o=[],m=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(n*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(n*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}k.push(o);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[k[0][h]].clone();m=this.vertices[k[0][h+
|
|
|
-1]].clone()}else{o=this.vertices[k[1][h]].clone();m=this.vertices[k[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var p=k[i][h],r=k[i+1][h],n=k[i+1][h+1],q=k[i][h+1],s=o.clone(),u=o.clone(),w=m.clone(),t=m.clone(),x=l[i][h].clone(),F=l[i+1][h].clone(),C=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,n,q,[s,u,w,t]));this.faceVertexUvs[0].push([x,F,C,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
|
|
|
-g,0));for(h=0;h<d;h++){p=k[0][h];r=k[0][h+1];n=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);w=new THREE.Vector3(0,1,0);x=l[0][h].clone();F=l[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,n,[s,u,w]));this.faceVertexUvs[0].push([x,F,C])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=k[i][h+1];r=k[i][h];n=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);w=new THREE.Vector3(0,-1,0);
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var o=[],m=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(n*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(n*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}j.push(o);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[j[0][h]].clone();m=this.vertices[j[0][h+
|
|
|
+1]].clone()}else{o=this.vertices[j[1][h]].clone();m=this.vertices[j[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],r=j[i+1][h],n=j[i+1][h+1],q=j[i][h+1],s=o.clone(),u=o.clone(),w=m.clone(),t=m.clone(),x=l[i][h].clone(),F=l[i+1][h].clone(),C=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,n,q,[s,u,w,t]));this.faceVertexUvs[0].push([x,F,C,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
|
|
|
+g,0));for(h=0;h<d;h++){p=j[0][h];r=j[0][h+1];n=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);w=new THREE.Vector3(0,1,0);x=l[0][h].clone();F=l[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,n,[s,u,w]));this.faceVertexUvs[0].push([x,F,C])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=j[i][h+1];r=j[i][h];n=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);w=new THREE.Vector3(0,-1,0);
|
|
|
x=l[i][h+1].clone();F=l[i][h].clone();C=new THREE.UV(F.u,1);this.faces.push(new THREE.Face3(p,r,n,[s,u,w]));this.faceVertexUvs[0].push([x,F,C])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};
|
|
|
THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(K=c.length;--K>=0;){e=K;f=K-1;f<0&&(f=
|
|
|
-c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=L*g,j=L*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,q=e,s=f,k=k+N,i=i+N,n=n+N,j=j+N;I.faces.push(new THREE.Face4(k,i,n,j,null,null,u));k=w.generateSideWallUV(I,a,o,b,k,i,n,j,p,r,q,s);I.faceVertexUvs[0].push(k)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+N;d=d+N;e=e+N;I.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?w.generateBottomUV(I,a,b,c,d,e):w.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}
|
|
|
-var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,n,q=false,s=b.material,u=b.extrudeMaterial,w=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,x,F,C;if(r){n=r.getSpacedPoints(m);q=true;o=false;t=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
|
|
|
-m,false);x=new THREE.Vector3;F=new THREE.Vector3;C=new THREE.Vector3}if(!o)k=i=l=0;var z,v,H,I=this,N=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,R=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();v=0;for(H=R.length;v<H;v++){z=R[v];THREE.Shape.Utils.isClockWise(z)&&(R[v]=z.reverse())}r=false}var Y=THREE.Shape.Utils.triangulateShape(p,R),B=p;v=0;for(H=R.length;v<H;v++){z=R[v];p=p.concat(z)}var G,Q,D,j,P,L=p.length,S,aa=Y.length,r=[],K=0;D=B.length;G=D-1;
|
|
|
-for(Q=K+1;K<D;K++,G++,Q++){G===D&&(G=0);Q===D&&(Q=0);r[K]=d(B[K],B[G],B[Q])}var ca=[],ha,O=r.concat();v=0;for(H=R.length;v<H;v++){z=R[v];ha=[];K=0;D=z.length;G=D-1;for(Q=K+1;K<D;K++,G++,Q++){G===D&&(G=0);Q===D&&(Q=0);ha[K]=d(z[K],z[G],z[Q])}ca.push(ha);O=O.concat(ha)}for(G=0;G<l;G++){D=G/l;j=i*(1-D);Q=k*Math.sin(D*Math.PI/2);K=0;for(D=B.length;K<D;K++){P=c(B[K],r[K],Q);f(P.x,P.y,-j)}v=0;for(H=R.length;v<H;v++){z=R[v];ha=ca[v];K=0;for(D=z.length;K<D;K++){P=c(z[K],ha[K],Q);f(P.x,P.y,-j)}}}Q=k;for(K=
|
|
|
-0;K<L;K++){P=o?c(p[K],O[K],Q):p[K];if(q){F.copy(t.normals[0]).multiplyScalar(P.x);x.copy(t.binormals[0]).multiplyScalar(P.y);C.copy(n[0]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(P.x,P.y,0)}for(D=1;D<=m;D++)for(K=0;K<L;K++){P=o?c(p[K],O[K],Q):p[K];if(q){F.copy(t.normals[D]).multiplyScalar(P.x);x.copy(t.binormals[D]).multiplyScalar(P.y);C.copy(n[D]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(P.x,P.y,h/m*D)}for(G=l-1;G>=0;G--){D=G/l;j=i*(1-D);Q=k*Math.sin(D*Math.PI/2);K=0;for(D=B.length;K<D;K++){P=
|
|
|
-c(B[K],r[K],Q);f(P.x,P.y,h+j)}v=0;for(H=R.length;v<H;v++){z=R[v];ha=ca[v];K=0;for(D=z.length;K<D;K++){P=c(z[K],ha[K],Q);q?f(P.x,P.y+n[m-1].y,n[m-1].x+j):f(P.x,P.y,h+j)}}}(function(){if(o){var a;a=L*0;for(K=0;K<aa;K++){S=Y[K];g(S[2]+a,S[1]+a,S[0]+a,true)}a=m+l*2;a=L*a;for(K=0;K<aa;K++){S=Y[K];g(S[0]+a,S[1]+a,S[2]+a,false)}}else{for(K=0;K<aa;K++){S=Y[K];g(S[2],S[1],S[0],true)}for(K=0;K<aa;K++){S=Y[K];g(S[0]+L*m,S[1]+L*m,S[2]+L*m,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;v=0;for(H=R.length;v<
|
|
|
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=L*g,k=L*(g+1),j=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,o=c,p=g,r=h,q=e,s=f,j=j+N,i=i+N,n=n+N,k=k+N;I.faces.push(new THREE.Face4(j,i,n,k,null,null,u));j=w.generateSideWallUV(I,a,o,b,j,i,n,k,p,r,q,s);I.faceVertexUvs[0].push(j)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+N;d=d+N;e=e+N;I.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?w.generateBottomUV(I,a,b,c,d,e):w.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}
|
|
|
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,n,q=false,s=b.material,u=b.extrudeMaterial,w=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,x,F,C;if(r){n=r.getSpacedPoints(m);q=true;o=false;t=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
|
|
|
+m,false);x=new THREE.Vector3;F=new THREE.Vector3;C=new THREE.Vector3}if(!o)j=i=l=0;var z,v,H,I=this,N=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,R=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();v=0;for(H=R.length;v<H;v++){z=R[v];THREE.Shape.Utils.isClockWise(z)&&(R[v]=z.reverse())}r=false}var Y=THREE.Shape.Utils.triangulateShape(p,R),B=p;v=0;for(H=R.length;v<H;v++){z=R[v];p=p.concat(z)}var G,Q,D,k,P,L=p.length,S,aa=Y.length,r=[],K=0;D=B.length;G=D-1;
|
|
|
+for(Q=K+1;K<D;K++,G++,Q++){G===D&&(G=0);Q===D&&(Q=0);r[K]=d(B[K],B[G],B[Q])}var ca=[],ha,O=r.concat();v=0;for(H=R.length;v<H;v++){z=R[v];ha=[];K=0;D=z.length;G=D-1;for(Q=K+1;K<D;K++,G++,Q++){G===D&&(G=0);Q===D&&(Q=0);ha[K]=d(z[K],z[G],z[Q])}ca.push(ha);O=O.concat(ha)}for(G=0;G<l;G++){D=G/l;k=i*(1-D);Q=j*Math.sin(D*Math.PI/2);K=0;for(D=B.length;K<D;K++){P=c(B[K],r[K],Q);f(P.x,P.y,-k)}v=0;for(H=R.length;v<H;v++){z=R[v];ha=ca[v];K=0;for(D=z.length;K<D;K++){P=c(z[K],ha[K],Q);f(P.x,P.y,-k)}}}Q=j;for(K=
|
|
|
+0;K<L;K++){P=o?c(p[K],O[K],Q):p[K];if(q){F.copy(t.normals[0]).multiplyScalar(P.x);x.copy(t.binormals[0]).multiplyScalar(P.y);C.copy(n[0]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(P.x,P.y,0)}for(D=1;D<=m;D++)for(K=0;K<L;K++){P=o?c(p[K],O[K],Q):p[K];if(q){F.copy(t.normals[D]).multiplyScalar(P.x);x.copy(t.binormals[D]).multiplyScalar(P.y);C.copy(n[D]).addSelf(F).addSelf(x);f(C.x,C.y,C.z)}else f(P.x,P.y,h/m*D)}for(G=l-1;G>=0;G--){D=G/l;k=i*(1-D);Q=j*Math.sin(D*Math.PI/2);K=0;for(D=B.length;K<D;K++){P=
|
|
|
+c(B[K],r[K],Q);f(P.x,P.y,h+k)}v=0;for(H=R.length;v<H;v++){z=R[v];ha=ca[v];K=0;for(D=z.length;K<D;K++){P=c(z[K],ha[K],Q);q?f(P.x,P.y+n[m-1].y,n[m-1].x+k):f(P.x,P.y,h+k)}}}(function(){if(o){var a;a=L*0;for(K=0;K<aa;K++){S=Y[K];g(S[2]+a,S[1]+a,S[0]+a,true)}a=m+l*2;a=L*a;for(K=0;K<aa;K++){S=Y[K];g(S[0]+a,S[1]+a,S[2]+a,false)}}else{for(K=0;K<aa;K++){S=Y[K];g(S[2],S[1],S[0],true)}for(K=0;K<aa;K++){S=Y[K];g(S[0]+L*m,S[1]+L*m,S[2]+L*m,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;v=0;for(H=R.length;v<
|
|
|
H;v++){z=R[v];e(z,a);a=a+z.length}})()};
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
|
|
|
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(m,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.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=
|
|
|
+a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
|
|
|
(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*k-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
|
|
|
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*j-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
|
|
|
1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],l=[];for(i=0;i<=c;i++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);n.y=a*Math.cos(f+r*g);n.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(n);o.push(this.vertices.length-1);m.push(new THREE.UV(p,
|
|
|
-1-r))}k.push(o);l.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[i][h+1].clone(),q=l[i][h].clone(),s=l[i+1][h].clone(),u=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([n,s,u])}else if(Math.abs(this.vertices[f].y)==
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],l=[];for(i=0;i<=c;i++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);n.y=a*Math.cos(f+r*g);n.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(n);o.push(this.vertices.length-1);m.push(new THREE.UV(p,
|
|
|
+1-r))}j.push(o);l.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[i][h+1].clone(),q=l[i][h].clone(),s=l[i+1][h].clone(),u=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([n,s,u])}else if(Math.abs(this.vertices[f].y)==
|
|
|
a){this.faces.push(new THREE.Face3(d,e,f,[o,m,p]));this.faceVertexUvs[0].push([n,q,s])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,m,p,r]));this.faceVertexUvs[0].push([n,q,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
@@ -664,22 +664,22 @@ this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT
|
|
|
this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
|
|
|
-this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,k,l])}this.computeCentroids();this.computeFaceNormals();
|
|
|
+this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
|
|
|
this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,k,l,o=new THREE.Vector3,m,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;r=b.binormals;this.tangents=m;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(k*g.x+i*h.x);o.y=o.y+(k*g.y+i*h.y);o.z=o.z+(k*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,j,l,o=new THREE.Vector3,m,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;r=b.binormals;this.tangents=m;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(j*g.x+i*h.x);o.y=o.y+(j*g.y+i*h.y);o.z=o.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
|
|
|
a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([m,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));i.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){i.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();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 f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).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,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
|
|
|
-for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var o=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],a=this.vertices,j=0,l=b.length;j<l;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
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=Object.create(THREE.Geometry.prototype);
|
|
|
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=Object.create(THREE.Geometry.prototype);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=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,k,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){k=i/b;k=a(k,l);e.push(k)}}var m,p,r,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;l=(h+1)*o+i;k=(h+1)*o+i+1;m=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);r=new THREE.UV(i/b,(h+1)/c);n=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,k,l));g.push([m,
|
|
|
-p,r]);g.push([p,n,r])}else{f.push(new THREE.Face4(a,e,k,l));g.push([m,p,n,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,k=a[h[0]],s;s=k;var u=a[h[1]],w=a[h[2]],t=new THREE.Vector3,x=new THREE.Vector3;t.sub(w,u);x.sub(s,u);t.crossSelf(x);t.isZero()||t.normalize();s=t;k=s.dot(k);if(s.dot(i)>=k){for(i=0;i<3;i++){k=[h[i],h[(i+1)%3]];s=true;for(u=0;u<f.length;u++)if(f[u][0]===k[1]&&f[u][1]===k[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(k)}e[g]=
|
|
|
-e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var i=e[f],k=0;k<3;k++){if(h[i[k]]===void 0){h[i[k]]=g++;this.vertices.push(a[i[k]])}i[k]=h[i[k]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
|
|
|
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);e.push(j)}}var m,p,r,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;l=(h+1)*o+i;j=(h+1)*o+i+1;m=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);r=new THREE.UV(i/b,(h+1)/c);n=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,j,l));g.push([m,
|
|
|
+p,r]);g.push([p,n,r])}else{f.push(new THREE.Face4(a,e,j,l));g.push([m,p,n,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,j=a[h[0]],s;s=j;var u=a[h[1]],w=a[h[2]],t=new THREE.Vector3,x=new THREE.Vector3;t.sub(w,u);x.sub(s,u);t.crossSelf(x);t.isZero()||t.normalize();s=t;j=s.dot(j);if(s.dot(i)>=j){for(i=0;i<3;i++){j=[h[i],h[(i+1)%3]];s=true;for(u=0;u<f.length;u++)if(f[u][0]===j[1]&&f[u][1]===j[0]){f[u]=f[f.length-1];f.pop();s=false;break}s&&f.push(j)}e[g]=
|
|
|
+e[e.length-1];e.pop()}else g++}for(u=0;u<f.length;u++)e.push([f[u][0],f[u][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var i=e[f],j=0;j<3;j++){if(h[i[j]]===void 0){h[i[j]]=g++;this.vertices.push(a[i[j]])}i[j]=h[i[j]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
|
|
|
for(f=0;f<this.faces.length;f++){i=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[i.a]),d(this.vertices[i.b]),d(this.vertices[i.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(new THREE.Vector3(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -694,13 +694,13 @@ THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraH
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var k=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(m.useOldVertexColors){k.vertexColors=[];for(var j,n,p,q=0;q<4;q++){p=h[q];j=new THREE.Color;j.setRGB(0,0,0);for(var r=0;r<p.length;r++){n=g.vertexColors[p[r]-1];j.r=j.r+n.r;j.g=j.g+n.g;j.b=j.b+n.b}j.r=j.r/p.length;j.g=j.g/p.length;j.b=j.b/
|
|
|
p.length;k.vertexColors[q]=j}}l.push(k);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=u[e];if(!f){a>=w&&a<w+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in u?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,u[e]):u[e]=d}function h(a,
|
|
|
-b){R[a]===void 0&&(R[a]=[]);R[a].push(b)}function i(a,b,c){Y[a]===void 0&&(Y[a]={});Y[a][b]=c}var k=[],l=[],o=[],m=this,p=a.vertices,r=a.faces,k=p.concat(),n=[],q={},s={},u={},w=p.length,t,x,F,C,z,v=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,w);if(m.supportUVs){t=0;for(x=v.length;t<x;t++){F=0;for(C=v[t].length;F<C;F++){H=r[t]["abcd".charAt(F)];g(H,t,v[t][F])}}}if(v.length==0)m.supportUVs=false;t=0;for(z in u)t++;if(!t){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
-u,"vs",v.length);t=0;for(x=r.length;t<x;t++){z=r[t];n.push(z.centroid);k.push(z.centroid);if(m.supportUVs){v=new THREE.UV;if(z instanceof THREE.Face3){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v;v.u=v.u/3;v.v=v.v/3}else if(z instanceof THREE.Face4){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u+f(z.d,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v+f(z.d,t).v;v.u=v.u/4;v.v=v.v/4}g(w+t,"",v)}}b("-- added UVs for new Faces",u);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
|
|
|
+b){R[a]===void 0&&(R[a]=[]);R[a].push(b)}function i(a,b,c){Y[a]===void 0&&(Y[a]={});Y[a][b]=c}var j=[],l=[],o=[],m=this,p=a.vertices,r=a.faces,j=p.concat(),n=[],q={},s={},u={},w=p.length,t,x,F,C,z,v=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,w);if(m.supportUVs){t=0;for(x=v.length;t<x;t++){F=0;for(C=v[t].length;F<C;F++){H=r[t]["abcd".charAt(F)];g(H,t,v[t][F])}}}if(v.length==0)m.supportUVs=false;t=0;for(z in u)t++;if(!t){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
+u,"vs",v.length);t=0;for(x=r.length;t<x;t++){z=r[t];n.push(z.centroid);j.push(z.centroid);if(m.supportUVs){v=new THREE.UV;if(z instanceof THREE.Face3){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v;v.u=v.u/3;v.v=v.v/3}else if(z instanceof THREE.Face4){v.u=f(z.a,t).u+f(z.b,t).u+f(z.c,t).u+f(z.d,t).u;v.v=f(z.a,t).v+f(z.b,t).v+f(z.c,t).v+f(z.d,t).v;v.u=v.u/4;v.v=v.v/4}g(w+t,"",v)}}b("-- added UVs for new Faces",u);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
|
|
|
var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var I,N,R={},Y={};for(t in x){v=x[t];I=t.split("_");N=I[0];I=I[1];h(N,[N,I]);h(I,[N,I]);F=0;for(C=v.length;F<C;F++){z=v[F];i(N,z,t);i(I,z,t)}v.length<2&&(s[t]=true)}b("vertexEdgeMap",R,"vertexFaceMap",Y);for(t in x){v=
|
|
|
-x[t];z=v[0];C=v[1];I=t.split("_");N=I[0];I=I[1];v=new THREE.Vector3;if(s[t]){v.addSelf(p[N]);v.addSelf(p[I]);v.multiplyScalar(0.5)}else{v.addSelf(n[z]);v.addSelf(n[C]);v.addSelf(p[N]);v.addSelf(p[I]);v.multiplyScalar(0.25)}q[t]=w+r.length+H;k.push(v);H++;if(m.supportUVs){v=new THREE.UV;v.u=f(N,z).u+f(I,z).u;v.v=f(N,z).v+f(I,z).v;v.u=v.u/2;v.v=v.v/2;g(q[t],z,v);if(!s[t]){v=new THREE.UV;v.u=f(N,C).u+f(I,C).u;v.v=f(N,C).v+f(I,C).v;v.u=v.u/2;v.v=v.v/2;g(q[t],C,v)}}}b("-- Step 2 done");var B,G;C=["123",
|
|
|
-"12","2","23"];I=["123","23","3","31"];var Q=["123","31","1","12"],D=["1234","12","2","23"],j=["1234","23","3","34"],P=["1234","34","4","41"],L=["1234","41","1","12"];t=0;for(x=n.length;t<x;t++){z=r[t];v=w+t;if(z instanceof THREE.Face3){H=e(z.a,z.b);N=e(z.b,z.c);B=e(z.c,z.a);d(v,q[H],z.b,q[N],z,C,t);d(v,q[N],z.c,q[B],z,I,t);d(v,q[B],z.a,q[H],z,Q,t)}else if(z instanceof THREE.Face4){H=e(z.a,z.b);N=e(z.b,z.c);B=e(z.c,z.d);G=e(z.d,z.a);d(v,q[H],z.b,q[N],z,D,t);d(v,q[N],z.c,q[B],z,j,t);d(v,q[B],z.d,q[G],
|
|
|
+x[t];z=v[0];C=v[1];I=t.split("_");N=I[0];I=I[1];v=new THREE.Vector3;if(s[t]){v.addSelf(p[N]);v.addSelf(p[I]);v.multiplyScalar(0.5)}else{v.addSelf(n[z]);v.addSelf(n[C]);v.addSelf(p[N]);v.addSelf(p[I]);v.multiplyScalar(0.25)}q[t]=w+r.length+H;j.push(v);H++;if(m.supportUVs){v=new THREE.UV;v.u=f(N,z).u+f(I,z).u;v.v=f(N,z).v+f(I,z).v;v.u=v.u/2;v.v=v.v/2;g(q[t],z,v);if(!s[t]){v=new THREE.UV;v.u=f(N,C).u+f(I,C).u;v.v=f(N,C).v+f(I,C).v;v.u=v.u/2;v.v=v.v/2;g(q[t],C,v)}}}b("-- Step 2 done");var B,G;C=["123",
|
|
|
+"12","2","23"];I=["123","23","3","31"];var Q=["123","31","1","12"],D=["1234","12","2","23"],k=["1234","23","3","34"],P=["1234","34","4","41"],L=["1234","41","1","12"];t=0;for(x=n.length;t<x;t++){z=r[t];v=w+t;if(z instanceof THREE.Face3){H=e(z.a,z.b);N=e(z.b,z.c);B=e(z.c,z.a);d(v,q[H],z.b,q[N],z,C,t);d(v,q[N],z.c,q[B],z,I,t);d(v,q[B],z.a,q[H],z,Q,t)}else if(z instanceof THREE.Face4){H=e(z.a,z.b);N=e(z.b,z.c);B=e(z.c,z.d);G=e(z.d,z.a);d(v,q[H],z.b,q[N],z,D,t);d(v,q[N],z.c,q[B],z,k,t);d(v,q[B],z.d,q[G],
|
|
|
z,P,t);d(v,q[G],z.a,q[H],z,L,t)}else b("face should be a face!",z)}q=new THREE.Vector3;z=new THREE.Vector3;t=0;for(x=p.length;t<x;t++)if(R[t]!==void 0){q.set(0,0,0);z.set(0,0,0);N=new THREE.Vector3(0,0,0);v=0;for(F in Y[t]){q.addSelf(n[F]);v++}C=0;H=R[t].length;for(F=0;F<H;F++)s[e(R[t][F][0],R[t][F][1])]&&C++;if(C!=2){q.divideScalar(v);for(F=0;F<H;F++){v=R[t][F];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);z.addSelf(v)}z.divideScalar(H);N.addSelf(p[t]);N.multiplyScalar(H-3);N.addSelf(q);N.addSelf(z.multiplyScalar(2));
|
|
|
-N.divideScalar(H);k[t]=N}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=o;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+N.divideScalar(H);j[t]=N}}a.vertices=j;a.faces=l;a.faceVertexUvs[0]=o;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
@@ -712,37 +712,37 @@ 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];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
|
e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
|
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,l,o,m,p;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++]=
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,j,l,o,m,p;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;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;l=a(THREE.ShaderFlares.lensFlare)}else{k=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
|
|
|
"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,t=s/e,x=e*0.5,F=s*0.5,C=16/s,z=new THREE.Vector2(C*t,C),v=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),I=m,C=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(C.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var N,R,Y,B,G;for(N=0;N<u;N++){C=16/s;z.set(C*t,C);B=a[N];w.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);v.copy(w);H.x=v.x*x+x;H.y=v.y*F+F;if(k||H.x>0&&H.x<e&&H.y>0&&
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(C.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var N,R,Y,B,G;for(N=0;N<u;N++){C=16/s;z.set(C*t,C);B=a[N];w.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);v.copy(w);H.x=v.x*x+x;H.y=v.y*F+F;if(j||H.x>0&&H.x<e&&H.y>0&&
|
|
|
H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,z.x,z.y);b.uniform3f(I.screenPosition,v.x,v.y,v.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,H.x-8,H.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);B.positionScreen.copy(v);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);R=0;for(Y=B.lensFlares.length;R<Y;R++){G=B.lensFlares[R];if(G.opacity>0.0010&&G.scale>0.0010){v.x=G.x;v.y=G.y;v.z=G.z;C=G.size*G.scale/s;z.x=C*t;z.y=C;b.uniform3f(I.screenPosition,v.x,v.y,v.z);b.uniform2f(I.scale,z.x,z.y);b.uniform1f(I.rotation,G.rotation);b.uniform1f(I.opacity,G.opacity);
|
|
|
b.uniform3f(I.color,G.color.r,G.color.g,G.color.b);c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst);c.setTexture(G.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,o,m,p,r,n,q,s,u,w=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(o=i.__lights.length;l<o;l++){m=i.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var t;if(m.shadowCascadeArray[r])t=m.shadowCascadeArray[r];
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var l,o,m,p,r,n,q,s,u,w=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(o=i.__lights.length;l<o;l++){m=i.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var t;if(m.shadowCascadeArray[r])t=m.shadowCascadeArray[r];
|
|
|
else{u=m;q=r;t=new THREE.DirectionalLight;t.isVirtual=true;t.onlyShadow=true;t.castShadow=true;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[q];t.shadowMapWidth=u.shadowCascadeWidth[q];t.shadowMapHeight=u.shadowCascadeHeight[q];
|
|
|
-t.pointsWorld=[];t.pointsFrustum=[];s=t.pointsWorld;n=t.pointsFrustum;for(var x=0;x<8;x++){s[x]=new THREE.Vector3;n[x]=new THREE.Vector3}s=u.shadowCascadeNearZ[q];u=u.shadowCascadeFarZ[q];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(t);n.add(t.target);k.add(n);m.shadowCascadeArray[r]=t;console.log("Created virtualLight",t)}q=m;s=
|
|
|
+t.pointsWorld=[];t.pointsFrustum=[];s=t.pointsWorld;n=t.pointsFrustum;for(var x=0;x<8;x++){s[x]=new THREE.Vector3;n[x]=new THREE.Vector3}s=u.shadowCascadeNearZ[q];u=u.shadowCascadeFarZ[q];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=j;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(t);n.add(t.target);j.add(n);m.shadowCascadeArray[r]=t;console.log("Created virtualLight",t)}q=m;s=
|
|
|
r;u=q.shadowCascadeArray[s];u.position.copy(q.position);u.target.position.copy(q.target.position);u.lookAt(u.target);u.shadowCameraVisible=q.shadowCameraVisible;u.shadowDarkness=q.shadowDarkness;u.shadowBias=q.shadowCascadeBias[s];n=q.shadowCascadeNearZ[s];q=q.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=q;u[5].z=q;u[6].z=q;u[7].z=q;w[p]=t;p++}else{w[p]=m;p++}}l=0;for(o=w.length;l<o;l++){m=w[l];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,
|
|
|
m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight);m.shadowMatrix=new THREE.Matrix4}if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,
|
|
|
-m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&t.originalCamera==k){r=k;p=m.shadowCamera;n=m.pointsFrustum;u=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=
|
|
|
+m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&t.originalCamera==j){r=j;p=m.shadowCamera;n=m.pointsFrustum;u=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=
|
|
|
0;q<8;q++){s=u[q];s.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,r);p.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=m.shadowMap;n=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
|
|
|
if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.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);f.multiply(r.projectionMatrix,
|
|
|
r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);b.clear();u=i.__webglObjects;m=0;for(p=u.length;m<p;m++){q=u[m];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}m=0;for(p=u.length;m<p;m++){q=u[m];if(q.render){n=q.object;q=q.buffer;s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
|
|
|
b.renderBufferDirect(r,i.__lights,null,s,q,n):b.renderBuffer(r,i.__lights,null,s,q,n)}}u=i.__webglObjectsImmediate;m=0;for(p=u.length;m<p;m++){q=u[m];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,i.__lights,null,c,n)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,o);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,f,g,h,i,k,l;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++]=0;d[a++]=1;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++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(m,p);b.attachShader(m,r);b.linkProgram(m);h=m;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");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,n=d.length;if(n){var q=i,s=k,u=r/p,p=p*0.5,w=r*0.5,t=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,j,l;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++]=0;d[a++]=1;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++]=0;d[a++]=1;a=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(m,p);b.attachShader(m,r);b.linkProgram(m);h=m;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");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,n=d.length;if(n){var q=i,s=j,u=r/p,p=p*0.5,w=r*0.5,t=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
g);b.uniformMatrix4fv(s.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var x,F=[],q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
|
|
|
b.uniform3f(s.screenPosition,(x.position.x-p)/p,(w-x.position.y)/w,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);F[0]=e*u*x.scale.x;F[1]=e*x.scale.y;b.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(s.alignment,x.alignment.x,x.alignment.y);
|
|
|
b.uniform1f(s.opacity,x.opacity);b.uniform3f(s.color,x.color.r,x.color.g,x.color.b);b.uniform1f(s.rotation,x.rotation);b.uniform2fv(s.scale,F);if(x.mergeWith3D&&!t){b.enable(b.DEPTH_TEST);t=true}else if(!x.mergeWith3D&&t){b.disable(b.DEPTH_TEST);t=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,k,l,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
|
|
|
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(k=p.length;i<k;i++){l=p[i];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}i=0;for(k=p.length;i<k;i++){l=p[i];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
|
|
|
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,m):b.renderBuffer(h,g.__lights,null,o,l,m)}}p=g.__webglObjectsImmediate;i=0;for(k=p.length;i<k;i++){l=p[i];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND)}};
|
|
|
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
|
|
|
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
|
|
|
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,m):b.renderBuffer(h,g.__lights,null,o,l,m)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|
|
|
lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
|
|
|
THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|