|
@@ -1,6 +1,6 @@
|
|
|
// ThreeWebGL.js r34 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
|
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,h,k,l,o,n;if(d==0)e=h=k=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-b);n=d*(1-b*o);b=d*(1-b*(1-o));switch(l){case 1:e=n;h=d;k=a;break;case 2:e=a;h=d;k=b;break;case 3:e=a;h=n;k=d;break;case 4:e=b;h=a;k=d;break;case 5:e=d;h=a;k=n;break;case 6:case 0:e=d;h=b;k=a}}this.r=e;this.g=h;this.b=k;if(this.autoUpdate){this.updateHex();
|
|
|
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,h,j,k,o,m;if(d==0)e=h=j=0;else{k=Math.floor(a*6);o=a*6-k;a=d*(1-b);m=d*(1-b*o);b=d*(1-b*(1-o));switch(k){case 1:e=m;h=d;j=a;break;case 2:e=a;h=d;j=b;break;case 3:e=a;h=m;j=d;break;case 4:e=b;h=a;j=d;break;case 5:e=d;h=a;j=m;break;case 6:case 0:e=d;h=b;j=a}}this.r=e;this.g=h;this.b=j;if(this.autoUpdate){this.updateHex();
|
|
|
this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
|
|
|
THREE.Vector2=function(a,b){this.set(a||0,b||0)};
|
|
|
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
@@ -11,60 +11,60 @@ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-th
|
|
|
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(k,l){return k.distance-l.distance});return h},intersectObject:function(a){function b(J,H,R,P){P=P.clone().subSelf(H);R=R.clone().subSelf(H);var L=J.clone().subSelf(H);J=P.dot(P);H=P.dot(R);P=P.dot(L);var N=R.dot(R);R=R.dot(L);L=1/(J*N-H*H);N=(N*P-H*R)*L;J=(J*R-H*P)*L;return N>0&&J>0&&N+J<1}var d,e,h,k,l,o,n,t,y,w,
|
|
|
-C,D=a.geometry,F=D.vertices,G=[];d=0;for(e=D.faces.length;d<e;d++){h=D.faces[d];w=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;k=n.multiplyVector3(F[h.a].position.clone());l=n.multiplyVector3(F[h.b].position.clone());o=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(h.normal.clone());y=C.dot(t);if(y<0){t=t.dot((new THREE.Vector3).sub(k,w))/y;w=w.addSelf(C.multiplyScalar(t));
|
|
|
-if(h instanceof THREE.Face3){if(b(w,k,l,o)){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(b(w,k,l,n)||b(w,l,o,n))){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}}return G}};
|
|
|
-THREE.Rectangle=function(){function a(){k=e-b;l=h-d}var b,d,e,h,k,l,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(n,t,y,w){o=!1;b=n;d=t;e=y;h=w;a()};this.addPoint=function(n,t){if(o){o=!1;b=n;d=t;e=n;h=t}else{b=b<n?b:n;d=d<t?d:t;e=e>n?e:n;h=h>t?h:t}a()};
|
|
|
-this.add3Points=function(n,t,y,w,C,D){if(o){o=!1;b=n<y?n<C?n:C:y<C?y:C;d=t<w?t<D?t:D:w<D?w:D;e=n>y?n>C?n:C:y>C?y:C;h=t>w?t>D?t:D:w>D?w:D}else{b=n<y?n<C?n<b?n:b:C<b?C:b:y<C?y<b?y:b:C<b?C:b;d=t<w?t<D?t<d?t:d:D<d?D:d:w<D?w<d?w:d:D<d?D:d;e=n>y?n>C?n>e?n:e:C>e?C:e:y>C?y>e?y:e:C>e?C:e;h=t>w?t>D?t>h?t:h:D>h?D:h:w>D?w>h?w:h:D>h?D:h}a()};this.addRectangle=function(n){if(o){o=!1;b=n.getLeft();d=n.getTop();e=n.getRight();h=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
|
|
|
-e:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;e+=n;h+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();h=h<n.getBottom()?h:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){o=!0;h=e=d=b=0;a()};this.isEmpty=function(){return o}};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(j,k){return j.distance-k.distance});return h},intersectObject:function(a){function b(I,H,R,Q){Q=Q.clone().subSelf(H);R=R.clone().subSelf(H);var N=I.clone().subSelf(H);I=Q.dot(Q);H=Q.dot(R);Q=Q.dot(N);var O=R.dot(R);R=R.dot(N);N=1/(I*O-H*H);O=(O*Q-H*R)*N;I=(I*R-H*Q)*N;return O>0&&I>0&&O+I<1}var d,e,h,j,k,o,m,t,y,x,
|
|
|
+B,C=a.geometry,F=C.vertices,G=[];d=0;for(e=C.faces.length;d<e;d++){h=C.faces[d];x=this.origin.clone();B=this.direction.clone();m=a.matrixWorld;j=m.multiplyVector3(F[h.a].position.clone());k=m.multiplyVector3(F[h.b].position.clone());o=m.multiplyVector3(F[h.c].position.clone());m=h instanceof THREE.Face4?m.multiplyVector3(F[h.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(h.normal.clone());y=B.dot(t);if(y<0){t=t.dot((new THREE.Vector3).sub(j,x))/y;x=x.addSelf(B.multiplyScalar(t));
|
|
|
+if(h instanceof THREE.Face3){if(b(x,j,k,o)){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(b(x,j,k,m)||b(x,k,o,m))){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};G.push(h)}}}return G}};
|
|
|
+THREE.Rectangle=function(){function a(){j=e-b;k=h-d}var b,d,e,h,j,k,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return j};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(m,t,y,x){o=!1;b=m;d=t;e=y;h=x;a()};this.addPoint=function(m,t){if(o){o=!1;b=m;d=t;e=m;h=t}else{b=b<m?b:m;d=d<t?d:t;e=e>m?e:m;h=h>t?h:t}a()};
|
|
|
+this.add3Points=function(m,t,y,x,B,C){if(o){o=!1;b=m<y?m<B?m:B:y<B?y:B;d=t<x?t<C?t:C:x<C?x:C;e=m>y?m>B?m:B:y>B?y:B;h=t>x?t>C?t:C:x>C?x:C}else{b=m<y?m<B?m<b?m:b:B<b?B:b:y<B?y<b?y:b:B<b?B:b;d=t<x?t<C?t<d?t:d:C<d?C:d:x<C?x<d?x:d:C<d?C:d;e=m>y?m>B?m>e?m:e:B>e?B:e:y>B?y>e?y:e:B>e?B:e;h=t>x?t>C?t>h?t:h:C>h?C:h:x>C?x>h?x:h:C>h?C:h}a()};this.addRectangle=function(m){if(o){o=!1;b=m.getLeft();d=m.getTop();e=m.getRight();h=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();e=e>m.getRight()?
|
|
|
+e:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;e+=m;h+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();e=e<m.getRight()?e:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){o=!0;h=e=d=b=0;a()};this.isEmpty=function(){return o}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;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,d,e,h,k,l,o,n,t,y,w,C,D,F,G){this.set(a||1,b||0,d||0,e||0,h||0,k||1,l||0,o||0,n||0,t||0,y||1,w||0,C||0,D||0,F||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(a,b,d,e,h,k,l,o,n,t,y,w,C,D,F,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=k;this.n23=l;this.n24=o;this.n31=n;this.n32=t;this.n33=y;this.n34=w;this.n41=C;this.n42=D;this.n43=F;this.n44=G;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){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,
|
|
|
-h=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,b).normalize();e.cross(d,k).normalize();h.cross(k,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=k.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=k.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=k.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
|
|
|
+THREE.Matrix4=function(a,b,d,e,h,j,k,o,m,t,y,x,B,C,F,G){this.set(a||1,b||0,d||0,e||0,h||0,j||1,k||0,o||0,m||0,t||0,y||1,x||0,B||0,C||0,F||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(a,b,d,e,h,j,k,o,m,t,y,x,B,C,F,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=j;this.n23=k;this.n24=o;this.n31=m;this.n32=t;this.n33=y;this.n34=x;this.n41=B;this.n42=C;this.n43=F;this.n44=G;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){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,
|
|
|
+h=THREE.Matrix4.__tmpVec2,j=THREE.Matrix4.__tmpVec3;j.sub(a,b).normalize();e.cross(d,j).normalize();h.cross(j,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=j.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=j.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=j.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
|
|
|
b+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;
|
|
|
-b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,k=a.n14,l=a.n21,o=a.n22,n=a.n23,t=a.n24,y=a.n31,w=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,J=a.n43,H=a.n44,R=b.n11,P=b.n12,L=b.n13,N=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,ha=b.n32,ka=b.n33,la=b.n34;this.n11=
|
|
|
-d*R+e*c+h*aa;this.n12=d*P+e*Z+h*ha;this.n13=d*L+e*ca+h*ka;this.n14=d*N+e*$+h*la+k;this.n21=l*R+o*c+n*aa;this.n22=l*P+o*Z+n*ha;this.n23=l*L+o*ca+n*ka;this.n24=l*N+o*$+n*la+t;this.n31=y*R+w*c+C*aa;this.n32=y*P+w*Z+C*ha;this.n33=y*L+w*ca+C*ka;this.n34=y*N+w*$+C*la+D;this.n41=F*R+G*c+J*aa;this.n42=F*P+G*Z+J*ha;this.n43=F*L+G*ca+J*ka;this.n44=F*N+G*$+J*la+H;return this},multiplyToArray:function(a,b,d){var e=a.n11,h=a.n12,k=a.n13,l=a.n14,o=a.n21,n=a.n22,t=a.n23,y=a.n24,w=a.n31,C=a.n32,D=a.n33,F=a.n34,G=
|
|
|
-a.n41,J=a.n42,H=a.n43;a=a.n44;var R=b.n11,P=b.n12,L=b.n13,N=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,ha=b.n32,ka=b.n33,la=b.n34,ia=b.n41,qa=b.n42,ta=b.n43;b=b.n44;this.n11=e*R+h*c+k*aa+l*ia;this.n12=e*P+h*Z+k*ha+l*qa;this.n13=e*L+h*ca+k*ka+l*ta;this.n14=e*N+h*$+k*la+l*b;this.n21=o*R+n*c+t*aa+y*ia;this.n22=o*P+n*Z+t*ha+y*qa;this.n23=o*L+n*ca+t*ka+y*ta;this.n24=o*N+n*$+t*la+y*b;this.n31=w*R+C*c+D*aa+F*ia;this.n32=w*P+C*Z+D*ha+F*qa;this.n33=w*L+C*ca+D*ka+F*ta;this.n34=w*N+C*$+D*la+F*b;this.n41=
|
|
|
-G*R+J*c+H*aa+a*ia;this.n42=G*P+J*Z+H*ha+a*qa;this.n43=G*L+J*ca+H*ka+a*ta;this.n44=G*N+J*$+H*la+a*b;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,k=this.n21,l=this.n22,o=this.n23,n=this.n24,t=this.n31,y=this.n32,w=this.n33,C=this.n34,
|
|
|
-D=this.n41,F=this.n42,G=this.n43,J=this.n44,H=a.n11,R=a.n21,P=a.n31,L=a.n12,N=a.n22,c=a.n32,Z=a.n13,ca=a.n23,$=a.n33,aa=a.n14,ha=a.n24;a=a.n34;this.n11=b*H+d*R+e*P;this.n12=b*L+d*N+e*c;this.n13=b*Z+d*ca+e*$;this.n14=b*aa+d*ha+e*a+h;this.n21=k*H+l*R+o*P;this.n22=k*L+l*N+o*c;this.n23=k*Z+l*ca+o*$;this.n24=k*aa+l*ha+o*a+n;this.n31=t*H+y*R+w*P;this.n32=t*L+y*N+w*c;this.n33=t*Z+y*ca+w*$;this.n34=t*aa+y*ha+w*a+C;this.n41=D*H+F*R+G*P;this.n42=D*L+F*N+G*c;this.n43=D*Z+F*ca+G*$;this.n44=D*aa+F*ha+G*a+J;return this},
|
|
|
-multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,h=this.n21,k=this.n22,l=this.n23,o=this.n24,n=this.n31,t=this.n32,y=this.n33,w=this.n34,C=this.n41,D=this.n42,F=this.n43,G=this.n44;return e*l*t*C-d*o*t*C-e*k*y*C+b*o*y*C+d*k*w*C-b*l*w*C-e*l*n*D+d*o*
|
|
|
-n*D+e*h*y*D-a*o*y*D-d*h*w*D+a*l*w*D+e*k*n*F-b*o*n*F-e*h*t*F+a*o*t*F+b*h*w*F-a*k*w*F-d*k*n*G+b*l*n*G+d*h*t*G-a*l*t*G-b*h*y*G+a*k*y*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=
|
|
|
+b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,j=a.n14,k=a.n21,o=a.n22,m=a.n23,t=a.n24,y=a.n31,x=a.n32,B=a.n33,C=a.n34,F=a.n41,G=a.n42,I=a.n43,H=a.n44,R=b.n11,Q=b.n12,N=b.n13,O=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,fa=b.n32,la=b.n33,ma=b.n34;this.n11=
|
|
|
+d*R+e*c+h*aa;this.n12=d*Q+e*Z+h*fa;this.n13=d*N+e*ca+h*la;this.n14=d*O+e*$+h*ma+j;this.n21=k*R+o*c+m*aa;this.n22=k*Q+o*Z+m*fa;this.n23=k*N+o*ca+m*la;this.n24=k*O+o*$+m*ma+t;this.n31=y*R+x*c+B*aa;this.n32=y*Q+x*Z+B*fa;this.n33=y*N+x*ca+B*la;this.n34=y*O+x*$+B*ma+C;this.n41=F*R+G*c+I*aa;this.n42=F*Q+G*Z+I*fa;this.n43=F*N+G*ca+I*la;this.n44=F*O+G*$+I*ma+H;return this},multiplyToArray:function(a,b,d){var e=a.n11,h=a.n12,j=a.n13,k=a.n14,o=a.n21,m=a.n22,t=a.n23,y=a.n24,x=a.n31,B=a.n32,C=a.n33,F=a.n34,G=
|
|
|
+a.n41,I=a.n42,H=a.n43;a=a.n44;var R=b.n11,Q=b.n12,N=b.n13,O=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,fa=b.n32,la=b.n33,ma=b.n34,ga=b.n41,qa=b.n42,ta=b.n43;b=b.n44;this.n11=e*R+h*c+j*aa+k*ga;this.n12=e*Q+h*Z+j*fa+k*qa;this.n13=e*N+h*ca+j*la+k*ta;this.n14=e*O+h*$+j*ma+k*b;this.n21=o*R+m*c+t*aa+y*ga;this.n22=o*Q+m*Z+t*fa+y*qa;this.n23=o*N+m*ca+t*la+y*ta;this.n24=o*O+m*$+t*ma+y*b;this.n31=x*R+B*c+C*aa+F*ga;this.n32=x*Q+B*Z+C*fa+F*qa;this.n33=x*N+B*ca+C*la+F*ta;this.n34=x*O+B*$+C*ma+F*b;this.n41=
|
|
|
+G*R+I*c+H*aa+a*ga;this.n42=G*Q+I*Z+H*fa+a*qa;this.n43=G*N+I*ca+H*la+a*ta;this.n44=G*O+I*$+H*ma+a*b;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,j=this.n21,k=this.n22,o=this.n23,m=this.n24,t=this.n31,y=this.n32,x=this.n33,B=this.n34,
|
|
|
+C=this.n41,F=this.n42,G=this.n43,I=this.n44,H=a.n11,R=a.n21,Q=a.n31,N=a.n12,O=a.n22,c=a.n32,Z=a.n13,ca=a.n23,$=a.n33,aa=a.n14,fa=a.n24;a=a.n34;this.n11=b*H+d*R+e*Q;this.n12=b*N+d*O+e*c;this.n13=b*Z+d*ca+e*$;this.n14=b*aa+d*fa+e*a+h;this.n21=j*H+k*R+o*Q;this.n22=j*N+k*O+o*c;this.n23=j*Z+k*ca+o*$;this.n24=j*aa+k*fa+o*a+m;this.n31=t*H+y*R+x*Q;this.n32=t*N+y*O+x*c;this.n33=t*Z+y*ca+x*$;this.n34=t*aa+y*fa+x*a+B;this.n41=C*H+F*R+G*Q;this.n42=C*N+F*O+G*c;this.n43=C*Z+F*ca+G*$;this.n44=C*aa+F*fa+G*a+I;return this},
|
|
|
+multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,h=this.n21,j=this.n22,k=this.n23,o=this.n24,m=this.n31,t=this.n32,y=this.n33,x=this.n34,B=this.n41,C=this.n42,F=this.n43,G=this.n44;return e*k*t*B-d*o*t*B-e*j*y*B+b*o*y*B+d*j*x*B-b*k*x*B-e*k*m*C+d*o*
|
|
|
+m*C+e*h*y*C-a*o*y*C-d*h*x*C+a*k*x*C+e*j*m*F-b*o*m*F-e*h*t*F+a*o*t*F+b*h*x*F-a*j*x*F-d*j*m*G+b*k*m*G+d*h*t*G-a*k*t*G-b*h*y*G+a*j*y*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=
|
|
|
this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;
|
|
|
a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),h=1-d,k=a.x,l=a.y,o=a.z,n=h*k,t=h*l;this.set(n*k+d,n*l-e*o,n*o+e*l,0,n*l+e*o,t*l+d,t*o-e*k,0,n*o-e*l,t*o+e*k,h*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=
|
|
|
-a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var k=Math.cos(e);e=Math.sin(e);var l=a*d,o=b*d;this.n11=h*k;this.n12=-h*e;this.n13=d;this.n21=o*k+a*e;this.n22=-o*e+a*k;this.n23=-b*h;this.n31=-l*k+b*e;this.n32=l*e+b*k;this.n33=a*h},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,h=a.w,k=b+b,l=d+d,o=e+e;a=b*k;var n=b*l;b*=o;var t=d*l;d*=o;e*=o;k*=h;l*=h;h*=o;this.n11=1-(t+e);this.n12=
|
|
|
-n-h;this.n13=b+l;this.n21=n+h;this.n22=1-(a+e);this.n23=d-k;this.n31=b-l;this.n32=d+k;this.n33=1-(a+t)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};
|
|
|
+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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),h=1-d,j=a.x,k=a.y,o=a.z,m=h*j,t=h*k;this.set(m*j+d,m*k-e*o,m*o+e*k,0,m*k+e*o,t*k+d,t*o-e*j,0,m*o-e*k,t*o+e*j,h*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=
|
|
|
+a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var j=Math.cos(e);e=Math.sin(e);var k=a*d,o=b*d;this.n11=h*j;this.n12=-h*e;this.n13=d;this.n21=o*j+a*e;this.n22=-o*e+a*j;this.n23=-b*h;this.n31=-k*j+b*e;this.n32=k*e+b*j;this.n33=a*h},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,h=a.w,j=b+b,k=d+d,o=e+e;a=b*j;var m=b*k;b*=o;var t=d*k;d*=o;e*=o;j*=h;k*=h;h*=o;this.n11=1-(t+e);this.n12=
|
|
|
+m-h;this.n13=b+k;this.n21=m+h;this.n22=1-(a+e);this.n23=d-j;this.n31=b-k;this.n32=d+j;this.n33=1-(a+t)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};
|
|
|
THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,h=a.n13,k=a.n14,l=a.n21,o=a.n22,n=a.n23,t=a.n24,y=a.n31,w=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,J=a.n43,H=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*D*G-t*C*G+t*w*J-o*D*J-n*w*H+o*C*H;b.n12=k*C*G-h*D*G-k*w*J+e*D*J+h*w*H-e*C*H;b.n13=h*t*G-k*n*G+k*o*J-e*t*J-h*o*H+e*n*H;b.n14=k*n*w-h*t*w-k*o*C+e*t*C+h*o*D-e*n*D;b.n21=t*C*F-n*D*F-t*y*J+l*D*J+n*y*H-l*C*H;b.n22=h*D*F-k*C*F+k*y*J-d*D*J-h*y*H+d*C*H;b.n23=k*n*F-h*t*F-k*l*J+d*t*J+h*l*H-d*n*H;
|
|
|
-b.n24=h*t*y-k*n*y+k*l*C-d*t*C-h*l*D+d*n*D;b.n31=o*D*F-t*w*F+t*y*G-l*D*G-o*y*H+l*w*H;b.n32=k*w*F-e*D*F-k*y*G+d*D*G+e*y*H-d*w*H;b.n33=h*t*F-k*o*F+k*l*G-d*t*G-e*l*H+d*o*H;b.n34=k*o*y-e*t*y-k*l*w+d*t*w+e*l*D-d*o*D;b.n41=n*w*F-o*C*F-n*y*G+l*C*G+o*y*J-l*w*J;b.n42=e*C*F-h*w*F+h*y*G-d*C*G-e*y*J+d*w*J;b.n43=h*o*F-e*n*F-h*l*G+d*n*G+e*l*J-d*o*J;b.n44=e*n*y-h*o*y+h*l*w-d*n*w-e*l*C+d*o*C;b.multiplyScalar(1/a.determinant());return b};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*k;d[3]=a*l;d[4]=a*o;d[5]=a*n;d[6]=a*t;d[7]=a*y;d[8]=a*w;return b};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,b,d,e,h,k){var l;l=new THREE.Matrix4;l.n11=2*h/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*h/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(k+h)/(k-h);l.n34=-2*k*h/(k-h);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,d,e,h,k){var l,o,n,t;l=new THREE.Matrix4;o=b-a;n=d-e;t=k-h;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/n;l.n23=0;l.n24=-((d+e)/n);l.n31=0;l.n32=0;l.n33=-2/t;l.n34=-((k+h)/t);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,h=a.n13,j=a.n14,k=a.n21,o=a.n22,m=a.n23,t=a.n24,y=a.n31,x=a.n32,B=a.n33,C=a.n34,F=a.n41,G=a.n42,I=a.n43,H=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=m*C*G-t*B*G+t*x*I-o*C*I-m*x*H+o*B*H;b.n12=j*B*G-h*C*G-j*x*I+e*C*I+h*x*H-e*B*H;b.n13=h*t*G-j*m*G+j*o*I-e*t*I-h*o*H+e*m*H;b.n14=j*m*x-h*t*x-j*o*B+e*t*B+h*o*C-e*m*C;b.n21=t*B*F-m*C*F-t*y*I+k*C*I+m*y*H-k*B*H;b.n22=h*C*F-j*B*F+j*y*I-d*C*I-h*y*H+d*B*H;b.n23=j*m*F-h*t*F-j*k*I+d*t*I+h*k*H-d*m*H;
|
|
|
+b.n24=h*t*y-j*m*y+j*k*B-d*t*B-h*k*C+d*m*C;b.n31=o*C*F-t*x*F+t*y*G-k*C*G-o*y*H+k*x*H;b.n32=j*x*F-e*C*F-j*y*G+d*C*G+e*y*H-d*x*H;b.n33=h*t*F-j*o*F+j*k*G-d*t*G-e*k*H+d*o*H;b.n34=j*o*y-e*t*y-j*k*x+d*t*x+e*k*C-d*o*C;b.n41=m*x*F-o*B*F-m*y*G+k*B*G+o*y*I-k*x*I;b.n42=e*B*F-h*x*F+h*y*G-d*B*G-e*y*I+d*x*I;b.n43=h*o*F-e*m*F-h*k*G+d*m*G+e*k*I-d*o*I;b.n44=e*m*y-h*o*y+h*k*x-d*m*x-e*k*B+d*o*B;b.multiplyScalar(1/a.determinant());return b};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,j=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*k+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*j;d[3]=a*k;d[4]=a*o;d[5]=a*m;d[6]=a*t;d[7]=a*y;d[8]=a*x;return b};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,b,d,e,h,j){var k;k=new THREE.Matrix4;k.n11=2*h/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*h/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(j+h)/(j-h);k.n34=-2*j*h/(j-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,e)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,d,e,h,j){var k,o,m,t;k=new THREE.Matrix4;o=b-a;m=d-e;t=j-h;k.n11=2/o;k.n12=0;k.n13=0;k.n14=-((b+a)/o);k.n21=0;k.n22=2/m;k.n23=0;k.n24=-((d+e)/m);k.n31=0;k.n32=0;k.n33=-2/t;k.n34=-((j+h)/t);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
|
|
|
this.visible=!0};
|
|
|
THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);
|
|
|
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))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var e=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21=
|
|
|
this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*e;this.matrixRotationWorld.n23=this.matrixWorld.n23*e;this.matrixRotationWorld.n33=this.matrixWorld.n33*e;this.matrixNeedsUpdate=!1;b=!0}a=0;for(e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,d)}}};
|
|
|
THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
|
|
|
-THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,h=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-h);h=Math.sin(-h);var k=Math.cos(d);d=Math.sin(d);var l=a*b,o=e*h;this.w=l*k-o*d;this.x=l*d+o*k;this.y=e*b*k+a*h*d;this.z=a*h*k-e*b*d;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*=-1;this.y*=
|
|
|
--1;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*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,h=this.w,k=a.x,l=a.y,o=a.z;a=a.w;this.x=b*a+h*k+d*o-e*l;this.y=d*a+h*l+e*k-b*o;this.z=e*a+h*o+b*l-d*k;this.w=h*a-b*k-d*l-e*o;return this},
|
|
|
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,h=a.z,k=this.x,l=this.y,o=this.z,n=this.w,t=n*d+l*h-o*e,y=n*e+o*d-k*h,w=n*h+k*e-l*d;d=-k*d-l*e-o*h;b.x=t*n+d*-k+y*-o-w*-l;b.y=y*n+d*-l+w*-k-t*-o;b.z=w*n+d*-o+t*-l-y*-k;return b}};
|
|
|
-THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var k=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*k)/l;e=Math.sin(e*k)/l;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d};
|
|
|
+THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,h=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-h);h=Math.sin(-h);var j=Math.cos(d);d=Math.sin(d);var k=a*b,o=e*h;this.w=k*j-o*d;this.x=k*d+o*j;this.y=e*b*j+a*h*d;this.z=a*h*j-e*b*d;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*=-1;this.y*=
|
|
|
+-1;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*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,h=this.w,j=a.x,k=a.y,o=a.z;a=a.w;this.x=b*a+h*j+d*o-e*k;this.y=d*a+h*k+e*j-b*o;this.z=e*a+h*o+b*k-d*j;this.w=h*a-b*j-d*k-e*o;return this},
|
|
|
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,h=a.z,j=this.x,k=this.y,o=this.z,m=this.w,t=m*d+k*h-o*e,y=m*e+o*d-j*h,x=m*h+j*e-k*d;d=-j*d-k*e-o*h;b.x=t*m+d*-j+y*-o-x*-k;b.y=y*m+d*-k+x*-j-t*-o;b.z=x*m+d*-o+t*-k-y*-j;return b}};
|
|
|
+THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var j=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*j)/k;e=Math.sin(e*j)/k;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d};
|
|
|
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
|
-THREE.Face3=function(a,b,d,e,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,e,h,k){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=k instanceof Array?k:[k]};
|
|
|
+THREE.Face3=function(a,b,d,e,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,e,h,j){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=j instanceof Array?j:[j]};
|
|
|
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
|
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,k,l,o=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){k=this.vertices[e];k.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){k=this.faces[e];if(a&&k.vertexNormals.length){o.set(0,0,0);b=0;for(d=k.normal.length;b<d;b++)o.addSelf(k.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[k.a];d=this.vertices[k.b];l=this.vertices[k.c];o.sub(l.position,
|
|
|
-d.position);n.sub(b.position,d.position);o.crossSelf(n)}o.isZero()||o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,j,k,o=new THREE.Vector3,m=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){j=this.vertices[e];j.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(a&&j.vertexNormals.length){o.set(0,0,0);b=0;for(d=j.normal.length;b<d;b++)o.addSelf(j.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[j.a];d=this.vertices[j.b];k=this.vertices[j.c];o.sub(k.position,
|
|
|
+d.position);m.sub(b.position,d.position);o.crossSelf(m)}o.isZero()||o.normalize();j.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(la,ia,qa,ta,Ca,xa,Fa){k=la.vertices[ia].position;l=la.vertices[qa].position;o=la.vertices[ta].position;n=h[Ca];t=h[xa];y=h[Fa];w=l.x-k.x;C=o.x-k.x;D=l.y-
|
|
|
-k.y;F=o.y-k.y;G=l.z-k.z;J=o.z-k.z;H=t.u-n.u;R=y.u-n.u;P=t.v-n.v;L=y.v-n.v;N=1/(H*L-R*P);ca.set((L*w-P*C)*N,(L*D-P*F)*N,(L*G-P*J)*N);$.set((H*C-R*w)*N,(H*F-R*D)*N,(H*J-R*G)*N);c[ia].addSelf(ca);c[qa].addSelf(ca);c[ta].addSelf(ca);Z[ia].addSelf($);Z[qa].addSelf($);Z[ta].addSelf($)}var b,d,e,h,k,l,o,n,t,y,w,C,D,F,G,J,H,R,P,L,N,c=[],Z=[],ca=new THREE.Vector3,$=new THREE.Vector3,aa=new THREE.Vector3,ha=new THREE.Vector3,ka=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){c[b]=new THREE.Vector3;
|
|
|
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(ma,ga,qa,ta,Ca,xa,Fa){j=ma.vertices[ga].position;k=ma.vertices[qa].position;o=ma.vertices[ta].position;m=h[Ca];t=h[xa];y=h[Fa];x=k.x-j.x;B=o.x-j.x;C=k.y-
|
|
|
+j.y;F=o.y-j.y;G=k.z-j.z;I=o.z-j.z;H=t.u-m.u;R=y.u-m.u;Q=t.v-m.v;N=y.v-m.v;O=1/(H*N-R*Q);ca.set((N*x-Q*B)*O,(N*C-Q*F)*O,(N*G-Q*I)*O);$.set((H*B-R*x)*O,(H*F-R*C)*O,(H*I-R*G)*O);c[ga].addSelf(ca);c[qa].addSelf(ca);c[ta].addSelf(ca);Z[ga].addSelf($);Z[qa].addSelf($);Z[ta].addSelf($)}var b,d,e,h,j,k,o,m,t,y,x,B,C,F,G,I,H,R,Q,N,O,c=[],Z=[],ca=new THREE.Vector3,$=new THREE.Vector3,aa=new THREE.Vector3,fa=new THREE.Vector3,la=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){c[b]=new THREE.Vector3;
|
|
|
Z[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];h=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
|
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){ka.copy(this.vertices[b].normal);e=c[b];aa.copy(e);aa.subSelf(ka.multiplyScalar(ka.dot(e))).normalize();ha.cross(this.vertices[b].normal,e);e=ha.dot(Z[b]);e=e<0?-1:1;this.vertices[b].tangent.set(aa.x,aa.y,aa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){la.copy(this.vertices[b].normal);e=c[b];aa.copy(e);aa.subSelf(la.multiplyScalar(la.dot(e))).normalize();fa.cross(this.vertices[b].normal,e);e=fa.dot(Z[b]);e=e<0?-1:1;this.vertices[b].tangent.set(aa.x,aa.y,aa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Camera=function(a,b,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var k=new THREE.Vector3;this.translateX=function(l,o){k.sub(this.target.position,this.position).normalize().multiplyScalar(l);k.crossSelf(this.up);if(o)k.y=0;this.position.addSelf(k);this.target.position.addSelf(k)};this.translateZ=
|
|
|
-function(l,o){k.sub(this.target.position,this.position).normalize().multiplyScalar(l);if(o)k.y=0;this.position.subSelf(k);this.target.position.subSelf(k)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
+THREE.Camera=function(a,b,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var j=new THREE.Vector3;this.translateX=function(k,o){j.sub(this.target.position,this.position).normalize().multiplyScalar(k);j.crossSelf(this.up);if(o)j.y=0;this.position.addSelf(j);this.target.position.addSelf(j)};this.translateZ=
|
|
|
+function(k,o){j.sub(this.target.position,this.position).normalize().multiplyScalar(k);if(o)j.y=0;this.position.subSelf(j);this.target.position.subSelf(j)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
|
|
|
this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
@@ -90,7 +90,7 @@ a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!=
|
|
|
undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
|
|
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
-THREE.Texture=function(a,b,d,e,h,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==undefined?h:THREE.LinearFilter;this.minFilter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
+THREE.Texture=function(a,b,d,e,h,j){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==undefined?h:THREE.LinearFilter;this.minFilter=j!==undefined?j:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
|
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
|
THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
@@ -110,77 +110,76 @@ THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)th
|
|
|
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,h=d.length;for(e=0;e<h;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(f,m,i){var g,j,p,u=f.vertices,x=u.length,z=f.colors,v=z.length,r=f.__vertexArray,K=f.__colorArray,O=f.__sortArray,M=f.__dirtyVertices,I=f.__dirtyColors;if(i.sortParticles){qa.multiplySelf(i.matrixWorld);for(g=0;g<x;g++){j=u[g].position;xa.copy(j);qa.multiplyVector3(xa);O[g]=[xa.z,g]}O.sort(function(Q,da){return da[0]-Q[0]});for(g=0;g<x;g++){j=u[O[g][1]].position;p=g*3;r[p]=j.x;r[p+1]=j.y;r[p+2]=j.z}for(g=0;g<v;g++){p=g*3;color=z[O[g][1]];K[p]=color.r;K[p+
|
|
|
-1]=color.g;K[p+2]=color.b}}else{if(M)for(g=0;g<x;g++){j=u[g].position;p=g*3;r[p]=j.x;r[p+1]=j.y;r[p+2]=j.z}if(I)for(g=0;g<v;g++){color=z[g];p=g*3;K[p]=color.r;K[p+1]=color.g;K[p+2]=color.b}}if(M||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,r,m)}if(I||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,K,m)}}function d(f,m){f.fragmentShader=m.fragmentShader;f.vertexShader=m.vertexShader;f.uniforms=Uniforms.clone(m.uniforms)}
|
|
|
-function e(f,m,i,g,j){g.program||$.initMaterial(g,m,i);var p=g.program,u=p.uniforms,x=g.uniforms;if(p!=Z){c.useProgram(p);Z=p;c.uniformMatrix4fv(u.projectionMatrix,!1,ta)}if(i&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){x.fogColor.value.setHex(i.color.hex);if(i instanceof THREE.Fog){x.fogNear.value=i.near;x.fogFar.value=i.far}else if(i instanceof
|
|
|
-THREE.FogExp2)x.fogDensity.value=i.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var z,v,r=0,K=0,O=0,M,I,Q,da=$.lights,s=da.directional.colors,ma=da.directional.positions,ea=da.point.colors,na=da.point.positions,A=0,B=0;i=v=v=0;for(z=m.length;i<z;i++){v=m[i];M=v.color;I=v.position;Q=v.intensity;if(v instanceof THREE.AmbientLight){r+=M.r;K+=M.g;O+=M.b}else if(v instanceof THREE.DirectionalLight){v=A*3;s[v]=M.r*Q;s[v+1]=M.g*Q;s[v+2]=M.b*Q;ma[v]=I.x;ma[v+1]=
|
|
|
-I.y;ma[v+2]=I.z;A+=1}else if(v instanceof THREE.PointLight){v=B*3;ea[v]=M.r*Q;ea[v+1]=M.g*Q;ea[v+2]=M.b*Q;na[v]=I.x;na[v+1]=I.y;na[v+2]=I.z;B+=1}}for(i=A*3;i<s.length;i++)s[i]=0;for(i=B*3;i<ea.length;i++)ea[i]=0;da.point.length=B;da.directional.length=A;da.ambient[0]=r;da.ambient[1]=K;da.ambient[2]=O;m=$.lights;x.enableLighting.value=m.directional.length+m.point.length;x.ambientLightColor.value=m.ambient;x.directionalLightColor.value=m.directional.colors;x.directionalLightDirection.value=m.directional.positions;
|
|
|
-x.pointLightColor.value=m.point.colors;x.pointLightPosition.value=m.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity;x.map.texture=g.map;x.lightMap.texture=g.lightMap;x.envMap.texture=g.envMap;x.reflectivity.value=g.reflectivity;x.refractionRatio.value=g.refractionRatio;x.combine.value=g.combine;x.useRefract.value=
|
|
|
-g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){x.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity;x.size.value=g.size;x.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(g.ambient.r,g.ambient.g,
|
|
|
-g.ambient.b);x.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);x.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)x.opacity.value=g.opacity;for(var E in x)if(r=p.uniforms[E]){i=x[E];z=i.type;m=i.value;if(z=="i")c.uniform1i(r,m);else if(z=="f")c.uniform1f(r,m);else if(z=="fv1")c.uniform1fv(r,m);else if(z=="fv")c.uniform3fv(r,m);else if(z=="v2")c.uniform2f(r,
|
|
|
-m.x,m.y);else if(z=="v3")c.uniform3f(r,m.x,m.y,m.z);else if(z=="c")c.uniform3f(r,m.r,m.g,m.b);else if(z=="t"){c.uniform1i(r,m);if(i=i.texture)if(i.image instanceof Array&&i.image.length==6){if(i.image.length==6){if(i.needsUpdate){if(!i.image.__webGLTextureCube)i.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);
|
|
|
-c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(z=0;z<6;++z)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[z]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube)}}else{if(i.needsUpdate){if(i.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
|
|
|
-i.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{i.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
|
|
|
-0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);i.__wasSetOnce=!0}i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}}}c.uniformMatrix4fv(u.modelViewMatrix,
|
|
|
-!1,j._modelViewMatrixArray);c.uniformMatrix3fv(u.normalMatrix,!1,j._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(u.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(u.objectMatrix,!1,j._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(u.viewMatrix,
|
|
|
-!1,Ca);if(g.skinning){c.uniformMatrix4fv(u.cameraInverseMatrix,!1,Ca);c.uniformMatrix4fv(u.boneGlobalMatrices,!1,j.boneMatrices)}return p}function h(f,m,i,g,j,p){f=e(f,m,i,g,p).attributes;c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
|
|
|
-3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(j.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(j.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
|
|
|
-if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
|
|
|
-4,c.FLOAT,!1,0,0)}if(p instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.drawElements(c.LINES,j.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,j.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(p instanceof THREE.Line){p=p.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(p,0,j.__webGLLineCount)}else if(p instanceof
|
|
|
-THREE.ParticleSystem)c.drawArrays(c.POINTS,0,j.__webGLParticleCount);else p instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,j.__webGLVertexCount)}function k(f,m){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.position);c.vertexAttribPointer(m.attributes.position,
|
|
|
-3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.normal);c.vertexAttribPointer(m.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(ha!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ha=f.flipSided}}function o(f){if(la!=
|
|
|
-f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);la=f}}function n(f){ia[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ia[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ia[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ia[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ia[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ia[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var m;for(f=0;f<6;f++){m=ia[f];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*
|
|
|
-m.z))}}function t(f){for(var m=f.matrixWorld,i=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ia[g].x*m.n14+ia[g].y*m.n24+ia[g].z*m.n34+ia[g].w;if(f<=i)return!1}return!0}function y(f,m){f.list[f.count]=m;f.count+=1}function w(f){var m,i,g=f.object,j=f.opaque,p=f.transparent;p.count=0;f=j.count=0;for(m=g.materials.length;f<m;f++){i=g.materials[f];i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?y(p,i):y(j,i)}}function C(f){var m,i,g,j,p=f.object,
|
|
|
-u=f.buffer,x=f.opaque,z=f.transparent;z.count=0;f=x.count=0;for(g=p.materials.length;f<g;f++){m=p.materials[f];if(m instanceof THREE.MeshFaceMaterial){m=0;for(i=u.materials.length;m<i;m++)(j=u.materials[m])&&(j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(z,j):y(x,j))}else{j=m;j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(z,j):y(x,j)}}}function D(f,m){return m.z-f.z}function F(f,m){f._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);
|
|
|
-THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){function m(K){var O=[];i=0;for(g=K.length;i<g;i++)K[i]==undefined?O.push("undefined"):O.push(K[i].id);return O.join("_")}var i,g,j,p,u,x,z,v,r={};f.geometryGroups={};j=0;for(p=f.faces.length;j<p;j++){u=f.faces[j];x=u.materials;z=m(x);r[z]==undefined&&(r[z]={hash:z,counter:0});v=r[z].hash+"_"+r[z].counter;f.geometryGroups[v]==undefined&&(f.geometryGroups[v]={faces:[],materials:x,vertices:0});u=u instanceof
|
|
|
-THREE.Face3?3:4;if(f.geometryGroups[v].vertices+u>65535){r[z].counter+=1;v=r[z].hash+"_"+r[z].counter;f.geometryGroups[v]==undefined&&(f.geometryGroups[v]={faces:[],materials:x,vertices:0})}f.geometryGroups[v].faces.push(j);f.geometryGroups[v].vertices+=u}}function J(f,m,i){f.push({buffer:m,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(f){if(f!=ka){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
|
|
|
-c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ka=f}}function R(f,m){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,
|
|
|
-f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,L(f.format),f.width,f.height,0,L(f.format),L(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,
|
|
|
-f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var i,g,j;if(f){i=f.__webGLFramebuffer;g=f.width;j=f.height}else{i=null;g=N.width;j=N.height}if(i!=ca){c.bindFramebuffer(c.FRAMEBUFFER,i);c.viewport(0,0,g,j);m&&c.clear(c.COLOR_BUFFER_BIT|
|
|
|
-c.DEPTH_BUFFER_BIT);ca=i}}function P(f,m){var i;if(f=="fragment")i=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(i=c.createShader(c.VERTEX_SHADER));c.shaderSource(i,m);c.compileShader(i);if(!c.getShaderParameter(i,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(i));return null}return i}function L(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
|
|
|
+THREE.WebGLRenderer=function(a){function b(f,l,n){var g,i,v,p=f.vertices,r=p.length,z=f.colors,s=z.length,w=f.__vertexArray,L=f.__colorArray,T=f.__sortArray,P=f.__dirtyVertices,K=f.__dirtyColors;if(n.sortParticles){qa.multiplySelf(n.matrixWorld);for(g=0;g<r;g++){i=p[g].position;xa.copy(i);qa.multiplyVector3(xa);T[g]=[xa.z,g]}T.sort(function(M,J){return J[0]-M[0]});for(g=0;g<r;g++){i=p[T[g][1]].position;v=g*3;w[v]=i.x;w[v+1]=i.y;w[v+2]=i.z}for(g=0;g<s;g++){v=g*3;color=z[T[g][1]];L[v]=color.r;L[v+1]=
|
|
|
+color.g;L[v+2]=color.b}}else{if(P)for(g=0;g<r;g++){i=p[g].position;v=g*3;w[v]=i.x;w[v+1]=i.y;w[v+2]=i.z}if(K)for(g=0;g<s;g++){color=z[g];v=g*3;L[v]=color.r;L[v+1]=color.g;L[v+2]=color.b}}if(P||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,l)}if(K||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,L,l)}}function d(f,l){f.fragmentShader=l.fragmentShader;f.vertexShader=l.vertexShader;f.uniforms=Uniforms.clone(l.uniforms)}
|
|
|
+function e(f,l,n,g,i){g.program||$.initMaterial(g,l,n);var v=g.program,p=v.uniforms,r=g.uniforms;if(v!=Z){c.useProgram(v);Z=v;c.uniformMatrix4fv(p.projectionMatrix,!1,ta)}if(n&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=n.far}else if(n instanceof
|
|
|
+THREE.FogExp2)r.fogDensity.value=n.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var z,s,w=0,L=0,T=0,P,K,M,J=$.lights,na=J.directional.colors,u=J.directional.positions,ia=J.point.colors,ha=J.point.positions,ka=0,A=0;n=s=s=0;for(z=l.length;n<z;n++){s=l[n];P=s.color;K=s.position;M=s.intensity;if(s instanceof THREE.AmbientLight){w+=P.r;L+=P.g;T+=P.b}else if(s instanceof THREE.DirectionalLight){s=ka*3;na[s]=P.r*M;na[s+1]=P.g*M;na[s+2]=P.b*M;u[s]=K.x;u[s+1]=K.y;
|
|
|
+u[s+2]=K.z;ka+=1}else if(s instanceof THREE.PointLight){s=A*3;ia[s]=P.r*M;ia[s+1]=P.g*M;ia[s+2]=P.b*M;ha[s]=K.x;ha[s+1]=K.y;ha[s+2]=K.z;A+=1}}for(n=ka*3;n<na.length;n++)na[n]=0;for(n=A*3;n<ia.length;n++)ia[n]=0;J.point.length=A;J.directional.length=ka;J.ambient[0]=w;J.ambient[1]=L;J.ambient[2]=T;l=$.lights;r.enableLighting.value=l.directional.length+l.point.length;r.ambientLightColor.value=l.ambient;r.directionalLightColor.value=l.directional.colors;r.directionalLightDirection.value=l.directional.positions;
|
|
|
+r.pointLightColor.value=l.point.colors;r.pointLightPosition.value=l.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.map.texture=g.map;r.lightMap.texture=g.lightMap;r.envMap.texture=g.envMap;r.reflectivity.value=g.reflectivity;r.refractionRatio.value=g.refractionRatio;r.combine.value=g.combine;r.useRefract.value=
|
|
|
+g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.size.value=g.size;r.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(g.ambient.r,g.ambient.g,
|
|
|
+g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=f.near;r.mFar.value=f.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var D in r)if(w=v.uniforms[D]){n=r[D];z=n.type;l=n.value;if(z=="i")c.uniform1i(w,l);else if(z=="f")c.uniform1f(w,l);else if(z=="fv1")c.uniform1fv(w,l);else if(z=="fv")c.uniform3fv(w,l);else if(z=="v2")c.uniform2f(w,
|
|
|
+l.x,l.y);else if(z=="v3")c.uniform3f(w,l.x,l.y,l.z);else if(z=="c")c.uniform3f(w,l.r,l.g,l.b);else if(z=="t"){c.uniform1i(w,l);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(!n.image.__webGLTextureCube)n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);
|
|
|
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(z=0;z<6;++z)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[z]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
|
|
|
+n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(n.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(n.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(n.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(n.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{n.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
|
|
|
+0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(n.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(n.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(n.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(n.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);n.__wasSetOnce=!0}n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(p.modelViewMatrix,
|
|
|
+!1,i._modelViewMatrixArray);c.uniformMatrix3fv(p.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(p.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(p.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(p.viewMatrix,
|
|
|
+!1,Ca);if(g.skinning){c.uniformMatrix4fv(p.cameraInverseMatrix,!1,Ca);c.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.boneMatrices)}return v}function h(f,l,n,g,i,v){f=e(f,l,n,g,v).attributes;c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
|
|
|
+3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
|
|
|
+if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
|
|
|
+4,c.FLOAT,!1,0,0)}if(v instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,i.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(v instanceof THREE.Line){v=v.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(v,0,i.__webGLLineCount)}else if(v instanceof
|
|
|
+THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else v instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function j(f,l){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.position);c.vertexAttribPointer(l.attributes.position,
|
|
|
+3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.normal);c.vertexAttribPointer(l.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(fa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);fa=f.flipSided}}function o(f){if(ma!=
|
|
|
+f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);ma=f}}function m(f){ga[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ga[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ga[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ga[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ga[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ga[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var l;for(f=0;f<6;f++){l=ga[f];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*
|
|
|
+l.z))}}function t(f){for(var l=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ga[g].x*l.n14+ga[g].y*l.n24+ga[g].z*l.n34+ga[g].w;if(f<=n)return!1}return!0}function y(f,l){f.list[f.count]=l;f.count+=1}function x(f){var l,n,g=f.object,i=f.opaque,v=f.transparent;v.count=0;f=i.count=0;for(l=g.materials.length;f<l;f++){n=g.materials[f];n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?y(v,n):y(i,n)}}function B(f){var l,n,g,i,v=f.object,
|
|
|
+p=f.buffer,r=f.opaque,z=f.transparent;z.count=0;f=r.count=0;for(g=v.materials.length;f<g;f++){l=v.materials[f];if(l instanceof THREE.MeshFaceMaterial){l=0;for(n=p.materials.length;l<n;l++)(i=p.materials[l])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?y(z,i):y(r,i))}else{i=l;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?y(z,i):y(r,i)}}}function C(f,l){return l.z-f.z}function F(f,l){f._modelViewMatrix.multiplyToArray(l.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);
|
|
|
+THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){function l(L){var T=[];n=0;for(g=L.length;n<g;n++)L[n]==undefined?T.push("undefined"):T.push(L[n].id);return T.join("_")}var n,g,i,v,p,r,z,s,w={};f.geometryGroups={};i=0;for(v=f.faces.length;i<v;i++){p=f.faces[i];r=p.materials;z=l(r);w[z]==undefined&&(w[z]={hash:z,counter:0});s=w[z].hash+"_"+w[z].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});p=p instanceof
|
|
|
+THREE.Face3?3:4;if(f.geometryGroups[s].vertices+p>65535){w[z].counter+=1;s=w[z].hash+"_"+w[z].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);f.geometryGroups[s].vertices+=p}}function I(f,l,n){f.push({buffer:l,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(f){if(f!=la){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
|
|
|
+c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}la=f}}function R(f,l){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,
|
|
|
+f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(f.format),f.width,f.height,0,N(f.format),N(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,
|
|
|
+f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var n,g,i;if(f){n=f.__webGLFramebuffer;g=f.width;i=f.height}else{n=null;g=O.width;i=O.height}if(n!=ca){c.bindFramebuffer(c.FRAMEBUFFER,n);c.viewport(0,0,g,i);l&&c.clear(c.COLOR_BUFFER_BIT|
|
|
|
+c.DEPTH_BUFFER_BIT);ca=n}}function Q(f,l){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,l);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function N(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
|
|
|
case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;
|
|
|
-case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),c,Z=null,ca=null,$=this,aa=null,ha=null,ka=null,la=null,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
|
|
|
-qa=new THREE.Matrix4,ta=new Float32Array(16),Ca=new Float32Array(16),xa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ma=a.clearAlpha}this.domElement=N;this.autoClear=!0;this.sortObjects=!1;(function(f,m,i){try{c=N.getContext("experimental-webgl",{antialias:f})}catch(g){console.log(g)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
|
|
|
-c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(m.r,m.g,m.b,i);_cullEnabled=!0})(Fa,La,Ma);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,m){N.width=f;N.height=m;c.viewport(0,0,N.width,N.height)};this.setClearColorHex=function(f,m){var i=new THREE.Color(f);c.clearColor(i.r,i.g,i.b,m)};this.setClearColor=
|
|
|
-function(f,m){c.clearColor(f.r,f.g,f.b,m)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,m,i){var g,j;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);
|
|
|
-else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var p,u,x,z;j=x=z=0;for(p=m.length;j<p;j++){u=m[j];u instanceof THREE.DirectionalLight&&x++;u instanceof THREE.PointLight&&z++}if(z+x<=4)m=x;else{m=Math.ceil(4*x/(z+x));z=4-m}j={directional:m,point:z};z=f.fragmentShader;m=f.vertexShader;p={fog:i,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:j.directional,
|
|
|
-maxPointLights:j.point};i=c.createProgram();j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+p.maxDirLights,"#define MAX_POINT_LIGHTS "+p.maxPointLights,p.fog?"#define USE_FOG":"",p.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.lightMap?"#define USE_LIGHTMAP":"",p.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
-0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+p.maxDirLights,"#define MAX_POINT_LIGHTS "+p.maxPointLights,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.lightMap?"#define USE_LIGHTMAP":"",p.vertexColors?"#define USE_COLOR":"",p.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
-c.attachShader(i,P("fragment",j+z));c.attachShader(i,P("vertex",p+m));c.linkProgram(i);c.getProgramParameter(i,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(i,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)i.push(g);g=f.program;z=0;for(m=i.length;z<
|
|
|
-m;z++){j=i[z];g.uniforms[j]=c.getUniformLocation(g,j)}g=f.program;i=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];z=0;for(m=i.length;z<m;z++){j=i[z];g.attributes[j]=c.getAttribLocation(g,j)}g=f.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
|
|
|
-0&&g.skinIndex>=0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,m,i,g){var j,p,u,x,z,v,r,K,O=f.lights,M=f.fog;m.matrixAutoUpdate&&m.update();m.matrixWorldInverse.flattenToArray(Ca);m.projectionMatrix.flattenToArray(ta);qa.multiply(m.projectionMatrix,m.matrixWorldInverse);n(qa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,
|
|
|
-!1,m);this.initWebGLObjects(f,m);R(i,g!==undefined?g:!0);this.autoClear&&this.clear();z=f.__webglObjects.length;for(g=0;g<z;g++){j=f.__webglObjects[g];r=j.object;if(r.visible)if(!(r instanceof THREE.Mesh)||t(r)){r.matrixWorld.flattenToArray(r._objectMatrixArray);F(r,m);C(j);j.render=!0;if(this.sortObjects){xa.copy(r.position);qa.multiplyVector3(xa);j.z=xa.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(D);v=f.__webglObjectsImmediate.length;for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];
|
|
|
-r=j.object;if(r.visible){r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray);F(r,m);w(j)}}H(THREE.NormalBlending);for(g=0;g<z;g++){j=f.__webglObjects[g];if(j.render){r=j.object;K=j.buffer;u=j.opaque;l(r);for(j=0;j<u.count;j++){x=u.list[j];o(x.depthTest);h(m,O,M,x,K,r)}}}for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];r=j.object;if(r.visible){u=j.opaque;l(r);for(j=0;j<u.count;j++){x=u.list[j];o(x.depthTest);p=e(m,O,M,x,r);r.render(function(I){k(I,p)})}}}for(g=0;g<z;g++){j=f.__webglObjects[g];
|
|
|
-if(j.render){r=j.object;K=j.buffer;u=j.transparent;l(r);for(j=0;j<u.count;j++){x=u.list[j];H(x.blending);o(x.depthTest);h(m,O,M,x,K,r)}}}for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];r=j.object;if(r.visible){u=j.transparent;l(r);for(j=0;j<u.count;j++){x=u.list[j];H(x.blending);o(x.depthTest);p=e(m,O,M,x,r);r.render(function(I){k(I,p)})}}}if(i&&i.minFilter!==THREE.NearestFilter&&i.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
|
|
|
-null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsRemoved.length;){var m=f.__objectsRemoved[0],i=f,g=void 0,j=void 0;for(g=i.__webglObjects.length-1;g>=0;g--){j=i.__webglObjects[g].object;m==j&&i.__webglObjects.splice(g,1)}f.__objectsRemoved.splice(0,1)}for(;f.__objectsAdded.length;){m=f.__objectsAdded[0];var p=f;g=void 0;i=void 0;j=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=
|
|
|
-new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}objlist=p.__webglObjects;if(m instanceof THREE.Mesh){i=m.geometry;i.geometryGroups==undefined&&G(i);for(g in i.geometryGroups){j=i.geometryGroups[g];if(!j.__webGLVertexBuffer){p=j;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=
|
|
|
-c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=c.createBuffer();p=j;var u=m,x=void 0,z=void 0,v=0,r=0,K=0,O=u.geometry.faces,M=p.faces;x=0;for(z=M.length;x<z;x++){fi=M[x];face=O[fi];if(face instanceof THREE.Face3){v+=3;r+=1;K+=3}else if(face instanceof THREE.Face4){v+=
|
|
|
-4;r+=2;K+=4}}p.__vertexArray=new Float32Array(v*3);p.__normalArray=new Float32Array(v*3);p.__tangentArray=new Float32Array(v*4);p.__colorArray=new Float32Array(v*3);p.__uvArray=new Float32Array(v*2);p.__uv2Array=new Float32Array(v*2);p.__skinVertexAArray=new Float32Array(v*4);p.__skinVertexBArray=new Float32Array(v*4);p.__skinIndexArray=new Float32Array(v*4);p.__skinWeightArray=new Float32Array(v*4);p.__faceArray=new Uint16Array(r*3);p.__lineArray=new Uint16Array(K*2);z=x=p;v=void 0;O=void 0;var I=
|
|
|
-void 0,Q=void 0;I=void 0;M=!1;v=0;for(O=u.materials.length;v<O;v++){I=u.materials[v];if(I instanceof THREE.MeshFaceMaterial){I=0;for(Q=z.materials.length;I<Q;I++)if(z.materials[I]&&z.materials[I].shading!=undefined&&z.materials[I].shading==THREE.SmoothShading){M=!0;break}}else if(I&&I.shading!=undefined&&I.shading==THREE.SmoothShading){M=!0;break}if(M)break}x.__needsSmoothNormals=M;p.__webGLFaceCount=r*3;p.__webGLLineCount=K*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
|
|
|
-!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}J(objlist,j,m)}}else if(m instanceof THREE.Ribbon){i=m.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__webGLVertexCount=j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,m)}else if(m instanceof THREE.Line){i=m.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();
|
|
|
-g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__webGLLineCount=j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,m)}else if(m instanceof THREE.ParticleSystem){i=m.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__sortArray=[];g.__webGLParticleCount=
|
|
|
-j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}m=0;for(i=f.__webglObjects.length;m<i;m++){j=void 0;g=void 0;r=void 0;p=void 0;p=f.__webglObjects[m].object;if(p instanceof THREE.Mesh){g=p.geometry;for(j in g.geometryGroups){r=g.geometryGroups[j];if(g.__dirtyVertices||g.__dirtyElements||g.__dirtyUvs||
|
|
|
-g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents){K=c.DYNAMIC_DRAW;x=void 0;z=void 0;var da=void 0,s=void 0,ma=void 0,ea=void 0,na=void 0;da=void 0;var A=void 0,B=void 0,E=void 0,S=void 0;A=void 0;B=void 0;E=void 0;s=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;s=void 0;ea=void 0;ma=void 0;na=void 0;var T=Q=I=M=O=v=u=0,oa=0,ba=0,q=0,fa=r.__vertexArray,Da=
|
|
|
-r.__uvArray,Ea=r.__uv2Array,sa=r.__normalArray,U=r.__tangentArray,ga=r.__colorArray,V=r.__skinVertexAArray,W=r.__skinVertexBArray,X=r.__skinIndexArray,Y=r.__skinWeightArray,ua=r.__faceArray,pa=r.__lineArray,Na=r.__needsSmoothNormals,ja=p.geometry,Ga=ja.__dirtyVertices,Ha=ja.__dirtyElements,Ba=ja.__dirtyUvs,Ia=ja.__dirtyNormals,Ja=ja.__dirtyTangents,Ka=ja.__dirtyColors,ra=ja.vertices,Oa=r.faces,Pa=ja.faces,Qa=ja.uvs,Ra=ja.uvs2,va=ja.colors,ya=ja.skinVerticesA,za=ja.skinVerticesB,Aa=ja.skinIndices,
|
|
|
-wa=ja.skinWeights;x=0;for(z=Oa.length;x<z;x++){da=Oa[x];s=Pa[da];na=Qa[da];da=Ra[da];ma=s.vertexNormals;ea=s.normal;if(s instanceof THREE.Face3){if(Ga){A=ra[s.a].position;B=ra[s.b].position;E=ra[s.c].position;fa[v]=A.x;fa[v+1]=A.y;fa[v+2]=A.z;fa[v+3]=B.x;fa[v+4]=B.y;fa[v+5]=B.z;fa[v+6]=E.x;fa[v+7]=E.y;fa[v+8]=E.z;v+=9}if(wa.length){A=wa[s.a];B=wa[s.b];E=wa[s.c];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=B.x;Y[q+5]=B.y;Y[q+6]=B.z;Y[q+7]=B.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;A=Aa[s.a];
|
|
|
-B=Aa[s.b];E=Aa[s.c];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;A=ya[s.a];B=ya[s.b];E=ya[s.c];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;A=za[s.a];B=za[s.b];E=za[s.c];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;q+=12}if(Ka&&va.length){A=va[s.a];B=va[s.b];
|
|
|
-E=va[s.c];ga[ba]=A.r;ga[ba+1]=A.g;ga[ba+2]=A.b;ga[ba+3]=B.r;ga[ba+4]=B.g;ga[ba+5]=B.b;ga[ba+6]=E.r;ga[ba+7]=E.g;ga[ba+8]=E.b;ba+=9}if(Ja&&ja.hasTangents){A=ra[s.a].tangent;B=ra[s.b].tangent;E=ra[s.c].tangent;U[T]=A.x;U[T+1]=A.y;U[T+2]=A.z;U[T+3]=A.w;U[T+4]=B.x;U[T+5]=B.y;U[T+6]=B.z;U[T+7]=B.w;U[T+8]=E.x;U[T+9]=E.y;U[T+10]=E.z;U[T+11]=E.w;T+=12}if(Ia)if(ma.length==3&&Na)for(s=0;s<3;s++){ea=ma[s];sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}else for(s=0;s<3;s++){sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=
|
|
|
-3}if(Ba&&na)for(s=0;s<3;s++){ma=na[s];Da[O]=ma.u;Da[O+1]=ma.v;O+=2}if(Ba&&da)for(s=0;s<3;s++){na=da[s];Ea[M]=na.u;Ea[M+1]=na.v;M+=2}if(Ha){ua[I]=u;ua[I+1]=u+1;ua[I+2]=u+2;I+=3;pa[oa]=u;pa[oa+1]=u+1;pa[oa+2]=u;pa[oa+3]=u+2;pa[oa+4]=u+1;pa[oa+5]=u+2;oa+=6;u+=3}}else if(s instanceof THREE.Face4){if(Ga){A=ra[s.a].position;B=ra[s.b].position;E=ra[s.c].position;S=ra[s.d].position;fa[v]=A.x;fa[v+1]=A.y;fa[v+2]=A.z;fa[v+3]=B.x;fa[v+4]=B.y;fa[v+5]=B.z;fa[v+6]=E.x;fa[v+7]=E.y;fa[v+8]=E.z;fa[v+9]=S.x;fa[v+10]=
|
|
|
-S.y;fa[v+11]=S.z;v+=12}if(wa.length){A=wa[s.a];B=wa[s.b];E=wa[s.c];S=wa[s.d];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=B.x;Y[q+5]=B.y;Y[q+6]=B.z;Y[q+7]=B.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;Y[q+12]=S.x;Y[q+13]=S.y;Y[q+14]=S.z;Y[q+15]=S.w;A=Aa[s.a];B=Aa[s.b];E=Aa[s.c];S=Aa[s.d];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;X[q+12]=S.x;X[q+13]=S.y;X[q+14]=S.z;X[q+15]=S.w;A=ya[s.a];B=ya[s.b];E=ya[s.c];
|
|
|
-S=ya[s.d];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;V[q+12]=S.x;V[q+13]=S.y;V[q+14]=S.z;V[q+15]=1;A=za[s.a];B=za[s.b];E=za[s.c];S=za[s.d];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;W[q+12]=S.x;W[q+13]=S.y;W[q+14]=S.z;W[q+15]=1;q+=16}if(Ka&&va.length){A=va[s.a];B=va[s.b];E=va[s.c];S=va[s.d];ga[ba]=A.r;ga[ba+1]=A.g;ga[ba+2]=A.b;ga[ba+
|
|
|
-3]=B.r;ga[ba+4]=B.g;ga[ba+5]=B.b;ga[ba+6]=E.r;ga[ba+7]=E.g;ga[ba+8]=E.b;ga[ba+9]=S.r;ga[ba+10]=S.g;ga[ba+11]=S.b;ba+=12}if(Ja&&ja.hasTangents){A=ra[s.a].tangent;B=ra[s.b].tangent;E=ra[s.c].tangent;s=ra[s.d].tangent;U[T]=A.x;U[T+1]=A.y;U[T+2]=A.z;U[T+3]=A.w;U[T+4]=B.x;U[T+5]=B.y;U[T+6]=B.z;U[T+7]=B.w;U[T+8]=E.x;U[T+9]=E.y;U[T+10]=E.z;U[T+11]=E.w;U[T+12]=s.x;U[T+13]=s.y;U[T+14]=s.z;U[T+15]=s.w;T+=16}if(Ia)if(ma.length==4&&Na)for(s=0;s<4;s++){ea=ma[s];sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}else for(s=
|
|
|
-0;s<4;s++){sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}if(Ba&&na)for(s=0;s<4;s++){ma=na[s];Da[O]=ma.u;Da[O+1]=ma.v;O+=2}if(Ba&&da)for(s=0;s<4;s++){na=da[s];Ea[M]=na.u;Ea[M+1]=na.v;M+=2}if(Ha){ua[I]=u;ua[I+1]=u+1;ua[I+2]=u+2;ua[I+3]=u;ua[I+4]=u+2;ua[I+5]=u+3;I+=6;pa[oa]=u;pa[oa+1]=u+1;pa[oa+2]=u;pa[oa+3]=u+3;pa[oa+4]=u+1;pa[oa+5]=u+2;pa[oa+6]=u+2;pa[oa+7]=u+3;oa+=8;u+=4}}}if(Ga){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,K)}if(Ka&&va.length){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ga,K)}if(Ia){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,sa,K)}if(Ja&&ja.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,U,K)}if(Ba&&O>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Da,K)}if(Ba&&M>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ea,K)}if(Ha){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);
|
|
|
-c.bufferData(c.ELEMENT_ARRAY_BUFFER,ua,K);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,pa,K)}if(q>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,V,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,W,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,X,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,Y,
|
|
|
-K)}}}g.__dirtyVertices=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyTangents=!1;g.__dirtyColors=!1}else if(p instanceof THREE.Ribbon){g=p.geometry;if(g.__dirtyVertices||g.__dirtyColors){j=g;p=c.DYNAMIC_DRAW;u=void 0;u=void 0;v=void 0;r=void 0;O=j.vertices;K=j.colors;M=O.length;x=K.length;I=j.__vertexArray;z=j.__colorArray;Q=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<M;u++){v=O[u].position;r=u*3;I[r]=v.x;I[r+1]=v.y;I[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);
|
|
|
-c.bufferData(c.ARRAY_BUFFER,I,p)}if(Q){for(u=0;u<x;u++){color=K[u];r=u*3;z[r]=color.r;z[r+1]=color.g;z[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(p instanceof THREE.Line){g=p.geometry;if(g.__dirtyVertices||g.__dirtyColors){j=g;p=c.DYNAMIC_DRAW;u=void 0;u=void 0;v=void 0;r=void 0;O=j.vertices;K=j.colors;M=O.length;x=K.length;I=j.__vertexArray;z=j.__colorArray;Q=j.__dirtyColors;if(j.__dirtyVertices){for(u=
|
|
|
-0;u<M;u++){v=O[u].position;r=u*3;I[r]=v.x;I[r+1]=v.y;I[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,p)}if(Q){for(u=0;u<x;u++){color=K[u];r=u*3;z[r]=color.r;z[r+1]=color.g;z[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(p instanceof THREE.ParticleSystem){g=p.geometry;(g.__dirtyVertices||g.__dirtyColors||p.sortParticles)&&b(g,c.DYNAMIC_DRAW,p);g.__dirtyVertices=
|
|
|
-!1;g.__dirtyColors=!1}}};this.setFaceCulling=function(f,m){if(f){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
-THREE.Snippets={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 int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\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",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
-map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
-lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
+case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var O=document.createElement("canvas"),c,Z=null,ca=null,$=this,aa=null,fa=null,la=null,ma=null,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
|
|
|
+qa=new THREE.Matrix4,ta=new Float32Array(16),Ca=new Float32Array(16),xa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ma=a.clearAlpha}this.domElement=O;this.autoClear=!0;this.sortObjects=!1;(function(f,l,n){try{c=O.getContext("experimental-webgl",{antialias:f})}catch(g){console.log(g)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
|
|
|
+c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(l.r,l.g,l.b,n);_cullEnabled=!0})(Fa,La,Ma);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,l){O.width=f;O.height=l;c.viewport(0,0,O.width,O.height)};this.setClearColorHex=function(f,l){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,l)};this.setClearColor=
|
|
|
+function(f,l){c.clearColor(f.r,f.g,f.b,l)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,l,n){var g,i;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);
|
|
|
+else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var v,p,r,z;i=r=z=0;for(v=l.length;i<v;i++){p=l[i];p instanceof THREE.DirectionalLight&&r++;p instanceof THREE.PointLight&&z++}if(z+r<=4)l=r;else{l=Math.ceil(4*r/(z+r));z=4-l}i={directional:l,point:z};z=f.fragmentShader;l=f.vertexShader;v={fog:n,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:i.directional,
|
|
|
+maxPointLights:i.point};n=c.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
+0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+c.attachShader(n,Q("fragment",i+z));c.attachShader(n,Q("vertex",v+l));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)n.push(g);g=f.program;z=0;for(l=n.length;z<
|
|
|
+l;z++){i=n[z];g.uniforms[i]=c.getUniformLocation(g,i)}g=f.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];z=0;for(l=n.length;z<l;z++){i=n[z];g.attributes[i]=c.getAttribLocation(g,i)}g=f.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
|
|
|
+0&&g.skinIndex>=0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,l,n,g){var i,v,p,r,z,s,w,L,T=f.lights,P=f.fog;l.matrixAutoUpdate&&l.update();l.matrixWorldInverse.flattenToArray(Ca);l.projectionMatrix.flattenToArray(ta);qa.multiply(l.projectionMatrix,l.matrixWorldInverse);m(qa);f.update(undefined,!1,l);this.initWebGLObjects(f,l);R(n,g!==undefined?
|
|
|
+g:!0);this.autoClear&&this.clear();z=f.__webglObjects.length;for(g=0;g<z;g++){i=f.__webglObjects[g];w=i.object;if(w.visible)if(!(w instanceof THREE.Mesh)||t(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);F(w,l);B(i);i.render=!0;if(this.sortObjects){xa.copy(w.position);qa.multiplyVector3(xa);i.z=xa.z}}else i.render=!1;else i.render=!1}this.sortObjects&&f.__webglObjects.sort(C);s=f.__webglObjectsImmediate.length;for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];w=i.object;if(w.visible){w.matrixAutoUpdate&&
|
|
|
+w.matrixWorld.flattenToArray(w._objectMatrixArray);F(w,l);x(i)}}H(THREE.NormalBlending);for(g=0;g<z;g++){i=f.__webglObjects[g];if(i.render){w=i.object;L=i.buffer;p=i.opaque;k(w);for(i=0;i<p.count;i++){r=p.list[i];o(r.depthTest);h(l,T,P,r,L,w)}}}for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];w=i.object;if(w.visible){p=i.opaque;k(w);for(i=0;i<p.count;i++){r=p.list[i];o(r.depthTest);v=e(l,T,P,r,w);w.render(function(K){j(K,v)})}}}for(g=0;g<z;g++){i=f.__webglObjects[g];if(i.render){w=i.object;L=i.buffer;
|
|
|
+p=i.transparent;k(w);for(i=0;i<p.count;i++){r=p.list[i];H(r.blending);o(r.depthTest);h(l,T,P,r,L,w)}}}for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];w=i.object;if(w.visible){p=i.transparent;k(w);for(i=0;i<p.count;i++){r=p.list[i];H(r.blending);o(r.depthTest);v=e(l,T,P,r,w);w.render(function(K){j(K,v)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
|
|
|
+function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var l=f.__objectsAdded[0],n=f,g=void 0,i=void 0,v=void 0;if(l._modelViewMatrix==undefined){l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);l._objectMatrixArray=new Float32Array(16);l.matrixWorld.flattenToArray(l._objectMatrixArray)}if(l instanceof THREE.Mesh){i=l.geometry;i.geometryGroups==undefined&&G(i);for(g in i.geometryGroups){v=
|
|
|
+i.geometryGroups[g];if(!v.__webGLVertexBuffer){var p=v;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=
|
|
|
+c.createBuffer();p=v;var r=l,z=void 0,s=void 0,w=0,L=0,T=0,P=r.geometry.faces,K=p.faces;z=0;for(s=K.length;z<s;z++){fi=K[z];face=P[fi];if(face instanceof THREE.Face3){w+=3;L+=1;T+=3}else if(face instanceof THREE.Face4){w+=4;L+=2;T+=4}}p.__vertexArray=new Float32Array(w*3);p.__normalArray=new Float32Array(w*3);p.__tangentArray=new Float32Array(w*4);p.__colorArray=new Float32Array(w*3);p.__uvArray=new Float32Array(w*2);p.__uv2Array=new Float32Array(w*2);p.__skinVertexAArray=new Float32Array(w*4);p.__skinVertexBArray=
|
|
|
+new Float32Array(w*4);p.__skinIndexArray=new Float32Array(w*4);p.__skinWeightArray=new Float32Array(w*4);p.__faceArray=new Uint16Array(L*3);p.__lineArray=new Uint16Array(T*2);s=z=p;w=void 0;P=void 0;var M=void 0,J=void 0;M=void 0;K=!1;w=0;for(P=r.materials.length;w<P;w++){M=r.materials[w];if(M instanceof THREE.MeshFaceMaterial){M=0;for(J=s.materials.length;M<J;M++)if(s.materials[M]&&s.materials[M].shading!=undefined&&s.materials[M].shading==THREE.SmoothShading){K=!0;break}}else if(M&&M.shading!=undefined&&
|
|
|
+M.shading==THREE.SmoothShading){K=!0;break}if(K)break}z.__needsSmoothNormals=K;p.__webGLFaceCount=L*3;p.__webGLLineCount=T*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}I(n.__webglObjects,v,l)}}else if(l instanceof THREE.Ribbon){i=l.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;v=g.vertices.length;g.__vertexArray=new Float32Array(v*3);g.__colorArray=
|
|
|
+new Float32Array(v*3);g.__webGLVertexCount=v;i.__dirtyVertices=!0;i.__dirtyColors=!0}I(n.__webglObjects,i,l)}else if(l instanceof THREE.Line){i=l.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;v=g.vertices.length;g.__vertexArray=new Float32Array(v*3);g.__colorArray=new Float32Array(v*3);g.__webGLLineCount=v;i.__dirtyVertices=!0;i.__dirtyColors=!0}I(n.__webglObjects,i,l)}else if(l instanceof THREE.ParticleSystem){i=l.geometry;
|
|
|
+if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;v=g.vertices.length;g.__vertexArray=new Float32Array(v*3);g.__colorArray=new Float32Array(v*3);g.__sortArray=[];g.__webGLParticleCount=v;i.__dirtyVertices=!0;i.__dirtyColors=!0}I(n.__webglObjects,i,l)}else THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,
|
|
|
+1)}for(;f.__objectsRemoved.length;){l=f.__objectsRemoved[0];n=f;i=void 0;g=void 0;for(i=n.__webglObjects.length-1;i>=0;i--){g=n.__webglObjects[i].object;l==g&&n.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}l=0;for(n=f.__webglObjects.length;l<n;l++){g=f.__webglObjects[l].object;v=void 0;i=void 0;p=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(v in i.geometryGroups){p=i.geometryGroups[v];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){L=
|
|
|
+c.DYNAMIC_DRAW;T=void 0;z=void 0;var na=void 0,u=void 0,ia=void 0,ha=void 0,ka=void 0;na=void 0;var A=void 0,D=void 0,E=void 0,S=void 0;A=void 0;D=void 0;E=void 0;u=void 0;A=void 0;D=void 0;E=void 0;S=void 0;A=void 0;D=void 0;E=void 0;S=void 0;A=void 0;D=void 0;E=void 0;S=void 0;A=void 0;D=void 0;E=void 0;S=void 0;A=void 0;D=void 0;E=void 0;S=void 0;u=void 0;ha=void 0;ia=void 0;ka=void 0;var oa=J=M=K=P=w=r=s=0,ba=0,q=0,da=p.__vertexArray,Da=p.__uvArray,Ea=p.__uv2Array,sa=p.__normalArray,U=p.__tangentArray,
|
|
|
+ea=p.__colorArray,V=p.__skinVertexAArray,W=p.__skinVertexBArray,X=p.__skinIndexArray,Y=p.__skinWeightArray,ua=p.__faceArray,pa=p.__lineArray,Na=p.__needsSmoothNormals,ja=g.geometry,Ga=ja.__dirtyVertices,Ha=ja.__dirtyElements,Ba=ja.__dirtyUvs,Ia=ja.__dirtyNormals,Ja=ja.__dirtyTangents,Ka=ja.__dirtyColors,ra=ja.vertices,Oa=p.faces,Pa=ja.faces,Qa=ja.uvs,Ra=ja.uvs2,va=ja.colors,ya=ja.skinVerticesA,za=ja.skinVerticesB,Aa=ja.skinIndices,wa=ja.skinWeights;T=0;for(z=Oa.length;T<z;T++){na=Oa[T];u=Pa[na];ka=
|
|
|
+Qa[na];na=Ra[na];ia=u.vertexNormals;ha=u.normal;if(u instanceof THREE.Face3){if(Ga){A=ra[u.a].position;D=ra[u.b].position;E=ra[u.c].position;da[r]=A.x;da[r+1]=A.y;da[r+2]=A.z;da[r+3]=D.x;da[r+4]=D.y;da[r+5]=D.z;da[r+6]=E.x;da[r+7]=E.y;da[r+8]=E.z;r+=9}if(wa.length){A=wa[u.a];D=wa[u.b];E=wa[u.c];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=D.x;Y[q+5]=D.y;Y[q+6]=D.z;Y[q+7]=D.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;A=Aa[u.a];D=Aa[u.b];E=Aa[u.c];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+
|
|
|
+4]=D.x;X[q+5]=D.y;X[q+6]=D.z;X[q+7]=D.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;A=ya[u.a];D=ya[u.b];E=ya[u.c];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=D.x;V[q+5]=D.y;V[q+6]=D.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;A=za[u.a];D=za[u.b];E=za[u.c];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=D.x;W[q+5]=D.y;W[q+6]=D.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;q+=12}if(Ka&&va.length){A=va[u.a];D=va[u.b];E=va[u.c];ea[ba]=A.r;ea[ba+1]=A.g;ea[ba+2]=A.b;ea[ba+3]=D.r;
|
|
|
+ea[ba+4]=D.g;ea[ba+5]=D.b;ea[ba+6]=E.r;ea[ba+7]=E.g;ea[ba+8]=E.b;ba+=9}if(Ja&&ja.hasTangents){A=ra[u.a].tangent;D=ra[u.b].tangent;E=ra[u.c].tangent;U[J]=A.x;U[J+1]=A.y;U[J+2]=A.z;U[J+3]=A.w;U[J+4]=D.x;U[J+5]=D.y;U[J+6]=D.z;U[J+7]=D.w;U[J+8]=E.x;U[J+9]=E.y;U[J+10]=E.z;U[J+11]=E.w;J+=12}if(Ia)if(ia.length==3&&Na)for(u=0;u<3;u++){ha=ia[u];sa[M]=ha.x;sa[M+1]=ha.y;sa[M+2]=ha.z;M+=3}else for(u=0;u<3;u++){sa[M]=ha.x;sa[M+1]=ha.y;sa[M+2]=ha.z;M+=3}if(Ba&&ka)for(u=0;u<3;u++){ia=ka[u];Da[w]=ia.u;Da[w+1]=ia.v;
|
|
|
+w+=2}if(Ba&&na)for(u=0;u<3;u++){ka=na[u];Ea[P]=ka.u;Ea[P+1]=ka.v;P+=2}if(Ha){ua[K]=s;ua[K+1]=s+1;ua[K+2]=s+2;K+=3;pa[oa]=s;pa[oa+1]=s+1;pa[oa+2]=s;pa[oa+3]=s+2;pa[oa+4]=s+1;pa[oa+5]=s+2;oa+=6;s+=3}}else if(u instanceof THREE.Face4){if(Ga){A=ra[u.a].position;D=ra[u.b].position;E=ra[u.c].position;S=ra[u.d].position;da[r]=A.x;da[r+1]=A.y;da[r+2]=A.z;da[r+3]=D.x;da[r+4]=D.y;da[r+5]=D.z;da[r+6]=E.x;da[r+7]=E.y;da[r+8]=E.z;da[r+9]=S.x;da[r+10]=S.y;da[r+11]=S.z;r+=12}if(wa.length){A=wa[u.a];D=wa[u.b];E=
|
|
|
+wa[u.c];S=wa[u.d];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=D.x;Y[q+5]=D.y;Y[q+6]=D.z;Y[q+7]=D.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;Y[q+12]=S.x;Y[q+13]=S.y;Y[q+14]=S.z;Y[q+15]=S.w;A=Aa[u.a];D=Aa[u.b];E=Aa[u.c];S=Aa[u.d];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=D.x;X[q+5]=D.y;X[q+6]=D.z;X[q+7]=D.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;X[q+12]=S.x;X[q+13]=S.y;X[q+14]=S.z;X[q+15]=S.w;A=ya[u.a];D=ya[u.b];E=ya[u.c];S=ya[u.d];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+
|
|
|
+4]=D.x;V[q+5]=D.y;V[q+6]=D.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;V[q+12]=S.x;V[q+13]=S.y;V[q+14]=S.z;V[q+15]=1;A=za[u.a];D=za[u.b];E=za[u.c];S=za[u.d];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=D.x;W[q+5]=D.y;W[q+6]=D.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;W[q+12]=S.x;W[q+13]=S.y;W[q+14]=S.z;W[q+15]=1;q+=16}if(Ka&&va.length){A=va[u.a];D=va[u.b];E=va[u.c];S=va[u.d];ea[ba]=A.r;ea[ba+1]=A.g;ea[ba+2]=A.b;ea[ba+3]=D.r;ea[ba+4]=D.g;ea[ba+5]=D.b;ea[ba+6]=E.r;ea[ba+7]=
|
|
|
+E.g;ea[ba+8]=E.b;ea[ba+9]=S.r;ea[ba+10]=S.g;ea[ba+11]=S.b;ba+=12}if(Ja&&ja.hasTangents){A=ra[u.a].tangent;D=ra[u.b].tangent;E=ra[u.c].tangent;u=ra[u.d].tangent;U[J]=A.x;U[J+1]=A.y;U[J+2]=A.z;U[J+3]=A.w;U[J+4]=D.x;U[J+5]=D.y;U[J+6]=D.z;U[J+7]=D.w;U[J+8]=E.x;U[J+9]=E.y;U[J+10]=E.z;U[J+11]=E.w;U[J+12]=u.x;U[J+13]=u.y;U[J+14]=u.z;U[J+15]=u.w;J+=16}if(Ia)if(ia.length==4&&Na)for(u=0;u<4;u++){ha=ia[u];sa[M]=ha.x;sa[M+1]=ha.y;sa[M+2]=ha.z;M+=3}else for(u=0;u<4;u++){sa[M]=ha.x;sa[M+1]=ha.y;sa[M+2]=ha.z;M+=
|
|
|
+3}if(Ba&&ka)for(u=0;u<4;u++){ia=ka[u];Da[w]=ia.u;Da[w+1]=ia.v;w+=2}if(Ba&&na)for(u=0;u<4;u++){ka=na[u];Ea[P]=ka.u;Ea[P+1]=ka.v;P+=2}if(Ha){ua[K]=s;ua[K+1]=s+1;ua[K+2]=s+2;ua[K+3]=s;ua[K+4]=s+2;ua[K+5]=s+3;K+=6;pa[oa]=s;pa[oa+1]=s+1;pa[oa+2]=s;pa[oa+3]=s+3;pa[oa+4]=s+1;pa[oa+5]=s+2;pa[oa+6]=s+2;pa[oa+7]=s+3;oa+=8;s+=4}}}if(Ga){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,da,L)}if(Ka&&va.length){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,
|
|
|
+ea,L)}if(Ia){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,sa,L)}if(Ja&&ja.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,U,L)}if(Ba&&w>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Da,L)}if(Ba&&P>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ea,L)}if(Ha){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ua,L);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
+p.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,pa,L)}if(q>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,V,L);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,W,L);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,X,L);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,Y,L)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=
|
|
|
+!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Ribbon){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;v=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;p=void 0;w=g.vertices;L=g.colors;P=w.length;T=L.length;K=g.__vertexArray;z=g.__colorArray;M=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<P;s++){r=w[s].position;p=s*3;K[p]=r.x;K[p+1]=r.y;K[p+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,K,v)}if(M){for(s=0;s<T;s++){color=L[s];p=s*3;
|
|
|
+z[p]=color.r;z[p+1]=color.g;z[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,v)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Line){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;v=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;p=void 0;w=g.vertices;L=g.colors;P=w.length;T=L.length;K=g.__vertexArray;z=g.__colorArray;M=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<P;s++){r=w[s].position;p=s*3;K[p]=r.x;K[p+1]=r.y;K[p+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,K,v)}if(M){for(s=0;s<T;s++){color=L[s];p=s*3;z[p]=color.r;z[p+1]=color.g;z[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,v)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){i=g.geometry;(i.__dirtyVertices||i.__dirtyColors||g.sortParticles)&&b(i,c.DYNAMIC_DRAW,g);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(f,l){if(f){!l||l=="ccw"?c.frontFace(c.CCW):
|
|
|
+c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.Snippets={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 int combine;\n#endif",
|
|
|
+envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\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",
|
|
|
+map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
|
+lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|