|
@@ -1,7 +1,7 @@
|
|
|
// ThreeWebGL.js r38 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
|
|
|
-THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,k,m,o,r;if(e==0)h=g=k=0;else{m=Math.floor(b*6);o=b*6-m;b=e*(1-d);r=e*(1-d*o);d=e*(1-d*(1-o));switch(m){case 1:h=r;g=e;k=b;break;case 2:h=b;g=e;k=d;break;case 3:h=b;g=r;k=e;break;case 4:h=d;g=b;k=e;break;case 5:h=e;g=b;
|
|
|
-k=r;break;case 6:case 0:h=e;g=d;k=b}}this.r=h;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&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*
|
|
|
+THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,k,j,o,p;if(e==0)h=g=k=0;else{j=Math.floor(b*6);o=b*6-j;b=e*(1-d);p=e*(1-d*o);d=e*(1-d*(1-o));switch(j){case 1:h=p;g=e;k=b;break;case 2:h=b;g=e;k=d;break;case 3:h=b;g=p;k=e;break;case 4:h=d;g=b;k=e;break;case 5:h=e;g=b;
|
|
|
+k=p;break;case 6:case 0:h=e;g=d;k=b}}this.r=h;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&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(b,d){this.set(b||0,d||0)};
|
|
|
THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
|
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
|
|
@@ -12,72 +12,73 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
|
|
|
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(b,d,e,h){this.set(b||0,d||0,e||0,h||1)};
|
|
|
THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
|
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(k,m){return k.distance-m.distance});return g},intersectObject:function(b){function d(Y,O,ca,ma){ma=ma.clone().subSelf(O);ca=ca.clone().subSelf(O);var wa=Y.clone().subSelf(O);Y=ma.dot(ma);O=ma.dot(ca);ma=ma.dot(wa);var $=ca.dot(ca);ca=ca.dot(wa);wa=1/(Y*$-O*O);$=($*ma-O*ca)*wa;Y=(Y*ca-O*ma)*wa;return $>0&&Y>0&&$+Y<
|
|
|
-1}var e,h,g,k,m,o,r,x,E,F,I,G=b.geometry,L=G.vertices,M=[];e=0;for(h=G.faces.length;e<h;e++){g=G.faces[e];F=this.origin.clone();I=this.direction.clone();r=b.matrixWorld;k=r.multiplyVector3(L[g.a].position.clone());m=r.multiplyVector3(L[g.b].position.clone());o=r.multiplyVector3(L[g.c].position.clone());r=g instanceof THREE.Face4?r.multiplyVector3(L[g.d].position.clone()):null;x=b.matrixRotationWorld.multiplyVector3(g.normal.clone());E=I.dot(x);if(b.doubleSided||(b.flipSided?E>0:E<0)){x=x.dot((new THREE.Vector3).sub(k,
|
|
|
-F))/E;F=F.addSelf(I.multiplyScalar(x));if(g instanceof THREE.Face3){if(d(F,k,m,o)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(F,k,m,r)||d(F,m,o,r))){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}}return M}};
|
|
|
-THREE.Rectangle=function(){function b(){k=h-d;m=g-e}var d,e,h,g,k,m,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(r,x,E,F){o=!1;d=r;e=x;h=E;g=F;b()};this.addPoint=function(r,x){if(o){o=!1;d=r;e=x;h=r;g=x}else{d=d<r?d:r;e=e<x?e:x;h=h>r?h:r;g=g>x?g:x}b()};
|
|
|
-this.add3Points=function(r,x,E,F,I,G){if(o){o=!1;d=r<E?r<I?r:I:E<I?E:I;e=x<F?x<G?x:G:F<G?F:G;h=r>E?r>I?r:I:E>I?E:I;g=x>F?x>G?x:G:F>G?F:G}else{d=r<E?r<I?r<d?r:d:I<d?I:d:E<I?E<d?E:d:I<d?I:d;e=x<F?x<G?x<e?x:e:G<e?G:e:F<G?F<e?F:e:G<e?G:e;h=r>E?r>I?r>h?r:h:I>h?I:h:E>I?E>h?E:h:I>h?I:h;g=x>F?x>G?x>g?x:g:G>g?G:g:F>G?F>g?F:g:G>g?G:g}b()};this.addRectangle=function(r){if(o){o=!1;d=r.getLeft();e=r.getTop();h=r.getRight();g=r.getBottom()}else{d=d<r.getLeft()?d:r.getLeft();e=e<r.getTop()?e:r.getTop();h=h>r.getRight()?
|
|
|
-h:r.getRight();g=g>r.getBottom()?g:r.getBottom()}b()};this.inflate=function(r){d-=r;e-=r;h+=r;g+=r;b()};this.minSelf=function(r){d=d>r.getLeft()?d:r.getLeft();e=e>r.getTop()?e:r.getTop();h=h<r.getRight()?h:r.getRight();g=g<r.getBottom()?g:r.getBottom();b()};this.instersects=function(r){return Math.min(h,r.getRight())-Math.max(d,r.getLeft())>=0&&Math.min(g,r.getBottom())-Math.max(e,r.getTop())>=0};this.empty=function(){o=!0;g=h=e=d=0;b()};this.isEmpty=function(){return o}};
|
|
|
+THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(k,j){return k.distance-j.distance});return g},intersectObject:function(b){function d(Y,O,ca,ma){ma=ma.clone().subSelf(O);ca=ca.clone().subSelf(O);var wa=Y.clone().subSelf(O);Y=ma.dot(ma);O=ma.dot(ca);ma=ma.dot(wa);var $=ca.dot(ca);ca=ca.dot(wa);wa=1/(Y*$-O*O);$=($*ma-O*ca)*wa;Y=(Y*ca-O*ma)*wa;return $>0&&Y>0&&$+Y<
|
|
|
+1}var e,h,g,k,j,o,p,u,D,F,I,G=b.geometry,L=G.vertices,M=[];e=0;for(h=G.faces.length;e<h;e++){g=G.faces[e];F=this.origin.clone();I=this.direction.clone();p=b.matrixWorld;k=p.multiplyVector3(L[g.a].position.clone());j=p.multiplyVector3(L[g.b].position.clone());o=p.multiplyVector3(L[g.c].position.clone());p=g instanceof THREE.Face4?p.multiplyVector3(L[g.d].position.clone()):null;u=b.matrixRotationWorld.multiplyVector3(g.normal.clone());D=I.dot(u);if(b.doubleSided||(b.flipSided?D>0:D<0)){u=u.dot((new THREE.Vector3).sub(k,
|
|
|
+F))/D;F=F.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(d(F,k,j,o)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(F,k,j,p)||d(F,j,o,p))){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}}return M}};
|
|
|
+THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,u,D,F){o=!1;d=p;e=u;h=D;g=F;b()};this.addPoint=function(p,u){if(o){o=!1;d=p;e=u;h=p;g=u}else{d=d<p?d:p;e=e<u?e:u;h=h>p?h:p;g=g>u?g:u}b()};
|
|
|
+this.add3Points=function(p,u,D,F,I,G){if(o){o=!1;d=p<D?p<I?p:I:D<I?D:I;e=u<F?u<G?u:G:F<G?F:G;h=p>D?p>I?p:I:D>I?D:I;g=u>F?u>G?u:G:F>G?F:G}else{d=p<D?p<I?p<d?p:d:I<d?I:d:D<I?D<d?D:d:I<d?I:d;e=u<F?u<G?u<e?u:e:G<e?G:e:F<G?F<e?F:e:G<e?G:e;h=p>D?p>I?p>h?p:h:I>h?I:h:D>I?D>h?D:h:I>h?I:h;g=u>F?u>G?u>g?u:g:G>g?G:g:F>G?F>g?F:g:G>g?G:g}b()};this.addRectangle=function(p){if(o){o=!1;d=p.getLeft();e=p.getTop();h=p.getRight();g=p.getBottom()}else{d=d<p.getLeft()?d:p.getLeft();e=e<p.getTop()?e:p.getTop();h=h>p.getRight()?
|
|
|
+h:p.getRight();g=g>p.getBottom()?g:p.getBottom()}b()};this.inflate=function(p){d-=p;e-=p;h+=p;g+=p;b()};this.minSelf=function(p){d=d>p.getLeft()?d:p.getLeft();e=e>p.getTop()?e:p.getTop();h=h<p.getRight()?h:p.getRight();g=g<p.getBottom()?g:p.getBottom();b()};this.instersects=function(p){return Math.min(h,p.getRight())-Math.max(d,p.getLeft())>=0&&Math.min(g,p.getBottom())-Math.max(e,p.getTop())>=0};this.empty=function(){o=!0;g=h=e=d=0;b()};this.isEmpty=function(){return o}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
|
|
|
-THREE.Matrix4=function(b,d,e,h,g,k,m,o,r,x,E,F,I,G,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,m||0,o||0,r||0,x||0,E||1,F||0,I||0,G||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,m,o,r,x,E,F,I,G,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=m;this.n24=o;this.n31=r;this.n32=x;this.n33=E;this.n34=F;this.n41=I;this.n42=G;this.n43=L;this.n44=M;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
|
|
|
+THREE.Matrix4=function(b,d,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,j||0,o||0,p||0,u||0,D||1,F||0,I||0,G||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=o;this.n31=p;this.n32=u;this.n33=D;this.n34=F;this.n41=I;this.n42=G;this.n43=L;this.n44=M;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
|
|
|
g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
|
|
|
h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*this.n33;b.normalize();
|
|
|
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,m=b.n21,o=b.n22,r=b.n23,x=b.n24,E=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22,
|
|
|
-ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+k;this.n21=m*ca+o*J+r*c;this.n22=m*ma+o*xa+r*U;this.n23=m*wa+o*ta+r*V;this.n24=m*$+o*ea+r*na+x;this.n31=E*ca+F*J+I*c;this.n32=E*ma+F*xa+I*U;this.n33=E*wa+F*ta+I*V;this.n34=E*$+F*ea+I*na+G;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
|
|
|
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22,
|
|
|
+ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+k;this.n21=j*ca+o*J+p*c;this.n22=j*ma+o*xa+p*U;this.n23=j*wa+o*ta+p*V;this.n24=j*$+o*ea+p*na+u;this.n31=D*ca+F*J+I*c;this.n32=D*ma+F*xa+I*U;this.n33=D*wa+F*ta+I*V;this.n34=D*$+F*ea+I*na+G;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
|
|
|
e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
|
|
|
-b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,k=this.n22,m=this.n23,o=this.n24,r=this.n31,x=this.n32,E=this.n33,F=this.n34,I=this.n41,G=this.n42,L=this.n43,M=this.n44;return h*m*x*I-e*o*x*I-h*k*E*I+d*o*E*I+e*k*F*I-d*m*F*I-h*m*r*G+e*o*r*G+h*g*E*G-b*o*E*G-e*g*F*G+b*m*F*G+h*k*r*L-d*o*r*L-h*g*x*L+b*o*x*L+d*g*F*L-b*k*F*L-e*k*r*M+d*m*r*M+e*g*x*M-b*m*x*M-d*g*E*M+b*k*E*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
|
+b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,k=this.n22,j=this.n23,o=this.n24,p=this.n31,u=this.n32,D=this.n33,F=this.n34,I=this.n41,G=this.n42,L=this.n43,M=this.n44;return h*j*u*I-e*o*u*I-h*k*D*I+d*o*D*I+e*k*F*I-d*j*F*I-h*j*p*G+e*o*p*G+h*g*D*G-b*o*D*G-e*g*F*G+b*j*F*G+h*k*p*L-d*o*p*L-h*g*u*L+b*o*u*L+d*g*F*L-b*k*F*L-e*k*p*M+d*j*p*M+e*g*u*M-b*j*u*M-d*g*D*M+b*k*D*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
|
this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
|
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
|
|
|
b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,
|
|
|
0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),h=Math.sin(d),g=
|
|
|
-1-e,k=b.x,m=b.y,o=b.z,r=g*k,x=g*m;this.set(r*k+e,r*m-h*o,r*o+h*m,0,r*m+h*o,x*m+e,x*o-h*k,0,r*o-h*m,x*o+h*k,g*o*o+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var m=b*e,o=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=o*k+b*h;this.n22=-o*h+b*k;this.n23=-d*g;this.n31=-m*k+d*h;this.n32=m*h+d*k;this.n33=
|
|
|
-b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,m=e+e,o=h+h;b=d*k;var r=d*m;d*=o;var x=e*m;e*=o;h*=o;k*=g;m*=g;g*=o;this.n11=1-(x+h);this.n12=r-g;this.n13=d+m;this.n21=r+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-m;this.n32=e+k;this.n33=1-(b+x);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
|
+1-e,k=b.x,j=b.y,o=b.z,p=g*k,u=g*j;this.set(p*k+e,p*j-h*o,p*o+h*j,0,p*j+h*o,u*j+e,u*o-h*k,0,p*o-h*j,u*o+h*k,g*o*o+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=o*k+b*h;this.n22=-o*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33=
|
|
|
+b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,o=h+h;b=d*k;var p=d*j;d*=o;var u=e*j;e*=o;h*=o;k*=g;j*=g;g*=o;this.n11=1-(u+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;this.n33=1-(b+u);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
|
b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,m=b.n21,o=b.n22,r=b.n23,x=b.n24,E=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=r*G*M-x*I*M+x*F*Y-o*G*Y-r*F*O+o*I*O;d.n12=k*I*M-g*G*M-k*F*Y+h*G*Y+g*F*O-h*I*O;d.n13=g*x*M-k*r*M+k*o*Y-h*x*Y-g*o*O+h*r*O;d.n14=k*r*F-g*x*F-k*o*I+h*x*I+g*o*G-h*r*G;d.n21=x*I*L-r*G*L-x*E*Y+m*G*Y+r*E*O-m*I*O;d.n22=g*G*L-k*I*L+k*E*Y-e*G*Y-g*E*O+e*I*O;d.n23=k*r*L-g*x*L-k*m*Y+e*x*Y+g*m*O-e*r*O;
|
|
|
-d.n24=g*x*E-k*r*E+k*m*I-e*x*I-g*m*G+e*r*G;d.n31=o*G*L-x*F*L+x*E*M-m*G*M-o*E*O+m*F*O;d.n32=k*F*L-h*G*L-k*E*M+e*G*M+h*E*O-e*F*O;d.n33=g*x*L-k*o*L+k*m*M-e*x*M-h*m*O+e*o*O;d.n34=k*o*E-h*x*E-k*m*F+e*x*F+h*m*G-e*o*G;d.n41=r*F*L-o*I*L-r*E*M+m*I*M+o*E*Y-m*F*Y;d.n42=h*I*L-g*F*L+g*E*M-e*I*M-h*E*Y+e*F*Y;d.n43=g*o*L-h*r*L-g*m*M+e*r*M+h*m*Y-e*o*Y;d.n44=h*r*E-g*o*E+g*m*F-e*r*F-h*m*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,x=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*m+b.n31*x;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*m;e[4]=b*o;e[5]=b*r;e[6]=b*x;e[7]=b*E;e[8]=b*F;return d};
|
|
|
-THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var m;m=new THREE.Matrix4;m.n11=2*g/(d-b);m.n12=0;m.n13=(d+b)/(d-b);m.n14=0;m.n21=0;m.n22=2*g/(h-e);m.n23=(h+e)/(h-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+g)/(k-g);m.n34=-2*k*g/(k-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var m,o,r,x;m=new THREE.Matrix4;o=d-b;r=e-h;x=k-g;m.n11=2/o;m.n12=0;m.n13=0;m.n14=-((d+b)/o);m.n21=0;m.n22=2/r;m.n23=0;m.n24=-((e+h)/r);m.n31=0;m.n32=0;m.n33=-2/x;m.n34=-((k+g)/x);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*G*M-u*I*M+u*F*Y-o*G*Y-p*F*O+o*I*O;d.n12=k*I*M-g*G*M-k*F*Y+h*G*Y+g*F*O-h*I*O;d.n13=g*u*M-k*p*M+k*o*Y-h*u*Y-g*o*O+h*p*O;d.n14=k*p*F-g*u*F-k*o*I+h*u*I+g*o*G-h*p*G;d.n21=u*I*L-p*G*L-u*D*Y+j*G*Y+p*D*O-j*I*O;d.n22=g*G*L-k*I*L+k*D*Y-e*G*Y-g*D*O+e*I*O;d.n23=k*p*L-g*u*L-k*j*Y+e*u*Y+g*j*O-e*p*O;
|
|
|
+d.n24=g*u*D-k*p*D+k*j*I-e*u*I-g*j*G+e*p*G;d.n31=o*G*L-u*F*L+u*D*M-j*G*M-o*D*O+j*F*O;d.n32=k*F*L-h*G*L-k*D*M+e*G*M+h*D*O-e*F*O;d.n33=g*u*L-k*o*L+k*j*M-e*u*M-h*j*O+e*o*O;d.n34=k*o*D-h*u*D-k*j*F+e*u*F+h*j*G-e*o*G;d.n41=p*F*L-o*I*L-p*D*M+j*I*M+o*D*Y-j*F*Y;d.n42=h*I*L-g*F*L+g*D*M-e*I*M-h*D*Y+e*F*Y;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*Y-e*o*Y;d.n44=h*p*D-g*o*D+g*j*F-e*p*F-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,D=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*u;e[7]=b*D;e[8]=b*F;return d};
|
|
|
+THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
|
|
|
+THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,o,p,u;j=new THREE.Matrix4;o=d-b;p=e-h;u=k-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((k+g)/u);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
|
!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
|
|
|
undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,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))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var h=this.children.length;b<h;b++)this.children[b].update(this.matrixWorld,
|
|
|
d,e)}};THREE.Quaternion=function(b,d,e,h){this.set(b||0,d||0,e||0,h!==undefined?h:1)};
|
|
|
-THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var k=Math.cos(e);e=Math.sin(e);var m=b*d,o=h*g;this.w=m*k-o*e;this.x=m*e+o*k;this.y=h*d*k+b*g*e;this.z=b*g*k-h*d*e;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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,e=this.y,h=this.z,g=this.w,k=b.x,m=b.y,o=b.z;b=b.w;this.x=d*b+g*k+e*o-h*m;this.y=e*b+g*m+h*k-d*o;this.z=h*b+g*o+d*m-e*k;this.w=g*b-d*k-e*m-h*o;return this},
|
|
|
-multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,k=this.x,m=this.y,o=this.z,r=this.w,x=r*e+m*g-o*h,E=r*h+o*e-k*g,F=r*g+k*h-m*e;e=-k*e-m*h-o*g;d.x=x*r+e*-k+E*-o-F*-m;d.y=E*r+e*-m+F*-k-x*-o;d.z=F*r+e*-o+x*-m-E*-k;return d}};
|
|
|
-THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var k=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*k)/m;h=Math.sin(h*k)/m;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var k=Math.cos(e);e=Math.sin(e);var j=b*d,o=h*g;this.w=j*k-o*e;this.x=j*e+o*k;this.y=h*d*k+b*g*e;this.z=b*g*k-h*d*e;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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,e=this.y,h=this.z,g=this.w,k=b.x,j=b.y,o=b.z;b=b.w;this.x=d*b+g*k+e*o-h*j;this.y=e*b+g*j+h*k-d*o;this.z=h*b+g*o+d*j-e*k;this.w=g*b-d*k-e*j-h*o;return this},
|
|
|
+multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,k=this.x,j=this.y,o=this.z,p=this.w,u=p*e+j*g-o*h,D=p*h+o*e-k*g,F=p*g+k*h-j*e;e=-k*e-j*h-o*g;d.x=u*p+e*-k+D*-o-F*-j;d.y=D*p+e*-j+F*-k-u*-o;d.z=F*p+e*-o+u*-j-D*-k;return d}};
|
|
|
+THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var k=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*k)/j;h=Math.sin(h*k)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,d,e,h,g,k){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(b,d,e,h,g,k,m){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
-THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
+THREE.Face4=function(b,d,e,h,g,k,j){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
+THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
|
|
|
-e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,h,g,k,m,o=new THREE.Vector3,r=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){o.set(0,0,0);d=0;for(e=k.vertexNormals.length;d<e;d++)o.addSelf(k.vertexNormals[d]);o.divideScalar(3)}else{d=this.vertices[k.a];e=this.vertices[k.b];m=this.vertices[k.c];o.sub(m.position,e.position);r.sub(d.position,e.position);o.crossSelf(r)}o.isZero()||
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,h,g,k,j,o=new THREE.Vector3,p=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){o.set(0,0,0);d=0;for(e=k.vertexNormals.length;d<e;d++)o.addSelf(k.vertexNormals[d]);o.divideScalar(3)}else{d=this.vertices[k.a];e=this.vertices[k.b];j=this.vertices[k.c];o.sub(j.position,e.position);p.sub(d.position,e.position);o.crossSelf(p)}o.isZero()||
|
|
|
o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var b,d,e,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)h[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{h=
|
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)h[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal);h[e.d].addSelf(e.normal)}}b=0;for(d=this.vertices.length;b<d;b++)h[b].normalize();b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(h[e.a]);
|
|
|
-e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,pa,fa,qa,Z,ua,oa){o=aa.vertices[pa].position;r=aa.vertices[fa].position;x=aa.vertices[qa].position;E=m[Z];F=m[ua];I=m[oa];G=r.x-o.x;L=x.x-o.x;M=r.y-o.y;Y=x.y-o.y;O=r.z-o.z;ca=x.z-o.z;ma=F.u-E.u;wa=I.u-E.u;$=F.v-E.v;J=I.v-E.v;xa=1/(ma*
|
|
|
-J-wa*$);U.set((J*G-$*L)*xa,(J*M-$*Y)*xa,(J*O-$*ca)*xa);V.set((ma*L-wa*G)*xa,(ma*Y-wa*M)*xa,(ma*ca-wa*O)*xa);ea[pa].addSelf(U);ea[fa].addSelf(U);ea[qa].addSelf(U);c[pa].addSelf(V);c[fa].addSelf(V);c[qa].addSelf(V)}var d,e,h,g,k,m,o,r,x,E,F,I,G,L,M,Y,O,ca,ma,wa,$,J,xa,ta,ea=[],c=[],U=new THREE.Vector3,V=new THREE.Vector3,na=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
|
|
|
-e;d++){k=this.faces[d];m=this.faceVertexUvs[0][d];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){k=this.faces[d];for(h=0;h<k.vertexNormals.length;h++){Ga.copy(k.vertexNormals[h]);g=k[ya[h]];ta=ea[g];na.copy(ta);na.subSelf(Ga.multiplyScalar(Ga.dot(ta))).normalize();Fa.cross(k.vertexNormals[h],ta);g=Fa.dot(c[g]);g=g<0?-1:1;k.vertexTangents[h]=new THREE.Vector4(na.x,
|
|
|
+e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,pa,fa,qa,Z,ua,oa){o=aa.vertices[pa].position;p=aa.vertices[fa].position;u=aa.vertices[qa].position;D=j[Z];F=j[ua];I=j[oa];G=p.x-o.x;L=u.x-o.x;M=p.y-o.y;Y=u.y-o.y;O=p.z-o.z;ca=u.z-o.z;ma=F.u-D.u;wa=I.u-D.u;$=F.v-D.v;J=I.v-D.v;xa=1/(ma*
|
|
|
+J-wa*$);U.set((J*G-$*L)*xa,(J*M-$*Y)*xa,(J*O-$*ca)*xa);V.set((ma*L-wa*G)*xa,(ma*Y-wa*M)*xa,(ma*ca-wa*O)*xa);ea[pa].addSelf(U);ea[fa].addSelf(U);ea[qa].addSelf(U);c[pa].addSelf(V);c[fa].addSelf(V);c[qa].addSelf(V)}var d,e,h,g,k,j,o,p,u,D,F,I,G,L,M,Y,O,ca,ma,wa,$,J,xa,ta,ea=[],c=[],U=new THREE.Vector3,V=new THREE.Vector3,na=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
|
|
|
+e;d++){k=this.faces[d];j=this.faceVertexUvs[0][d];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){k=this.faces[d];for(h=0;h<k.vertexNormals.length;h++){Ga.copy(k.vertexNormals[h]);g=k[ya[h]];ta=ea[g];na.copy(ta);na.subSelf(Ga.multiplyScalar(Ga.dot(ta))).normalize();Fa.cross(k.vertexNormals[h],ta);g=Fa.dot(c[g]);g=g<0?-1:1;k.vertexTangents[h]=new THREE.Vector4(na.x,
|
|
|
na.y,na.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;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 d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
|
|
|
if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
|
|
|
-{radius:b}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var k=0;k<b.length;k++)b[k].update(g)};e.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};e.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};e.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var k=0;k<g.hierarchy.length;k++){for(var m=0;m<g.hierarchy[k].keys.length;m++){if(g.hierarchy[k].keys[m].time<
|
|
|
-0)g.hierarchy[k].keys[m].time=0;if(g.hierarchy[k].keys[m].rot!==undefined&&!(g.hierarchy[k].keys[m].rot instanceof THREE.Quaternion)){var o=g.hierarchy[k].keys[m].rot;g.hierarchy[k].keys[m].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(g.hierarchy[k].keys[0].morphTargets!==undefined){o={};for(m=0;m<g.hierarchy[k].keys.length;m++)for(var r=0;r<g.hierarchy[k].keys[m].morphTargets.length;r++){var x=g.hierarchy[k].keys[m].morphTargets[r];o[x]=-1}g.hierarchy[k].usedMorphTargets=o;for(m=0;m<g.hierarchy[k].keys.length;m++){var E=
|
|
|
-{};for(x in o){for(r=0;r<g.hierarchy[k].keys[m].morphTargets.length;r++)if(g.hierarchy[k].keys[m].morphTargets[r]===x){E[x]=g.hierarchy[k].keys[m].morphTargetsInfluences[r];break}r===g.hierarchy[k].keys[m].morphTargets.length&&(E[x]=0)}g.hierarchy[k].keys[m].morphTargetsInfluences=E}}for(m=1;m<g.hierarchy[k].keys.length;m++)if(g.hierarchy[k].keys[m].time===g.hierarchy[k].keys[m-1].time){g.hierarchy[k].keys.splice(m,1);m--}for(m=1;m<g.hierarchy[k].keys.length;m++)g.hierarchy[k].keys[m].index=m}m=parseInt(g.length*
|
|
|
-g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(k=0;k<g.hierarchy.length;k++)g.JIT.hierarchy.push(Array(m));g.initialized=!0}};e.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};e.parse=function(g){var k=[];if(g instanceof THREE.SkinnedMesh)for(var m=0;m<g.bones.length;m++)k.push(g.bones[m]);else h(g,k);return k};var h=function(g,k){k.push(g);for(var m=0;m<g.children.length;m++)h(g.children[m],k)};e.LINEAR=
|
|
|
+{radius:b}},computeEdgeFaces:function(){function b(p,u){return Math.min(p,u)+"_"+Math.max(p,u)}function d(p,u,D){if(p[u]===undefined){p[u]={set:{},array:[]};p[u].set[D]=1;p[u].array.push(D)}else if(p[u].set[D]===undefined){p[u].set[D]=1;p[u].array.push(D)}}var e,h,g,k,j,o={};e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.a,j.c);d(o,g,e)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(o,g,e);g=b(j.a,j.b);d(o,g,e);
|
|
|
+g=b(j.a,j.d);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.c,j.d);d(o,g,e)}}e=0;for(h=this.edges.length;e<h;e++){j=this.edges[e];g=j.vertexIndices[0];k=j.vertexIndices[1];j.faceIndices=o[b(g,k)].array;for(g=0;g<j.faceIndices.length;g++){k=j.faceIndices[g];j.faces.push(this.faces[k])}}}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var k=0;k<b.length;k++)b[k].update(g)};e.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};e.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};e.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var k=0;k<g.hierarchy.length;k++){for(var j=0;j<g.hierarchy[k].keys.length;j++){if(g.hierarchy[k].keys[j].time<
|
|
|
+0)g.hierarchy[k].keys[j].time=0;if(g.hierarchy[k].keys[j].rot!==undefined&&!(g.hierarchy[k].keys[j].rot instanceof THREE.Quaternion)){var o=g.hierarchy[k].keys[j].rot;g.hierarchy[k].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(g.hierarchy[k].keys[0].morphTargets!==undefined){o={};for(j=0;j<g.hierarchy[k].keys.length;j++)for(var p=0;p<g.hierarchy[k].keys[j].morphTargets.length;p++){var u=g.hierarchy[k].keys[j].morphTargets[p];o[u]=-1}g.hierarchy[k].usedMorphTargets=o;for(j=0;j<g.hierarchy[k].keys.length;j++){var D=
|
|
|
+{};for(u in o){for(p=0;p<g.hierarchy[k].keys[j].morphTargets.length;p++)if(g.hierarchy[k].keys[j].morphTargets[p]===u){D[u]=g.hierarchy[k].keys[j].morphTargetsInfluences[p];break}p===g.hierarchy[k].keys[j].morphTargets.length&&(D[u]=0)}g.hierarchy[k].keys[j].morphTargetsInfluences=D}}for(j=1;j<g.hierarchy[k].keys.length;j++)if(g.hierarchy[k].keys[j].time===g.hierarchy[k].keys[j-1].time){g.hierarchy[k].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[k].keys.length;j++)g.hierarchy[k].keys[j].index=j}j=parseInt(g.length*
|
|
|
+g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(k=0;k<g.hierarchy.length;k++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};e.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};e.parse=function(g){var k=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)k.push(g.bones[j]);else h(g,k);return k};var h=function(g,k){k.push(g);for(var j=0;j<g.children.length;j++)h(g.children[j],k)};e.LINEAR=
|
|
|
0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=2;return e}();THREE.Animation=function(b,d,e,h){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=e!==undefined?e:THREE.AnimationHandler.LINEAR;this.JITCompile=h!==undefined?h:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var e,h=this.hierarchy.length,g;for(e=0;e<h;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
|
|
|
g instanceof THREE.Bone?g.skinMatrix:g.matrix}var k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
|
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,k,m,o,r,x,E=this.data.JIT.hierarchy,F,I;this.currentTime+=b*this.timeScale;I=this.currentTime;F=this.currentTime%=this.data.length;x=parseInt(Math.min(F*this.data.fps,this.data.length*this.data.fps),10);for(var G=0,L=this.hierarchy.length;G<L;G++){b=this.hierarchy[G];r=b.animationCache;if(this.JITCompile&&E[G][x]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=E[G][x];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
-!1}else{b.matrix=E[G][x];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var M=0;M<3;M++){e=d[M];m=r.prevKey[e];o=r.nextKey[e];if(o.time<=I){if(F<I)if(this.loop){m=this.data.hierarchy[G].keys[0];for(o=this.getNextKeyWith(e,G,1);o.time<F;){m=o;o=this.getNextKeyWith(e,G,o.index+1)}}else{this.stop();return}else{do{m=o;o=this.getNextKeyWith(e,G,o.index+1)}while(o.time<
|
|
|
-F)}r.prevKey[e]=m;r.nextKey[e]=o}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(F-m.time)/(o.time-m.time);g=m[e];k=o[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+G);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",G,m.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",G,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e===
|
|
|
-"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&E[0][x]===undefined){this.hierarchy[0].update(undefined,!0);for(G=0;G<this.hierarchy.length;G++)E[G][x]=this.hierarchy[G]instanceof THREE.Bone?this.hierarchy[G].skinMatrix.clone():this.hierarchy[G].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,k,m,o,r,x;g=(b.length-1)*d;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];o=b[e[1]];r=b[e[2]];x=b[e[3]];e=g*g;m=g*e;h[0]=this.interpolate(k[0],o[0],r[0],x[0],g,e,m);h[1]=this.interpolate(k[1],o[1],r[1],x[1],g,e,m);h[2]=this.interpolate(k[2],o[2],r[2],x[2],g,e,m);return h};
|
|
|
-THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,m){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*m+(-3*(d-e)-2*b-h)*k+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e<h.length-1?e:h.length-1;else e%=h.length;for(;e<h.length;e++)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[0]};
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,k,j,o,p,u,D=this.data.JIT.hierarchy,F,I;this.currentTime+=b*this.timeScale;I=this.currentTime;F=this.currentTime%=this.data.length;u=parseInt(Math.min(F*this.data.fps,this.data.length*this.data.fps),10);for(var G=0,L=this.hierarchy.length;G<L;G++){b=this.hierarchy[G];p=b.animationCache;if(this.JITCompile&&D[G][u]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=D[G][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
+!1}else{b.matrix=D[G][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var M=0;M<3;M++){e=d[M];j=p.prevKey[e];o=p.nextKey[e];if(o.time<=I){if(F<I)if(this.loop){j=this.data.hierarchy[G].keys[0];for(o=this.getNextKeyWith(e,G,1);o.time<F;){j=o;o=this.getNextKeyWith(e,G,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(e,G,o.index+1)}while(o.time<
|
|
|
+F)}p.prevKey[e]=j;p.nextKey[e]=o}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(F-j.time)/(o.time-j.time);g=j[e];k=o[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+G);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",G,j.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",G,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e===
|
|
|
+"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&D[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(G=0;G<this.hierarchy.length;G++)D[G][u]=this.hierarchy[G]instanceof THREE.Bone?this.hierarchy[G].skinMatrix.clone():this.hierarchy[G].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,k,j,o,p,u;g=(b.length-1)*d;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];o=b[e[1]];p=b[e[2]];u=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(k[0],o[0],p[0],u[0],g,e,j);h[1]=this.interpolate(k[1],o[1],p[1],u[1],g,e,j);h[2]=this.interpolate(k[2],o[2],p[2],u[2],g,e,j);return h};
|
|
|
+THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*k+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e<h.length-1?e:h.length-1;else e%=h.length;for(;e<h.length;e++)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;for(e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+h.length;e>=0;e--)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[h.length-1]};
|
|
|
THREE.Camera=function(b,d,e,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
@@ -114,7 +115,7 @@ this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}}}};THREE.Mesh.
|
|
|
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Bone.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}}else for(h=0;h<g;h++)this.children[h].update(this.skinMatrix,
|
|
|
d,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
-THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,h,g,k,m,o;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];k=g.pos;m=g.rotq;o=g.scl;h=this.addBone();h.name=g.name;h.position.set(k[0],k[1],k[2]);h.quaternion.set(m[0],m[1],m[2],m[3]);h.useQuaternion=!0;o!==undefined?h.scale.set(o[0],o[1],o[2]):h.scale.set(1,1,1)}for(e=0;e<this.bones.length;e++){g=this.geometry.bones[e];
|
|
|
+THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,h,g,k,j,o;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];k=g.pos;j=g.rotq;o=g.scl;h=this.addBone();h.name=g.name;h.position.set(k[0],k[1],k[2]);h.quaternion.set(j[0],j[1],j[2],j[3]);h.useQuaternion=!0;o!==undefined?h.scale.set(o[0],o[1],o[2]):h.scale.set(1,1,1)}for(e=0;e<this.bones.length;e++){g=this.geometry.bones[e];
|
|
|
h=this.bones[e];g.parent===-1?this.addChild(h):this.bones[g.parent].addChild(h)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
THREE.SkinnedMesh.prototype.update=function(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e)}e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
|
|
|
d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
@@ -130,23 +131,23 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
|
|
|
THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var h=1;h<this.LODs.length;h++)if(b>=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible=
|
|
|
!1;this.LODs[h].object3D.visible=!0}else break;for(;h<this.LODs.length;h++)this.LODs[h].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
|
|
|
THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,m,o,r,x,E,F=["a","b","c","d"];for(r=0;r<k;r++){o=d.length;m=g[r];if(m instanceof THREE.Face4){x=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{x=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(m.normal);e.push(o);for(o=
|
|
|
-0;o<x;o++){E=b[m[F[o]]];d.push(new THREE.Vertex(E.position.clone()))}}for(k=0;k<g.length-1;k++){b=e[k];for(m=k+1;m<g.length;m++){o=e[m];o=this.facesShareEdge(d,b,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);h.push(o)}}}};
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,k,m,o,r,x,E,F,I,G,L,M,Y=0,O=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[O[L]];o=b[k];for(M=0;M<g;M++){m=e[O[M]];r=b[m];if(Math.abs(o.position.x-r.position.x)<1.0E-4&&Math.abs(o.position.y-r.position.y)<1.0E-4&&Math.abs(o.position.z-r.position.z)<1.0E-4){Y++;if(Y===1){x=o;E=r;F=k;I=m;G=O[L]}if(Y===2){G+=O[L];return G==="ad"||G==="ac"?{faces:[d,e],vertices:[x,E,r,o],indices:[F,
|
|
|
-I,m,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[x,o,r,E],indices:[F,k,m,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,j,o,p,u,D,F=["a","b","c","d"];for(p=0;p<k;p++){o=d.length;j=g[p];if(j instanceof THREE.Face4){u=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{u=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);e.push(o);for(o=
|
|
|
+0;o<u;o++){D=b[j[F[o]]];d.push(new THREE.Vertex(D.position.clone()))}}for(k=0;k<g.length-1;k++){b=e[k];for(j=k+1;j<g.length;j++){o=e[j];o=this.facesShareEdge(d,b,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);h.push(o)}}}};
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,k,j,o,p,u,D,F,I,G,L,M,Y=0,O=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[O[L]];o=b[k];for(M=0;M<g;M++){j=e[O[M]];p=b[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){Y++;if(Y===1){u=o;D=p;F=k;I=j;G=O[L]}if(Y===2){G+=O[L];return G==="ad"||G==="ac"?{faces:[d,e],vertices:[u,D,p,o],indices:[F,
|
|
|
+I,j,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[u,o,p,D],indices:[F,k,j,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
|
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(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var U=r[o]=r[o]||new THREE.RenderableVertex;o++;return U}function d(U,V){return V.z-U.z}function e(U,V){var na=0,Fa=1,Ga=U.z+U.w,ya=V.z+V.w,aa=-U.z+U.w,pa=-V.z+V.w;if(Ga>=0&&ya>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&pa<0)return!1;else{if(Ga<0)na=Math.max(na,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)na=Math.max(na,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(Fa<na)return!1;else{U.lerpSelf(V,na);V.lerpSelf(U,1-Fa);return!0}}}
|
|
|
-var h,g,k=[],m,o,r=[],x,E,F=[],I,G=[],L,M,Y=[],O,ca,ma=[],wa=new THREE.Vector4,$=new THREE.Vector4,J=new THREE.Matrix4,xa=new THREE.Matrix4,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(U,V){J.multiply(V.projectionMatrix,V.matrixWorldInverse);J.multiplyVector3(U);return U};this.unprojectVector=function(U,V){J.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
|
|
|
+THREE.Projector=function(){function b(){var U=p[o]=p[o]||new THREE.RenderableVertex;o++;return U}function d(U,V){return V.z-U.z}function e(U,V){var na=0,Fa=1,Ga=U.z+U.w,ya=V.z+V.w,aa=-U.z+U.w,pa=-V.z+V.w;if(Ga>=0&&ya>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&pa<0)return!1;else{if(Ga<0)na=Math.max(na,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)na=Math.max(na,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(Fa<na)return!1;else{U.lerpSelf(V,na);V.lerpSelf(U,1-Fa);return!0}}}
|
|
|
+var h,g,k=[],j,o,p=[],u,D,F=[],I,G=[],L,M,Y=[],O,ca,ma=[],wa=new THREE.Vector4,$=new THREE.Vector4,J=new THREE.Matrix4,xa=new THREE.Matrix4,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(U,V){J.multiply(V.projectionMatrix,V.matrixWorldInverse);J.multiplyVector3(U);return U};this.unprojectVector=function(U,V){J.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
|
|
|
J.multiplyVector3(U);return U};this.projectObjects=function(U,V,na){V=[];var Fa,Ga,ya;g=0;Ga=U.objects;U=0;for(Fa=Ga.length;U<Fa;U++){ya=Ga[U];var aa;if(!(aa=!ya.visible))if(aa=ya instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ya.matrixWorld,fa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),qa=0;qa<6;qa++){aa=ta[qa].x*pa.n14+ta[qa].y*pa.n24+ta[qa].z*pa.n34+ta[qa].w;if(aa<=fa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=k[g]=k[g]||new THREE.RenderableObject;g++;
|
|
|
-h=aa;wa.copy(ya.position);J.multiplyVector3(wa);h.object=ya;h.z=wa.z;V.push(h)}}na&&V.sort(d);return V};this.projectScene=function(U,V,na){var Fa=[],Ga=V.near,ya=V.far,aa,pa,fa,qa,Z,ua,oa,Ca,za,ga,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=E=0;V.matrixAutoUpdate&&V.updateMatrix();U.update(undefined,!1,V);J.multiply(V.projectionMatrix,V.matrixWorldInverse);ta[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);ta[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);ta[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+
|
|
|
+h=aa;wa.copy(ya.position);J.multiplyVector3(wa);h.object=ya;h.z=wa.z;V.push(h)}}na&&V.sort(d);return V};this.projectScene=function(U,V,na){var Fa=[],Ga=V.near,ya=V.far,aa,pa,fa,qa,Z,ua,oa,Ca,za,ga,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=D=0;V.matrixAutoUpdate&&V.updateMatrix();U.update(undefined,!1,V);J.multiply(V.projectionMatrix,V.matrixWorldInverse);ta[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);ta[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);ta[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+
|
|
|
J.n23,J.n44+J.n24);ta[3].set(J.n41-J.n21,J.n42-J.n22,J.n43-J.n23,J.n44-J.n24);ta[4].set(J.n41-J.n31,J.n42-J.n32,J.n43-J.n33,J.n44-J.n34);ta[5].set(J.n41+J.n31,J.n42+J.n32,J.n43+J.n33,J.n44+J.n34);for(aa=0;aa<6;aa++){za=ta[aa];za.divideScalar(Math.sqrt(za.x*za.x+za.y*za.y+za.z*za.z))}za=this.projectObjects(U,V,!0);U=0;for(aa=za.length;U<aa;U++){ga=za[U].object;if(ga.visible){Pa=ga.matrixWorld;Ua=ga.matrixRotationWorld;Va=ga.materials;hb=ga.overdraw;o=0;if(ga instanceof THREE.Mesh){Sa=ga.geometry;qa=
|
|
|
-Sa.vertices;fb=Sa.faces;Sa=Sa.faceVertexUvs;pa=0;for(fa=qa.length;pa<fa;pa++){m=b();m.positionWorld.copy(qa[pa].position);Pa.multiplyVector3(m.positionWorld);m.positionScreen.copy(m.positionWorld);J.multiplyVector4(m.positionScreen);m.positionScreen.x/=m.positionScreen.w;m.positionScreen.y/=m.positionScreen.w;m.visible=m.positionScreen.z>Ga&&m.positionScreen.z<ya}qa=0;for(pa=fb.length;qa<pa;qa++){fa=fb[qa];if(fa instanceof THREE.Face3){Z=r[fa.a];ua=r[fa.b];oa=r[fa.c];if(Z.visible&&ua.visible&&oa.visible&&
|
|
|
-(ga.doubleSided||ga.flipSided!=(oa.positionScreen.x-Z.positionScreen.x)*(ua.positionScreen.y-Z.positionScreen.y)-(oa.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0)){Ca=F[E]=F[E]||new THREE.RenderableFace3;E++;x=Ca;x.v1.copy(Z);x.v2.copy(ua);x.v3.copy(oa)}else continue}else if(fa instanceof THREE.Face4){Z=r[fa.a];ua=r[fa.b];oa=r[fa.c];Ca=r[fa.d];if(Z.visible&&ua.visible&&oa.visible&&Ca.visible&&(ga.doubleSided||ga.flipSided!=((Ca.positionScreen.x-Z.positionScreen.x)*
|
|
|
-(ua.positionScreen.y-Z.positionScreen.y)-(Ca.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0||(ua.positionScreen.x-oa.positionScreen.x)*(Ca.positionScreen.y-oa.positionScreen.y)-(ua.positionScreen.y-oa.positionScreen.y)*(Ca.positionScreen.x-oa.positionScreen.x)<0))){Ya=G[I]=G[I]||new THREE.RenderableFace4;I++;x=Ya;x.v1.copy(Z);x.v2.copy(ua);x.v3.copy(oa);x.v4.copy(Ca)}else continue}x.normalWorld.copy(fa.normal);Ua.multiplyVector3(x.normalWorld);x.centroidWorld.copy(fa.centroid);
|
|
|
-Pa.multiplyVector3(x.centroidWorld);x.centroidScreen.copy(x.centroidWorld);J.multiplyVector3(x.centroidScreen);oa=fa.vertexNormals;Z=0;for(ua=oa.length;Z<ua;Z++){Ca=x.vertexNormalsWorld[Z];Ca.copy(oa[Z]);Ua.multiplyVector3(Ca)}Z=0;for(ua=Sa.length;Z<ua;Z++)if(Ya=Sa[Z][qa]){oa=0;for(Ca=Ya.length;oa<Ca;oa++)x.uvs[Z][oa]=Ya[oa]}x.meshMaterials=Va;x.faceMaterials=fa.materials;x.overdraw=hb;x.z=x.centroidScreen.z;Fa.push(x)}}else if(ga instanceof THREE.Line){xa.multiply(J,Pa);qa=ga.geometry.vertices;Z=
|
|
|
-b();Z.positionScreen.copy(qa[0].position);xa.multiplyVector4(Z.positionScreen);pa=1;for(fa=qa.length;pa<fa;pa++){Z=b();Z.positionScreen.copy(qa[pa].position);xa.multiplyVector4(Z.positionScreen);ua=r[o-2];ea.copy(Z.positionScreen);c.copy(ua.positionScreen);if(e(ea,c)){ea.multiplyScalar(1/ea.w);c.multiplyScalar(1/c.w);Pa=Y[M]=Y[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(ea);L.v2.positionScreen.copy(c);L.z=Math.max(ea.z,c.z);L.materials=ga.materials;Fa.push(L)}}}else if(ga instanceof
|
|
|
+Sa.vertices;fb=Sa.faces;Sa=Sa.faceVertexUvs;pa=0;for(fa=qa.length;pa<fa;pa++){j=b();j.positionWorld.copy(qa[pa].position);Pa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);J.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ga&&j.positionScreen.z<ya}qa=0;for(pa=fb.length;qa<pa;qa++){fa=fb[qa];if(fa instanceof THREE.Face3){Z=p[fa.a];ua=p[fa.b];oa=p[fa.c];if(Z.visible&&ua.visible&&oa.visible&&
|
|
|
+(ga.doubleSided||ga.flipSided!=(oa.positionScreen.x-Z.positionScreen.x)*(ua.positionScreen.y-Z.positionScreen.y)-(oa.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0)){Ca=F[D]=F[D]||new THREE.RenderableFace3;D++;u=Ca;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa)}else continue}else if(fa instanceof THREE.Face4){Z=p[fa.a];ua=p[fa.b];oa=p[fa.c];Ca=p[fa.d];if(Z.visible&&ua.visible&&oa.visible&&Ca.visible&&(ga.doubleSided||ga.flipSided!=((Ca.positionScreen.x-Z.positionScreen.x)*
|
|
|
+(ua.positionScreen.y-Z.positionScreen.y)-(Ca.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0||(ua.positionScreen.x-oa.positionScreen.x)*(Ca.positionScreen.y-oa.positionScreen.y)-(ua.positionScreen.y-oa.positionScreen.y)*(Ca.positionScreen.x-oa.positionScreen.x)<0))){Ya=G[I]=G[I]||new THREE.RenderableFace4;I++;u=Ya;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa);u.v4.copy(Ca)}else continue}u.normalWorld.copy(fa.normal);Ua.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);
|
|
|
+Pa.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);J.multiplyVector3(u.centroidScreen);oa=fa.vertexNormals;Z=0;for(ua=oa.length;Z<ua;Z++){Ca=u.vertexNormalsWorld[Z];Ca.copy(oa[Z]);Ua.multiplyVector3(Ca)}Z=0;for(ua=Sa.length;Z<ua;Z++)if(Ya=Sa[Z][qa]){oa=0;for(Ca=Ya.length;oa<Ca;oa++)u.uvs[Z][oa]=Ya[oa]}u.meshMaterials=Va;u.faceMaterials=fa.materials;u.overdraw=hb;u.z=u.centroidScreen.z;Fa.push(u)}}else if(ga instanceof THREE.Line){xa.multiply(J,Pa);qa=ga.geometry.vertices;Z=
|
|
|
+b();Z.positionScreen.copy(qa[0].position);xa.multiplyVector4(Z.positionScreen);pa=1;for(fa=qa.length;pa<fa;pa++){Z=b();Z.positionScreen.copy(qa[pa].position);xa.multiplyVector4(Z.positionScreen);ua=p[o-2];ea.copy(Z.positionScreen);c.copy(ua.positionScreen);if(e(ea,c)){ea.multiplyScalar(1/ea.w);c.multiplyScalar(1/c.w);Pa=Y[M]=Y[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(ea);L.v2.positionScreen.copy(c);L.z=Math.max(ea.z,c.z);L.materials=ga.materials;Fa.push(L)}}}else if(ga instanceof
|
|
|
THREE.Particle){$.set(ga.position.x,ga.position.y,ga.position.z,1);J.multiplyVector4($);$.z/=$.w;if($.z>0&&$.z<1){Pa=ma[ca]=ma[ca]||new THREE.RenderableParticle;ca++;O=Pa;O.x=$.x/$.w;O.y=$.y/$.w;O.z=$.z;O.rotation=ga.rotation.z;O.scale.x=ga.scale.x*Math.abs(O.x-($.x+V.projectionMatrix.n11)/($.w+V.projectionMatrix.n14));O.scale.y=ga.scale.y*Math.abs(O.y-($.y+V.projectionMatrix.n22)/($.w+V.projectionMatrix.n24));O.materials=ga.materials;Fa.push(O)}}}}na&&Fa.sort(d);return Fa}};
|
|
|
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(b,d,e){e&&b.update(undefined,!1,d);e=b.sounds;var h,g=e.length;for(h=0;h<g;h++){b=e[h];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
@@ -175,65 +176,65 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
|
-THREE.WebGLRenderer=function(b){function d(f,s,n){var j,q,A,u=f.vertices,w=u.length,z=f.colors,t=z.length,v=f.__vertexArray,y=f.__colorArray,H=f.__sortArray,C=f.__dirtyVertices,N=f.__dirtyColors;if(n.sortParticles){ga.multiplySelf(n.matrixWorld);for(j=0;j<w;j++){q=u[j].position;Va.copy(q);ga.multiplyVector3(Va);H[j]=[Va.z,j]}H.sort(function(W,P){return P[0]-W[0]});for(j=0;j<w;j++){q=u[H[j][1]].position;A=j*3;v[A]=q.x;v[A+1]=q.y;v[A+2]=q.z}for(j=0;j<t;j++){A=j*3;color=z[H[j][1]];y[A]=color.r;y[A+1]=
|
|
|
-color.g;y[A+2]=color.b}}else{if(C)for(j=0;j<w;j++){q=u[j].position;A=j*3;v[A]=q.x;v[A+1]=q.y;v[A+2]=q.z}if(N)for(j=0;j<t;j++){color=z[j];A=j*3;y[A]=color.r;y[A+1]=color.g;y[A+2]=color.b}}if(C||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,s)}if(N||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}}function e(f,s,n,j,q){j.program||ya.initMaterial(j,s,n,q);var A=j.program,u=A.uniforms,w=j.uniforms;
|
|
|
-if(A!=na){c.useProgram(A);na=A}c.uniformMatrix4fv(u.projectionMatrix,!1,Pa);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial||j.fog)){w.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){w.fogNear.value=n.near;w.fogFar.value=n.far}else if(n instanceof THREE.FogExp2)w.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof
|
|
|
-THREE.MeshLambertMaterial||j.lights){var z,t,v=0,y=0,H=0,C,N,W,P,T=hb,Ha=T.directional.colors,R=T.directional.positions,Q=T.point.colors,S=T.point.positions,ra=T.point.distances,p=0,D=0;n=t=P=0;for(z=s.length;n<z;n++){t=s[n];C=t.color;N=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){v+=C.r;y+=C.g;H+=C.b}else if(t instanceof THREE.DirectionalLight){P=p*3;Ha[P]=C.r*W;Ha[P+1]=C.g*W;Ha[P+2]=C.b*W;R[P]=N.x;R[P+1]=N.y;R[P+2]=N.z;p+=1}else if(t instanceof THREE.PointLight){t=D*
|
|
|
-3;Q[t]=C.r*W;Q[t+1]=C.g*W;Q[t+2]=C.b*W;S[t]=N.x;S[t+1]=N.y;S[t+2]=N.z;ra[D]=P;D+=1}}for(n=p*3;n<Ha.length;n++)Ha[n]=0;for(n=D*3;n<Q.length;n++)Q[n]=0;T.point.length=D;T.directional.length=p;T.ambient[0]=v;T.ambient[1]=y;T.ambient[2]=H;n=hb;w.enableLighting.value=n.directional.length+n.point.length;w.ambientLightColor.value=n.ambient;w.directionalLightColor.value=n.directional.colors;w.directionalLightDirection.value=n.directional.positions;w.pointLightColor.value=n.point.colors;w.pointLightPosition.value=
|
|
|
-n.point.positions;w.pointLightDistance.value=n.point.distances}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){w.diffuse.value.setRGB(j.color.r,j.color.g,j.color.b);w.opacity.value=j.opacity;w.map.texture=j.map;w.lightMap.texture=j.lightMap;w.envMap.texture=j.envMap;w.reflectivity.value=j.reflectivity;w.refractionRatio.value=j.refractionRatio;w.combine.value=j.combine;w.useRefract.value=j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof
|
|
|
-THREE.LineBasicMaterial){w.diffuse.value.setRGB(j.color.r,j.color.g,j.color.b);w.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){w.psColor.value.setRGB(j.color.r,j.color.g,j.color.b);w.opacity.value=j.opacity;w.size.value=j.size;w.scale.value=U.height/2;w.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){w.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);w.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);w.shininess.value=j.shininess}else if(j instanceof
|
|
|
-THREE.MeshDepthMaterial){w.mNear.value=f.near;w.mFar.value=f.far;w.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)w.opacity.value=j.opacity;for(var i in w)if(y=A.uniforms[i]){z=w[i];v=z.type;n=z.value;if(v=="i")c.uniform1i(y,n);else if(v=="f")c.uniform1f(y,n);else if(v=="fv1")c.uniform1fv(y,n);else if(v=="fv")c.uniform3fv(y,n);else if(v=="v2")c.uniform2f(y,n.x,n.y);else if(v=="v3")c.uniform3f(y,n.x,n.y,n.z);else if(v=="v4")c.uniform4f(y,n.x,n.y,n.z,n.w);else if(v=="c")c.uniform3f(y,
|
|
|
-n.r,n.g,n.b);else if(v=="t"){c.uniform1i(y,n);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(v=0;v<6;++v)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,0,0,c.RGBA,c.UNSIGNED_BYTE,z.image[v])}else{z.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(v=0;v<6;++v)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-v,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,z.image[v]);z.__webglInit=!0}wa(c.TEXTURE_CUBE_MAP,z,z.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube)}}else $(z,n)}}c.uniformMatrix4fv(u.modelViewMatrix,!1,q._modelViewMatrixArray);c.uniformMatrix3fv(u.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.envMap)&&c.uniform3f(u.cameraPosition,
|
|
|
-f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&c.uniformMatrix4fv(u.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(u.viewMatrix,!1,Ua);if(j instanceof THREE.ShadowVolumeDynamicMaterial){f=w.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(u.directionalLightDirection,
|
|
|
-f);c.uniformMatrix4fv(u.objectMatrix,!1,q._objectMatrixArray);c.uniformMatrix4fv(u.viewMatrix,!1,Ua)}if(j.skinning){c.uniformMatrix4fv(u.cameraInverseMatrix,!1,Ua);c.uniformMatrix4fv(u.boneGlobalMatrices,!1,q.boneMatrices)}return A}function h(f,s,n,j,q,A){if(j.opacity!=0){var u;f=e(f,s,n,j,A).attributes;if(j.morphTargets){s=j.program.attributes;A.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[A.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(s.position,
|
|
|
-3,c.FLOAT,!1,0,0);if(A.morphTargetForcedOrder.length){n=0;for(var w=A.morphTargetForcedOrder,z=A.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<w.length;){c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w[n]]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=z[w[n]];n++}}else{w=[];var t=-1,v=0;z=A.morphTargetInfluences;var y,H=z.length;n=0;for(A.morphTargetBase!==-1&&(w[A.morphTargetBase]=!0);n<j.numSupportedMorphTargets;){for(y=0;y<H;y++)if(!w[y]&&
|
|
|
-z[y]>t){v=y;t=z[v]}c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[v]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;w[v]=1;t=-1;n++}}c.uniform1fv(j.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(q.__webglCustomAttributes)for(u in q.__webglCustomAttributes)if(f[u]>=0){s=q.__webglCustomAttributes[u];c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-s.buffer);c.vertexAttribPointer(f[u],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(q.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,q.__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(q.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-q.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer);c.drawElements(c.LINES,q.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
-q.__webglFaceBuffer);c.drawElements(c.TRIANGLES,q.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(A,0,q.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,q.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,q.__webglVertexCount)}}function g(f,s){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=
|
|
|
+THREE.WebGLRenderer=function(b){function d(f,s,n){var m,r,A,v=f.vertices,x=v.length,z=f.colors,t=z.length,w=f.__vertexArray,y=f.__colorArray,H=f.__sortArray,C=f.__dirtyVertices,N=f.__dirtyColors;if(n.sortParticles){ga.multiplySelf(n.matrixWorld);for(m=0;m<x;m++){r=v[m].position;Va.copy(r);ga.multiplyVector3(Va);H[m]=[Va.z,m]}H.sort(function(W,P){return P[0]-W[0]});for(m=0;m<x;m++){r=v[H[m][1]].position;A=m*3;w[A]=r.x;w[A+1]=r.y;w[A+2]=r.z}for(m=0;m<t;m++){A=m*3;color=z[H[m][1]];y[A]=color.r;y[A+1]=
|
|
|
+color.g;y[A+2]=color.b}}else{if(C)for(m=0;m<x;m++){r=v[m].position;A=m*3;w[A]=r.x;w[A+1]=r.y;w[A+2]=r.z}if(N)for(m=0;m<t;m++){color=z[m];A=m*3;y[A]=color.r;y[A+1]=color.g;y[A+2]=color.b}}if(C||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}if(N||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}}function e(f,s,n,m,r){m.program||ya.initMaterial(m,s,n,r);var A=m.program,v=A.uniforms,x=m.uniforms;
|
|
|
+if(A!=na){c.useProgram(A);na=A}c.uniformMatrix4fv(v.projectionMatrix,!1,Pa);if(n&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial||m.fog)){x.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){x.fogNear.value=n.near;x.fogFar.value=n.far}else if(n instanceof THREE.FogExp2)x.fogDensity.value=n.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof
|
|
|
+THREE.MeshLambertMaterial||m.lights){var z,t,w=0,y=0,H=0,C,N,W,P,T=hb,Ha=T.directional.colors,R=T.directional.positions,Q=T.point.colors,S=T.point.positions,ra=T.point.distances,q=0,E=0;n=t=P=0;for(z=s.length;n<z;n++){t=s[n];C=t.color;N=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){w+=C.r;y+=C.g;H+=C.b}else if(t instanceof THREE.DirectionalLight){P=q*3;Ha[P]=C.r*W;Ha[P+1]=C.g*W;Ha[P+2]=C.b*W;R[P]=N.x;R[P+1]=N.y;R[P+2]=N.z;q+=1}else if(t instanceof THREE.PointLight){t=E*
|
|
|
+3;Q[t]=C.r*W;Q[t+1]=C.g*W;Q[t+2]=C.b*W;S[t]=N.x;S[t+1]=N.y;S[t+2]=N.z;ra[E]=P;E+=1}}for(n=q*3;n<Ha.length;n++)Ha[n]=0;for(n=E*3;n<Q.length;n++)Q[n]=0;T.point.length=E;T.directional.length=q;T.ambient[0]=w;T.ambient[1]=y;T.ambient[2]=H;n=hb;x.enableLighting.value=n.directional.length+n.point.length;x.ambientLightColor.value=n.ambient;x.directionalLightColor.value=n.directional.colors;x.directionalLightDirection.value=n.directional.positions;x.pointLightColor.value=n.point.colors;x.pointLightPosition.value=
|
|
|
+n.point.positions;x.pointLightDistance.value=n.point.distances}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity;x.map.texture=m.map;x.lightMap.texture=m.lightMap;x.envMap.texture=m.envMap;x.reflectivity.value=m.reflectivity;x.refractionRatio.value=m.refractionRatio;x.combine.value=m.combine;x.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof
|
|
|
+THREE.LineBasicMaterial){x.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity;x.size.value=m.size;x.scale.value=U.height/2;x.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);x.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);x.shininess.value=m.shininess}else if(m instanceof
|
|
|
+THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)x.opacity.value=m.opacity;for(var i in x)if(y=A.uniforms[i]){z=x[i];w=z.type;n=z.value;if(w=="i")c.uniform1i(y,n);else if(w=="f")c.uniform1f(y,n);else if(w=="fv1")c.uniform1fv(y,n);else if(w=="fv")c.uniform3fv(y,n);else if(w=="v2")c.uniform2f(y,n.x,n.y);else if(w=="v3")c.uniform3f(y,n.x,n.y,n.z);else if(w=="v4")c.uniform4f(y,n.x,n.y,n.z,n.w);else if(w=="c")c.uniform3f(y,
|
|
|
+n.r,n.g,n.b);else if(w=="t"){c.uniform1i(y,n);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(w=0;w<6;++w)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+w,0,0,0,c.RGBA,c.UNSIGNED_BYTE,z.image[w])}else{z.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(w=0;w<6;++w)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+w,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,z.image[w]);z.__webglInit=!0}wa(c.TEXTURE_CUBE_MAP,z,z.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube)}}else $(z,n)}}c.uniformMatrix4fv(v.modelViewMatrix,!1,r._modelViewMatrixArray);c.uniformMatrix3fv(v.normalMatrix,!1,r._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&c.uniform3f(v.cameraPosition,
|
|
|
+f.position.x,f.position.y,f.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&c.uniformMatrix4fv(v.objectMatrix,!1,r._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&c.uniformMatrix4fv(v.viewMatrix,!1,Ua);if(m instanceof THREE.ShadowVolumeDynamicMaterial){f=x.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(v.directionalLightDirection,
|
|
|
+f);c.uniformMatrix4fv(v.objectMatrix,!1,r._objectMatrixArray);c.uniformMatrix4fv(v.viewMatrix,!1,Ua)}if(m.skinning){c.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ua);c.uniformMatrix4fv(v.boneGlobalMatrices,!1,r.boneMatrices)}return A}function h(f,s,n,m,r,A){if(m.opacity!=0){var v;f=e(f,s,n,m,A).attributes;if(m.morphTargets){s=m.program.attributes;A.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[A.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,r.__webglVertexBuffer);c.vertexAttribPointer(s.position,
|
|
|
+3,c.FLOAT,!1,0,0);if(A.morphTargetForcedOrder.length){n=0;for(var x=A.morphTargetForcedOrder,z=A.morphTargetInfluences;n<m.numSupportedMorphTargets&&n<x.length;){c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[x[n]]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=z[x[n]];n++}}else{x=[];var t=-1,w=0;z=A.morphTargetInfluences;var y,H=z.length;n=0;for(A.morphTargetBase!==-1&&(x[A.morphTargetBase]=!0);n<m.numSupportedMorphTargets;){for(y=0;y<H;y++)if(!x[y]&&
|
|
|
+z[y]>t){w=y;t=z[w]}c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[w]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;x[w]=1;t=-1;n++}}c.uniform1fv(m.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,r.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(r.__webglCustomAttributes)for(v in r.__webglCustomAttributes)if(f[v]>=0){s=r.__webglCustomAttributes[v];c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+s.buffer);c.vertexAttribPointer(f[v],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(r.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,r.__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(r.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,r.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(m.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+r.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(m.wireframe){c.lineWidth(m.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);c.drawElements(c.LINES,r.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
+r.__webglFaceBuffer);c.drawElements(c.TRIANGLES,r.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(m.linewidth);c.drawArrays(A,0,r.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,r.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,r.__webglVertexCount)}}function g(f,s){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(s.attributes.position);c.vertexAttribPointer(s.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(s.attributes.normal);c.vertexAttribPointer(s.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(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=f.flipSided}}function m(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(f){za[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);za[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);za[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);za[3].set(f.n41-
|
|
|
-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);za[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);za[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=za[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function r(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=za[j].x*s.n14+za[j].y*s.n24+za[j].z*s.n34+za[j].w;if(f<=n)return!1}return!0}function x(f,s){f.list[f.count]=s;f.count+=
|
|
|
-1}function E(f){var s,n,j=f.object,q=f.opaque,A=f.transparent;A.count=0;f=q.count=0;for(s=j.materials.length;f<s;f++){n=j.materials[f];n.transparent?x(A,n):x(q,n)}}function F(f){var s,n,j,q,A=f.object,u=f.buffer,w=f.opaque,z=f.transparent;z.count=0;f=w.count=0;for(j=A.materials.length;f<j;f++){s=A.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=u.materials.length;s<n;s++)(q=u.materials[s])&&(q.transparent?x(z,q):x(w,q))}else(q=s)&&(q.transparent?x(z,q):x(w,q))}}function I(f,s){return s.z-
|
|
|
-f.z}function G(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,j,q=f.lights,A=[],u,w,z,t,v,y=f.__webglShadowVolumes.length;for(s=0;s<n;s++){j=f.lights[s];if(j instanceof THREE.DirectionalLight){A[0]=-j.position.x;A[1]=-j.position.y;A[2]=-j.position.z;
|
|
|
-for(v=0;v<y;v++){j=f.__webglShadowVolumes[v].object;u=f.__webglShadowVolumes[v].buffer;w=j.materials[0];w.program||ya.initMaterial(w,q,undefined,j);w=w.program;z=w.uniforms;t=w.attributes;if(na!==w){c.useProgram(w);na=w;c.uniformMatrix4fv(z.projectionMatrix,!1,Pa);c.uniformMatrix4fv(z.viewMatrix,!1,Ua);c.uniform3fv(z.directionalLightDirection,A)}j.matrixWorld.flattenToArray(j._objectMatrixArray);c.uniformMatrix4fv(z.objectMatrix,!1,j._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,u.__webglVertexBuffer);
|
|
|
-c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,u.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,u.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,u.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);
|
|
|
+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(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=f.flipSided}}function j(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(f){za[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);za[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);za[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);za[3].set(f.n41-
|
|
|
+f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);za[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);za[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=za[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function p(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),m=0;m<6;m++){f=za[m].x*s.n14+za[m].y*s.n24+za[m].z*s.n34+za[m].w;if(f<=n)return!1}return!0}function u(f,s){f.list[f.count]=s;f.count+=
|
|
|
+1}function D(f){var s,n,m=f.object,r=f.opaque,A=f.transparent;A.count=0;f=r.count=0;for(s=m.materials.length;f<s;f++){n=m.materials[f];n.transparent?u(A,n):u(r,n)}}function F(f){var s,n,m,r,A=f.object,v=f.buffer,x=f.opaque,z=f.transparent;z.count=0;f=x.count=0;for(m=A.materials.length;f<m;f++){s=A.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=v.materials.length;s<n;s++)(r=v.materials[s])&&(r.transparent?u(z,r):u(x,r))}else(r=s)&&(r.transparent?u(z,r):u(x,r))}}function I(f,s){return s.z-
|
|
|
+f.z}function G(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,m,r=f.lights,A=[],v,x,z,t,w,y=f.__webglShadowVolumes.length;for(s=0;s<n;s++){m=f.lights[s];if(m instanceof THREE.DirectionalLight){A[0]=-m.position.x;A[1]=-m.position.y;A[2]=-m.position.z;
|
|
|
+for(w=0;w<y;w++){m=f.__webglShadowVolumes[w].object;v=f.__webglShadowVolumes[w].buffer;x=m.materials[0];x.program||ya.initMaterial(x,r,undefined,m);x=x.program;z=x.uniforms;t=x.attributes;if(na!==x){c.useProgram(x);na=x;c.uniformMatrix4fv(z.projectionMatrix,!1,Pa);c.uniformMatrix4fv(z.viewMatrix,!1,Ua);c.uniform3fv(z.directionalLightDirection,A)}m.matrixWorld.flattenToArray(m._objectMatrixArray);c.uniformMatrix4fv(z.objectMatrix,!1,m._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,v.__webglVertexBuffer);
|
|
|
+c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,v.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);
|
|
|
c.disable(c.DEPTH_TEST);fa="";na=X.program;c.useProgram(X.program);c.uniformMatrix4fv(X.projectionLocation,!1,Pa);c.uniform1f(X.darknessLocation,X.darkness);c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.vertexAttribPointer(X.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(X.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);
|
|
|
-c.depthMask(Ga)}function L(f,s){var n,j,q,A=f.__webglLensFlares.length,u,w,z;u=new THREE.Vector3;var t=Ca/oa;w=oa*0.5;z=Ca*0.5;var v=16/Ca,y=[v*t,v],H=[1,1,0];v=[1,1];var C,N=K.readBackPixels,W,P,T=K.uniforms;n=K.attributes;c.useProgram(K.program);na=K.program;fa="";c.uniform1i(T.map,0);c.activeTexture(c.TEXTURE0);c.uniform1f(T.opacity,1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,y);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,
|
|
|
-2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(q=0;q<A;q++){n=f.__webglLensFlares[q].object;u.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(u);j=u.z;s.projectionMatrix.multiplyVector3(u);H[0]=u.x;H[1]=u.y;H[2]=u.z;v[0]=H[0]*w+w;v[1]=H[1]*z+z;c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,v[0]-8,v[1]-8,16,16);c.uniform3fv(T.screenPosition,H);c.uniform1i(T.renderPink,
|
|
|
-1);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);try{c.readPixels(v[0]-8,v[1]-8,16,16,c.RGBA,c.UNSIGNED_BYTE,K.readBackPixels)}catch(Ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}c.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-j,s.far))/s.far),10)+2;j=sampleDistance*4;C=sampleDistance*64;P=0;W=28-j+(448-C);K.readBackPixels[W+0]===255&&K.readBackPixels[W+1]===0&&K.readBackPixels[W+
|
|
|
-2]===255&&(P+=0.2);W=28+j+(448-C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28+j+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28-j+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=476;N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);n.positionScreen.x=H[0];n.positionScreen.y=H[1];n.positionScreen.z=H[2];n.customUpdateCallback?n.customUpdateCallback(P,n):n.updateLensFlares(P);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
|
|
|
-0)}for(q=0;q<A;q++){n=f.__webglLensFlares[q].object;u=0;for(w=n.lensFlares.length;u<w;u++){z=n.lensFlares[u];if(z.opacity>0.001&&z.scale>0.001){H[0]=z.x;H[1]=z.y;H[2]=z.z;v=z.size*z.scale/Ca;y[0]=v*t;y[1]=v;c.uniform3fv(T.screenPosition,H);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,
|
|
|
-f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,j,q,A;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){j=n.geometryGroups[s];A=!1;for(q in j.__webglCustomAttributes)if(j.__webglCustomAttributes[q].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var u=void 0,
|
|
|
-w=void 0,z=void 0,t=void 0;z=void 0;var v=void 0,y=void 0,H=void 0,C=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;H=void 0;t=void 0;C=void 0;t=void 0;var p=void 0,D=void 0;y=void 0;p=void 0;D=void 0;var i=void 0,Ka=void 0;p=void 0;D=void 0;i=void 0;Ka=void 0;p=void 0;D=void 0;i=void 0;Ka=void 0;p=void 0;D=void 0;i=void 0;t=void 0;C=void 0;v=void 0;z=void 0;z=void 0;p=void 0;D=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=
|
|
|
-0,va=0,B=0,Ba=0;D=p=0;var Da=j.__vertexArray,ib=j.__uvArray,jb=j.__uv2Array,Qa=j.__normalArray,ha=j.__tangentArray,Ea=j.__colorArray,ia=j.__skinVertexAArray,ja=j.__skinVertexBArray,ka=j.__skinIndexArray,la=j.__skinWeightArray,kb=j.__morphTargetsArrays,Ra=j.__webglCustomAttributes;i=void 0;var Na=j.__faceArray,Oa=j.__lineArray,rb=j.__needsSmoothNormals;W=j.__vertexColorType;N=j.__uvType;P=j.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,
|
|
|
-ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=j.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}u=0;for(w=sb.length;u<w;u++){z=sb[u];t=wb[z];tb&&(T=tb[z]);ub&&(Ha=ub[z]);z=t.vertexNormals;v=t.normal;y=t.vertexColors;H=t.color;C=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=
|
|
|
-bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){p=i.offset;D=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[p+0]=i.value[t.a];i.array[p+1]=i.value[t.b];i.array[p+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[p+0]=i.value[D];i.array[p+1]=i.value[D];i.array[p+2]=i.value[D];i.offsetSrc++}else if(i.boundTo===
|
|
|
-"faceVertices"){i.array[p+0]=i.value[D+0];i.array[p+1]=i.value[D+1];i.array[p+2]=i.value[D+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[D];Q=i.value[D];S=i.value[D];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[D+0];Q=i.value[D+1];S=i.value[D+2];i.offsetSrc+=3}if(i.size===2){i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+2]=Q.x;i.array[p+3]=Q.y;i.array[p+4]=S.x;i.array[p+
|
|
|
-5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[p+0]=R.r;i.array[p+1]=R.g;i.array[p+2]=R.b;i.array[p+3]=Q.r;i.array[p+4]=Q.g;i.array[p+5]=Q.b;i.array[p+6]=S.r;i.array[p+7]=S.g;i.array[p+8]=S.b}else{i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+2]=R.z;i.array[p+3]=Q.x;i.array[p+4]=Q.y;i.array[p+5]=Q.z;i.array[p+6]=S.x;i.array[p+7]=S.y;i.array[p+8]=S.z}i.offset+=9}else{i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+2]=R.z;i.array[p+3]=R.w;i.array[p+4]=Q.x;i.array[p+5]=Q.y;i.array[p+6]=Q.z;
|
|
|
-i.array[p+7]=Q.w;i.array[p+8]=S.x;i.array[p+9]=S.y;i.array[p+10]=S.z;i.array[p+11]=S.w;i.offset+=12}}}}if(qb){p=0;for(D=Ta.length;p<D;p++){R=Ta[p].vertices[t.a].position;Q=Ta[p].vertices[t.b].position;S=Ta[p].vertices[t.c].position;i=kb[p];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z}Ba+=9}if(Xa.length){p=Xa[t.a];D=Xa[t.b];i=Xa[t.c];la[B]=p.x;la[B+1]=p.y;la[B+2]=p.z;la[B+3]=p.w;la[B+4]=D.x;la[B+5]=D.y;la[B+6]=D.z;la[B+7]=D.w;la[B+8]=i.x;
|
|
|
-la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;p=eb[t.a];D=eb[t.b];i=eb[t.c];ka[B]=p.x;ka[B+1]=p.y;ka[B+2]=p.z;ka[B+3]=p.w;ka[B+4]=D.x;ka[B+5]=D.y;ka[B+6]=D.z;ka[B+7]=D.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;p=cb[t.a];D=cb[t.b];i=cb[t.c];ia[B]=p.x;ia[B+1]=p.y;ia[B+2]=p.z;ia[B+3]=1;ia[B+4]=D.x;ia[B+5]=D.y;ia[B+6]=D.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;p=db[t.a];D=db[t.b];i=db[t.c];ja[B]=p.x;ja[B+1]=p.y;ja[B+2]=p.z;ja[B+3]=1;ja[B+4]=D.x;ja[B+5]=D.y;ja[B+6]=D.z;ja[B+7]=1;ja[B+
|
|
|
-8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;B+=12}if(pb&&W){if(y.length==3&&W==THREE.VertexColors){t=y[0];p=y[1];D=y[2]}else D=p=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=p.r;Ea[va+4]=p.g;Ea[va+5]=p.b;Ea[va+6]=D.r;Ea[va+7]=D.g;Ea[va+8]=D.b;va+=9}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;da+=12}if(nb&&P)if(z.length==3&&rb)for(C=0;C<3;C++){v=
|
|
|
-z[C];Qa[La]=v.x;Qa[La+1]=v.y;Qa[La+2]=v.z;La+=3}else for(C=0;C<3;C++){Qa[La]=v.x;Qa[La+1]=v.y;Qa[La+2]=v.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<3;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<3;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+2;Ja+=3;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+2;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Ma+=6;sa+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;
|
|
|
-ra=bb[t.d].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Da[Aa+9]=ra.x;Da[Aa+10]=ra.y;Da[Aa+11]=ra.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){p=i.offset;D=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[p+0]=i.value[t.a];i.array[p+1]=i.value[t.b];i.array[p+2]=i.value[t.c];i.array[p+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[p+0]=i.value[D];i.array[p+1]=i.value[D];
|
|
|
-i.array[p+2]=i.value[D];i.array[p+2]=i.value[D];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[p+0]=i.value[D+0];i.array[p+1]=i.value[D+1];i.array[p+2]=i.value[D+2];i.array[p+2]=i.value[D+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];ra=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[D];Q=i.value[D];S=i.value[D];ra=i.value[D];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[D+0];Q=i.value[D+
|
|
|
-1];S=i.value[D+2];ra=i.value[D+3];i.offsetSrc+=4}if(i.size===2){i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+2]=Q.x;i.array[p+3]=Q.y;i.array[p+4]=S.x;i.array[p+5]=S.y;i.array[p+6]=ra.x;i.array[p+7]=ra.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[p+0]=R.r;i.array[p+1]=R.g;i.array[p+2]=R.b;i.array[p+3]=Q.r;i.array[p+4]=Q.g;i.array[p+5]=Q.b;i.array[p+6]=S.r;i.array[p+7]=S.g;i.array[p+8]=S.b;i.array[p+9]=ra.r;i.array[p+10]=ra.g;i.array[p+11]=ra.b}else{i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+
|
|
|
-2]=R.z;i.array[p+3]=Q.x;i.array[p+4]=Q.y;i.array[p+5]=Q.z;i.array[p+6]=S.x;i.array[p+7]=S.y;i.array[p+8]=S.z;i.array[p+9]=ra.x;i.array[p+10]=ra.y;i.array[p+11]=ra.z}i.offset+=12}else{i.array[p+0]=R.x;i.array[p+1]=R.y;i.array[p+2]=R.z;i.array[p+3]=R.w;i.array[p+4]=Q.x;i.array[p+5]=Q.y;i.array[p+6]=Q.z;i.array[p+7]=Q.w;i.array[p+8]=S.x;i.array[p+9]=S.y;i.array[p+10]=S.z;i.array[p+11]=S.w;i.array[p+12]=ra.x;i.array[p+13]=ra.y;i.array[p+14]=ra.z;i.array[p+15]=ra.w;i.offset+=16}}}}if(qb){p=0;for(D=Ta.length;p<
|
|
|
-D;p++){R=Ta[p].vertices[t.a].position;Q=Ta[p].vertices[t.b].position;S=Ta[p].vertices[t.c].position;ra=Ta[p].vertices[t.d].position;i=kb[p];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z;i[Ba+9]=ra.x;i[Ba+10]=ra.y;i[Ba+11]=ra.z}Ba+=12}if(Xa.length){p=Xa[t.a];D=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[B]=p.x;la[B+1]=p.y;la[B+2]=p.z;la[B+3]=p.w;la[B+4]=D.x;la[B+5]=D.y;la[B+6]=D.z;la[B+7]=D.w;la[B+8]=i.x;la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;la[B+12]=
|
|
|
-Ka.x;la[B+13]=Ka.y;la[B+14]=Ka.z;la[B+15]=Ka.w;p=eb[t.a];D=eb[t.b];i=eb[t.c];Ka=eb[t.d];ka[B]=p.x;ka[B+1]=p.y;ka[B+2]=p.z;ka[B+3]=p.w;ka[B+4]=D.x;ka[B+5]=D.y;ka[B+6]=D.z;ka[B+7]=D.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;ka[B+12]=Ka.x;ka[B+13]=Ka.y;ka[B+14]=Ka.z;ka[B+15]=Ka.w;p=cb[t.a];D=cb[t.b];i=cb[t.c];Ka=cb[t.d];ia[B]=p.x;ia[B+1]=p.y;ia[B+2]=p.z;ia[B+3]=1;ia[B+4]=D.x;ia[B+5]=D.y;ia[B+6]=D.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;ia[B+12]=Ka.x;ia[B+13]=Ka.y;ia[B+14]=
|
|
|
-Ka.z;ia[B+15]=1;p=db[t.a];D=db[t.b];i=db[t.c];t=db[t.d];ja[B]=p.x;ja[B+1]=p.y;ja[B+2]=p.z;ja[B+3]=1;ja[B+4]=D.x;ja[B+5]=D.y;ja[B+6]=D.z;ja[B+7]=1;ja[B+8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;ja[B+12]=t.x;ja[B+13]=t.y;ja[B+14]=t.z;ja[B+15]=1;B+=16}if(pb&&W){if(y.length==4&&W==THREE.VertexColors){t=y[0];p=y[1];D=y[2];y=y[3]}else y=D=p=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=p.r;Ea[va+4]=p.g;Ea[va+5]=p.b;Ea[va+6]=D.r;Ea[va+7]=D.g;Ea[va+8]=D.b;Ea[va+9]=y.r;Ea[va+10]=y.g;Ea[va+11]=y.b;va+=
|
|
|
-12}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];C=C[3];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;ha[da+12]=C.x;ha[da+13]=C.y;ha[da+14]=C.z;ha[da+15]=C.w;da+=16}if(nb&&P)if(z.length==4&&rb)for(C=0;C<4;C++){v=z[C];Qa[La]=v.x;Qa[La+1]=v.y;Qa[La+2]=v.z;La+=3}else for(C=0;C<4;C++){Qa[La]=v.x;Qa[La+1]=v.y;Qa[La+2]=v.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<4;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=
|
|
|
-z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<4;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+3;Na[Ja+3]=sa+1;Na[Ja+4]=sa+2;Na[Ja+5]=sa+3;Ja+=6;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+3;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Oa[Ma+6]=sa+2;Oa[Ma+7]=sa+3;Ma+=8;sa+=4}}}if(Za){u=0;for(w=Za.length;u<w;u++){Na[Ja]=Za[u].a;Na[Ja+1]=Za[u].b;Na[Ja+2]=Za[u].c;Na[Ja+3]=Za[u].a;Na[Ja+4]=Za[u].c;Na[Ja+5]=Za[u].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,j.__webglVertexBuffer);
|
|
|
-c.bufferData(c.ARRAY_BUFFER,Da,A)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,A);i.needsUpdate=!1}}if(qb){p=0;for(D=Ta.length;p<D;p++){c.bindBuffer(c.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[p]);c.bufferData(c.ARRAY_BUFFER,kb[p],A)}}if(pb&&va>0){c.bindBuffer(c.ARRAY_BUFFER,j.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,j.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&&
|
|
|
-Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,j.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,j.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,j.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(B>
|
|
|
-0){c.bindBuffer(c.ARRAY_BUFFER,j.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,j.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER,j.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,j.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=
|
|
|
-!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;j=f.colors;P=W.length;A=j.length;T=f.__vertexArray;u=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w<P;w++){N=W[w].position;q=w*3;T[q]=N.x;T[q+1]=N.y;T[q+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(w=0;w<A;w++){color=j[w];q=w*3;u[q]=color.r;u[q+1]=color.g;u[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);
|
|
|
-c.bufferData(c.ARRAY_BUFFER,u,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;j=f.colors;P=W.length;A=j.length;T=f.__vertexArray;u=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w<P;w++){N=W[w].position;q=w*3;T[q]=N.x;T[q+1]=N.y;T[q+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(w=0;w<A;w++){color=j[w];q=w*3;u[q]=
|
|
|
-color.r;u[q+1]=color.g;u[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,u,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function O(f){function s(H){var C=[];n=0;for(j=H.length;n<j;n++)H[n]==undefined?C.push("undefined"):C.push(H[n].id);return C.join("_")}var n,j,q,A,u,w,z,t,v={},y=f.morphTargets!==
|
|
|
-undefined?f.morphTargets.length:0;f.geometryGroups={};q=0;for(A=f.faces.length;q<A;q++){u=f.faces[q];w=u.materials;z=s(w);v[z]==undefined&&(v[z]={hash:z,counter:0});t=v[z].hash+"_"+v[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:w,vertices:0,numMorphTargets:y});u=u instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+u>65535){v[z].counter+=1;t=v[z].hash+"_"+v[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:w,vertices:0,
|
|
|
-numMorphTargets:y})}f.geometryGroups[t].faces.push(q);f.geometryGroups[t].vertices+=u}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);
|
|
|
+c.depthMask(Ga)}function L(f,s){var n,m,r,A=f.__webglLensFlares.length,v,x,z;v=new THREE.Vector3;var t=Ca/oa;x=oa*0.5;z=Ca*0.5;var w=16/Ca,y=[w*t,w],H=[1,1,0];w=[1,1];var C,N=K.readBackPixels,W,P,T=K.uniforms;n=K.attributes;c.useProgram(K.program);na=K.program;fa="";c.uniform1i(T.map,0);c.activeTexture(c.TEXTURE0);c.uniform1f(T.opacity,1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,y);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,
|
|
|
+2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(r=0;r<A;r++){n=f.__webglLensFlares[r].object;v.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(v);m=v.z;s.projectionMatrix.multiplyVector3(v);H[0]=v.x;H[1]=v.y;H[2]=v.z;w[0]=H[0]*x+x;w[1]=H[1]*z+z;c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,w[0]-8,w[1]-8,16,16);c.uniform3fv(T.screenPosition,H);c.uniform1i(T.renderPink,
|
|
|
+1);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);try{c.readPixels(w[0]-8,w[1]-8,16,16,c.RGBA,c.UNSIGNED_BYTE,K.readBackPixels)}catch(Ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}c.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-m,s.far))/s.far),10)+2;m=sampleDistance*4;C=sampleDistance*64;P=0;W=28-m+(448-C);K.readBackPixels[W+0]===255&&K.readBackPixels[W+1]===0&&K.readBackPixels[W+
|
|
|
+2]===255&&(P+=0.2);W=28+m+(448-C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28+m+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28-m+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=476;N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);n.positionScreen.x=H[0];n.positionScreen.y=H[1];n.positionScreen.z=H[2];n.customUpdateCallback?n.customUpdateCallback(P,n):n.updateLensFlares(P);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
|
|
|
+0)}for(r=0;r<A;r++){n=f.__webglLensFlares[r].object;v=0;for(x=n.lensFlares.length;v<x;v++){z=n.lensFlares[v];if(z.opacity>0.0010&&z.scale>0.0010){H[0]=z.x;H[1]=z.y;H[2]=z.z;w=z.size*z.scale/Ca;y[0]=w*t;y[1]=w;c.uniform3fv(T.screenPosition,H);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,
|
|
|
+f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,m,r,A;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];A=!1;for(r in m.__webglCustomAttributes)if(m.__webglCustomAttributes[r].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var v=void 0,
|
|
|
+x=void 0,z=void 0,t=void 0;z=void 0;var w=void 0,y=void 0,H=void 0,C=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;H=void 0;t=void 0;C=void 0;t=void 0;var q=void 0,E=void 0;y=void 0;q=void 0;E=void 0;var i=void 0,Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;t=void 0;C=void 0;w=void 0;z=void 0;z=void 0;q=void 0;E=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=
|
|
|
+0,va=0,B=0,Ba=0;E=q=0;var Da=m.__vertexArray,ib=m.__uvArray,jb=m.__uv2Array,Qa=m.__normalArray,ha=m.__tangentArray,Ea=m.__colorArray,ia=m.__skinVertexAArray,ja=m.__skinVertexBArray,ka=m.__skinIndexArray,la=m.__skinWeightArray,kb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;i=void 0;var Na=m.__faceArray,Oa=m.__lineArray,rb=m.__needsSmoothNormals;W=m.__vertexColorType;N=m.__uvType;P=m.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,
|
|
|
+ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=m.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}v=0;for(x=sb.length;v<x;v++){z=sb[v];t=wb[z];tb&&(T=tb[z]);ub&&(Ha=ub[z]);z=t.vertexNormals;w=t.normal;y=t.vertexColors;H=t.color;C=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=
|
|
|
+bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;E=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[E];i.array[q+1]=i.value[E];i.array[q+2]=i.value[E];i.offsetSrc++}else if(i.boundTo===
|
|
|
+"faceVertices"){i.array[q+0]=i.value[E+0];i.array[q+1]=i.value[E+1];i.array[q+2]=i.value[E+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[E];Q=i.value[E];S=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[E+0];Q=i.value[E+1];S=i.value[E+2];i.offsetSrc+=3}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+
|
|
|
+5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z}i.offset+=9}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;
|
|
|
+i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.offset+=12}}}}if(qb){q=0;for(E=Ta.length;q<E;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;i=kb[q];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z}Ba+=9}if(Xa.length){q=Xa[t.a];E=Xa[t.b];i=Xa[t.c];la[B]=q.x;la[B+1]=q.y;la[B+2]=q.z;la[B+3]=q.w;la[B+4]=E.x;la[B+5]=E.y;la[B+6]=E.z;la[B+7]=E.w;la[B+8]=i.x;
|
|
|
+la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;q=eb[t.a];E=eb[t.b];i=eb[t.c];ka[B]=q.x;ka[B+1]=q.y;ka[B+2]=q.z;ka[B+3]=q.w;ka[B+4]=E.x;ka[B+5]=E.y;ka[B+6]=E.z;ka[B+7]=E.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;q=cb[t.a];E=cb[t.b];i=cb[t.c];ia[B]=q.x;ia[B+1]=q.y;ia[B+2]=q.z;ia[B+3]=1;ia[B+4]=E.x;ia[B+5]=E.y;ia[B+6]=E.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;q=db[t.a];E=db[t.b];i=db[t.c];ja[B]=q.x;ja[B+1]=q.y;ja[B+2]=q.z;ja[B+3]=1;ja[B+4]=E.x;ja[B+5]=E.y;ja[B+6]=E.z;ja[B+7]=1;ja[B+
|
|
|
+8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;B+=12}if(pb&&W){if(y.length==3&&W==THREE.VertexColors){t=y[0];q=y[1];E=y[2]}else E=q=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=q.r;Ea[va+4]=q.g;Ea[va+5]=q.b;Ea[va+6]=E.r;Ea[va+7]=E.g;Ea[va+8]=E.b;va+=9}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;da+=12}if(nb&&P)if(z.length==3&&rb)for(C=0;C<3;C++){w=
|
|
|
+z[C];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(C=0;C<3;C++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<3;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<3;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+2;Ja+=3;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+2;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Ma+=6;sa+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;
|
|
|
+ra=bb[t.d].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Da[Aa+9]=ra.x;Da[Aa+10]=ra.y;Da[Aa+11]=ra.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;E=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c];i.array[q+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[E];i.array[q+1]=i.value[E];
|
|
|
+i.array[q+2]=i.value[E];i.array[q+2]=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+0]=i.value[E+0];i.array[q+1]=i.value[E+1];i.array[q+2]=i.value[E+2];i.array[q+2]=i.value[E+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];ra=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[E];Q=i.value[E];S=i.value[E];ra=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[E+0];Q=i.value[E+
|
|
|
+1];S=i.value[E+2];ra=i.value[E+3];i.offsetSrc+=4}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.array[q+6]=ra.x;i.array[q+7]=ra.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b;i.array[q+9]=ra.r;i.array[q+10]=ra.g;i.array[q+11]=ra.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+
|
|
|
+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z;i.array[q+9]=ra.x;i.array[q+10]=ra.y;i.array[q+11]=ra.z}i.offset+=12}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.array[q+12]=ra.x;i.array[q+13]=ra.y;i.array[q+14]=ra.z;i.array[q+15]=ra.w;i.offset+=16}}}}if(qb){q=0;for(E=Ta.length;q<
|
|
|
+E;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;ra=Ta[q].vertices[t.d].position;i=kb[q];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z;i[Ba+9]=ra.x;i[Ba+10]=ra.y;i[Ba+11]=ra.z}Ba+=12}if(Xa.length){q=Xa[t.a];E=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[B]=q.x;la[B+1]=q.y;la[B+2]=q.z;la[B+3]=q.w;la[B+4]=E.x;la[B+5]=E.y;la[B+6]=E.z;la[B+7]=E.w;la[B+8]=i.x;la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;la[B+12]=
|
|
|
+Ka.x;la[B+13]=Ka.y;la[B+14]=Ka.z;la[B+15]=Ka.w;q=eb[t.a];E=eb[t.b];i=eb[t.c];Ka=eb[t.d];ka[B]=q.x;ka[B+1]=q.y;ka[B+2]=q.z;ka[B+3]=q.w;ka[B+4]=E.x;ka[B+5]=E.y;ka[B+6]=E.z;ka[B+7]=E.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;ka[B+12]=Ka.x;ka[B+13]=Ka.y;ka[B+14]=Ka.z;ka[B+15]=Ka.w;q=cb[t.a];E=cb[t.b];i=cb[t.c];Ka=cb[t.d];ia[B]=q.x;ia[B+1]=q.y;ia[B+2]=q.z;ia[B+3]=1;ia[B+4]=E.x;ia[B+5]=E.y;ia[B+6]=E.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;ia[B+12]=Ka.x;ia[B+13]=Ka.y;ia[B+14]=
|
|
|
+Ka.z;ia[B+15]=1;q=db[t.a];E=db[t.b];i=db[t.c];t=db[t.d];ja[B]=q.x;ja[B+1]=q.y;ja[B+2]=q.z;ja[B+3]=1;ja[B+4]=E.x;ja[B+5]=E.y;ja[B+6]=E.z;ja[B+7]=1;ja[B+8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;ja[B+12]=t.x;ja[B+13]=t.y;ja[B+14]=t.z;ja[B+15]=1;B+=16}if(pb&&W){if(y.length==4&&W==THREE.VertexColors){t=y[0];q=y[1];E=y[2];y=y[3]}else y=E=q=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=q.r;Ea[va+4]=q.g;Ea[va+5]=q.b;Ea[va+6]=E.r;Ea[va+7]=E.g;Ea[va+8]=E.b;Ea[va+9]=y.r;Ea[va+10]=y.g;Ea[va+11]=y.b;va+=
|
|
|
+12}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];C=C[3];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;ha[da+12]=C.x;ha[da+13]=C.y;ha[da+14]=C.z;ha[da+15]=C.w;da+=16}if(nb&&P)if(z.length==4&&rb)for(C=0;C<4;C++){w=z[C];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(C=0;C<4;C++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<4;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=
|
|
|
+z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<4;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+3;Na[Ja+3]=sa+1;Na[Ja+4]=sa+2;Na[Ja+5]=sa+3;Ja+=6;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+3;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Oa[Ma+6]=sa+2;Oa[Ma+7]=sa+3;Ma+=8;sa+=4}}}if(Za){v=0;for(x=Za.length;v<x;v++){Na[Ja]=Za[v].a;Na[Ja+1]=Za[v].b;Na[Ja+2]=Za[v].c;Na[Ja+3]=Za[v].a;Na[Ja+4]=Za[v].c;Na[Ja+5]=Za[v].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);
|
|
|
+c.bufferData(c.ARRAY_BUFFER,Da,A)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,A);i.needsUpdate=!1}}if(qb){q=0;for(E=Ta.length;q<E;q++){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[q]);c.bufferData(c.ARRAY_BUFFER,kb[q],A)}}if(pb&&va>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&&
|
|
|
+Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(B>
|
|
|
+0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=
|
|
|
+!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;A=m.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;r=x*3;T[r]=N.x;T[r+1]=N.y;T[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=m[x];r=x*3;v[r]=color.r;v[r+1]=color.g;v[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);
|
|
|
+c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;A=m.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;r=x*3;T[r]=N.x;T[r+1]=N.y;T[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=m[x];r=x*3;v[r]=
|
|
|
+color.r;v[r+1]=color.g;v[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function O(f){function s(H){var C=[];n=0;for(m=H.length;n<m;n++)H[n]==undefined?C.push("undefined"):C.push(H[n].id);return C.join("_")}var n,m,r,A,v,x,z,t,w={},y=f.morphTargets!==
|
|
|
+undefined?f.morphTargets.length:0;f.geometryGroups={};r=0;for(A=f.faces.length;r<A;r++){v=f.faces[r];x=v.materials;z=s(x);w[z]==undefined&&(w[z]={hash:z,counter:0});t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,numMorphTargets:y});v=v instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+v>65535){w[z].counter+=1;t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,
|
|
|
+numMorphTargets:y})}f.geometryGroups[t].faces.push(r);f.geometryGroups[t].vertices+=v}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);
|
|
|
break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function wa(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);
|
|
|
c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ta(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ta(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}wa(c.TEXTURE_2D,
|
|
|
f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function J(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));
|
|
@@ -243,40 +244,40 @@ null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,nu
|
|
|
return null}return n}function ta(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ea(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 c,U=document.createElement("canvas"),V=[],na=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,Z=0,ua=0,oa=0,Ca=0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,
|
|
|
-hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,j){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:j})))throw"Error creating WebGL context.";
|
|
|
-}catch(q){console.error(q)}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.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=
|
|
|
+hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context.";
|
|
|
+}catch(r){console.error(r)}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.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=
|
|
|
-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=c.createBuffer();X.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,X.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X.faces,c.STATIC_DRAW);X.program=c.createProgram();c.attachShader(X.program,
|
|
|
xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(X.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(X.program);X.vertexLocation=c.getAttribLocation(X.program,"position");X.projectionLocation=c.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=c.getUniformLocation(X.program,"darkness")}var K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);K.transparency=0.5;b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;
|
|
|
K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=c.createBuffer();K.elementBuffer=c.createBuffer();K.tempTexture=c.createTexture();K.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);
|
|
|
c.bufferData(c.ARRAY_BUFFER,K.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,K.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
|
|
|
c.NEAREST);K.program=c.createProgram();c.attachShader(K.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(K.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.vertex=c.getAttribLocation(K.program,"position");K.attributes.uv=c.getAttribLocation(K.program,"UV");K.uniforms.map=c.getUniformLocation(K.program,"map");K.uniforms.opacity=c.getUniformLocation(K.program,"opacity");K.uniforms.scale=c.getUniformLocation(K.program,
|
|
|
-"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink");this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,j){Z=f;ua=s;oa=n;Ca=j;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,j){c.scissor(f,s,n,j)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};
|
|
|
-this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,j){var q,A,u;if(f instanceof THREE.MeshDepthMaterial)u="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)u=
|
|
|
-"shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)u="normal";else if(f instanceof THREE.MeshBasicMaterial)u="basic";else if(f instanceof THREE.MeshLambertMaterial)u="lambert";else if(f instanceof THREE.MeshPhongMaterial)u="phong";else if(f instanceof THREE.LineBasicMaterial)u="basic";else f instanceof THREE.ParticleBasicMaterial&&(u="particle_basic");if(u){var w=THREE.ShaderLib[u];f.uniforms=Uniforms.clone(w.uniforms);f.vertexShader=w.vertexShader;f.fragmentShader=w.fragmentShader}var z,
|
|
|
-t,v;z=v=w=0;for(t=s.length;z<t;z++){A=s[z];A instanceof THREE.DirectionalLight&&v++;A instanceof THREE.PointLight&&w++}if(w+v<=4)s=v;else{s=Math.ceil(4*v/(w+v));w=4-s}A={directional:s,point:w};v=50;if(j!==undefined&&j instanceof THREE.SkinnedMesh)v=j.bones.length;var y;a:{z=f.fragmentShader;t=f.vertexShader;w=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,
|
|
|
-maxMorphTargets:this.maxMorphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:v};var H;A=[];if(u)A.push(u);else{A.push(z);A.push(t)}for(H in n){A.push(H);A.push(n[H])}u=A.join();H=0;for(A=V.length;H<A;H++)if(V[H].code==u){y=V[H].program;break a}H=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
|
|
|
+"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink");this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,m){Z=f;ua=s;oa=n;Ca=m;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};
|
|
|
+this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,m){var r,A,v;if(f instanceof THREE.MeshDepthMaterial)v="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)v=
|
|
|
+"shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)v="normal";else if(f instanceof THREE.MeshBasicMaterial)v="basic";else if(f instanceof THREE.MeshLambertMaterial)v="lambert";else if(f instanceof THREE.MeshPhongMaterial)v="phong";else if(f instanceof THREE.LineBasicMaterial)v="basic";else f instanceof THREE.ParticleBasicMaterial&&(v="particle_basic");if(v){var x=THREE.ShaderLib[v];f.uniforms=Uniforms.clone(x.uniforms);f.vertexShader=x.vertexShader;f.fragmentShader=x.fragmentShader}var z,
|
|
|
+t,w;z=w=x=0;for(t=s.length;z<t;z++){A=s[z];A instanceof THREE.DirectionalLight&&w++;A instanceof THREE.PointLight&&x++}if(x+w<=4)s=w;else{s=Math.ceil(4*w/(x+w));x=4-s}A={directional:s,point:x};w=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)w=m.bones.length;var y;a:{z=f.fragmentShader;t=f.vertexShader;x=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,
|
|
|
+maxMorphTargets:this.maxMorphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:w};var H;A=[];if(v)A.push(v);else{A.push(z);A.push(t)}for(H in n){A.push(H);A.push(n[H])}v=A.join();H=0;for(A=V.length;H<A;H++)if(V[H].code==v){y=V[H].program;break a}H=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
|
|
|
"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":
|
|
|
"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-c.attachShader(H,xa("fragment",prefix_fragment+z));c.attachShader(H,xa("vertex",prefix_vertex+t));c.linkProgram(H);c.getProgramParameter(H,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(H,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");H.uniforms={};H.attributes={};var C;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in w)z.push(C);
|
|
|
-C=z;w=0;for(z=C.length;w<z;w++){t=C[w];H.uniforms[t]=c.getUniformLocation(H,t)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<n.maxMorphTargets;C++)z.push("morphTarget"+C);for(y in s)z.push(y);y=z;C=0;for(s=y.length;C<s;C++){n=y[C];H.attributes[n]=c.getAttribLocation(H,n)}V.push({program:H,code:u});y=H}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
|
|
|
-0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(q in f.attributes)y[q]>=0&&c.enableVertexAttribArray(y[q]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0);
|
|
|
+c.attachShader(H,xa("fragment",prefix_fragment+z));c.attachShader(H,xa("vertex",prefix_vertex+t));c.linkProgram(H);c.getProgramParameter(H,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(H,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");H.uniforms={};H.attributes={};var C;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in x)z.push(C);
|
|
|
+C=z;x=0;for(z=C.length;x<z;x++){t=C[x];H.uniforms[t]=c.getUniformLocation(H,t)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<n.maxMorphTargets;C++)z.push("morphTarget"+C);for(y in s)z.push(y);y=z;C=0;for(s=y.length;C<s;C++){n=y[C];H.attributes[n]=c.getAttribLocation(H,n)}V.push({program:H,code:v});y=H}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
|
|
|
+0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(r in f.attributes)y[r]>=0&&c.enableVertexAttribArray(y[r]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0);
|
|
|
f.numSupportedMorphTargets++}if(y.morphTarget1>=0){c.enableVertexAttribArray(y.morphTarget1);f.numSupportedMorphTargets++}if(y.morphTarget2>=0){c.enableVertexAttribArray(y.morphTarget2);f.numSupportedMorphTargets++}if(y.morphTarget3>=0){c.enableVertexAttribArray(y.morphTarget3);f.numSupportedMorphTargets++}if(y.morphTarget4>=0){c.enableVertexAttribArray(y.morphTarget4);f.numSupportedMorphTargets++}if(y.morphTarget5>=0){c.enableVertexAttribArray(y.morphTarget5);f.numSupportedMorphTargets++}if(y.morphTarget6>=
|
|
|
-0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}j.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(q=this.maxMorphTargets;f<q;f++)j.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,j){var q,A,u,w,z,t,v,y,H=f.lights,C=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ua);s.projectionMatrix.flattenToArray(Pa);
|
|
|
-ga.multiply(s.projectionMatrix,s.matrixWorldInverse);o(ga);this.initWebGLObjects(f);J(n);(this.autoClear||j)&&this.clear();z=f.__webglObjects.length;for(j=0;j<z;j++){q=f.__webglObjects[j];v=q.object;if(v.visible)if(!(v instanceof THREE.Mesh)||r(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,s);F(q);q.render=!0;if(this.sortObjects){Va.copy(v.position);ga.multiplyVector3(Va);q.z=Va.z}}else q.render=!1;else q.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
|
|
|
-for(j=0;j<t;j++){q=f.__webglObjectsImmediate[j];v=q.object;if(v.visible){v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,s);E(q)}}ma(THREE.NormalBlending);for(j=0;j<z;j++){q=f.__webglObjects[j];if(q.render){v=q.object;y=q.buffer;u=q.opaque;k(v);for(q=0;q<u.count;q++){w=u.list[q];m(w.depthTest);h(s,H,C,w,y,v)}}}for(j=0;j<t;j++){q=f.__webglObjectsImmediate[j];v=q.object;if(v.visible){u=q.opaque;k(v);for(q=0;q<u.count;q++){w=u.list[q];m(w.depthTest);A=e(s,H,C,w,v);v.render(function(N){g(N,
|
|
|
-A)})}}}for(j=0;j<z;j++){q=f.__webglObjects[j];if(q.render){v=q.object;y=q.buffer;u=q.transparent;k(v);for(q=0;q<u.count;q++){w=u.list[q];ma(w.blending);m(w.depthTest);h(s,H,C,w,y,v)}}}for(j=0;j<t;j++){q=f.__webglObjectsImmediate[j];v=q.object;if(v.visible){u=q.transparent;k(v);for(q=0;q<u.count;q++){w=u.list[q];ma(w.blending);m(w.depthTest);A=e(s,H,C,w,v);v.render(function(N){g(N,A)})}}}Sa&&f.__webglShadowVolumes.length&&f.lights.length&&G(f);f.__webglLensFlares.length&&L(f,s);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=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,j=void 0,q=void 0,A=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);
|
|
|
-s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){q=s.geometry;q.geometryGroups==undefined&&O(q);for(j in q.geometryGroups){A=q.geometryGroups[j];if(!A.__webglVertexBuffer){var u=A;u.__webglVertexBuffer=c.createBuffer();u.__webglNormalBuffer=c.createBuffer();u.__webglTangentBuffer=c.createBuffer();u.__webglColorBuffer=c.createBuffer();u.__webglUVBuffer=c.createBuffer();u.__webglUV2Buffer=
|
|
|
-c.createBuffer();u.__webglSkinVertexABuffer=c.createBuffer();u.__webglSkinVertexBBuffer=c.createBuffer();u.__webglSkinIndicesBuffer=c.createBuffer();u.__webglSkinWeightsBuffer=c.createBuffer();u.__webglFaceBuffer=c.createBuffer();u.__webglLineBuffer=c.createBuffer();if(u.numMorphTargets){var w=void 0,z=void 0;u.__webglMorphTargetsBuffers=[];w=0;for(z=u.numMorphTargets;w<z;w++)u.__webglMorphTargetsBuffers.push(c.createBuffer())}u=A;w=s;var t=void 0,v=void 0,y=void 0;y=void 0;var H=void 0,C=void 0,
|
|
|
-N=void 0,W=N=z=0;v=void 0;y=void 0;var P=void 0;t=void 0;v=void 0;H=w.geometry;P=H.faces;C=u.faces;t=0;for(v=C.length;t<v;t++){y=C[t];y=P[y];if(y instanceof THREE.Face3){z+=3;N+=1;W+=3}else if(y instanceof THREE.Face4){z+=4;N+=2;W+=4}}t=u;v=w;P=void 0;C=void 0;var T=void 0,Ha=void 0;T=void 0;y=[];P=0;for(C=v.materials.length;P<C;P++){T=v.materials[P];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=t.materials.length;T<l;T++)(Ha=t.materials[T])&&y.push(Ha)}else(Ha=T)&&y.push(Ha)}t=y;a:{v=void 0;
|
|
|
-P=void 0;C=t.length;for(v=0;v<C;v++){P=t[v];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{P=void 0;C=void 0;y=t.length;for(P=0;P<y;P++){C=t[P];if(!(C instanceof THREE.MeshBasicMaterial&&!C.envMap||C instanceof THREE.MeshDepthMaterial)){P=C&&C.shading!=undefined&&C.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{C=void 0;y=void 0;T=t.length;for(C=0;C<T;C++){y=t[C];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}u.__vertexArray=
|
|
|
-new Float32Array(z*3);if(P)u.__normalArray=new Float32Array(z*3);if(H.hasTangents)u.__tangentArray=new Float32Array(z*4);if(y)u.__colorArray=new Float32Array(z*3);if(v){if(H.faceUvs.length>0||H.faceVertexUvs.length>0)u.__uvArray=new Float32Array(z*2);if(H.faceUvs.length>1||H.faceVertexUvs.length>1)u.__uv2Array=new Float32Array(z*2)}if(w.geometry.skinWeights.length&&w.geometry.skinIndices.length){u.__skinVertexAArray=new Float32Array(z*4);u.__skinVertexBArray=new Float32Array(z*4);u.__skinIndexArray=
|
|
|
-new Float32Array(z*4);u.__skinWeightArray=new Float32Array(z*4)}u.__faceArray=new Uint16Array(N*3+(w.geometry.edgeFaces?w.geometry.edgeFaces.length*6:0));u.__lineArray=new Uint16Array(W*2);if(u.numMorphTargets){u.__morphTargetsArrays=[];H=0;for(C=u.numMorphTargets;H<C;H++)u.__morphTargetsArrays.push(new Float32Array(z*3))}u.__needsSmoothNormals=P==THREE.SmoothShading;u.__uvType=v;u.__vertexColorType=y;u.__normalType=P;u.__webglFaceCount=N*3+(w.geometry.edgeFaces?w.geometry.edgeFaces.length*6:0);u.__webglLineCount=
|
|
|
-W*2;H=0;for(C=t.length;H<C;H++)if(t[H].attributes){u.__webglCustomAttributes={};for(a in t[H].attributes){v=t[H].attributes[a];N=1;if(v.type==="v2")N=2;else if(v.type==="v3")N=3;else if(v.type==="v4")N=4;else v.type==="c"&&(N=3);v.size=N;v.needsUpdate=!0;v.array=new Float32Array(z*N);v.buffer=c.createBuffer();u.__webglCustomAttributes[a]=v}}q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}s instanceof THREE.ShadowVolume?
|
|
|
-ca(n.__webglShadowVolumes,A,s):ca(n.__webglObjects,A,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){q=s.geometry;if(!q.__webglVertexBuffer){j=q;j.__webglVertexBuffer=c.createBuffer();j.__webglColorBuffer=c.createBuffer();j=q;A=j.vertices.length;j.__vertexArray=new Float32Array(A*3);j.__colorArray=new Float32Array(A*3);j.__webglVertexCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else if(s instanceof THREE.Line){q=
|
|
|
-s.geometry;if(!q.__webglVertexBuffer){j=q;j.__webglVertexBuffer=c.createBuffer();j.__webglColorBuffer=c.createBuffer();j=q;A=j.vertices.length;j.__vertexArray=new Float32Array(A*3);j.__colorArray=new Float32Array(A*3);j.__webglLineCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else if(s instanceof THREE.ParticleSystem){q=s.geometry;if(!q.__webglVertexBuffer){j=q;j.__webglVertexBuffer=c.createBuffer();j.__webglColorBuffer=c.createBuffer();j=q;A=j.vertices.length;j.__vertexArray=
|
|
|
-new Float32Array(A*3);j.__colorArray=new Float32Array(A*3);j.__sortArray=[];j.__webglParticleCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];n=f;q=void 0;j=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){j=n.__webglObjects[q].object;
|
|
|
-s==j&&n.__webglObjects.splice(q,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)Y(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)Y(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)Y(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="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)};
|
|
|
+0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}m.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(r=this.maxMorphTargets;f<r;f++)m.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,m){var r,A,v,x,z,t,w,y,H=f.lights,C=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ua);s.projectionMatrix.flattenToArray(Pa);
|
|
|
+ga.multiply(s.projectionMatrix,s.matrixWorldInverse);o(ga);this.initWebGLObjects(f);J(n);(this.autoClear||m)&&this.clear();z=f.__webglObjects.length;for(m=0;m<z;m++){r=f.__webglObjects[m];w=r.object;if(w.visible)if(!(w instanceof THREE.Mesh)||p(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);F(r);r.render=!0;if(this.sortObjects){Va.copy(w.position);ga.multiplyVector3(Va);r.z=Va.z}}else r.render=!1;else r.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
|
|
|
+for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);D(r)}}ma(THREE.NormalBlending);for(m=0;m<z;m++){r=f.__webglObjects[m];if(r.render){w=r.object;y=r.buffer;v=r.opaque;k(w);for(r=0;r<v.count;r++){x=v.list[r];j(x.depthTest);h(s,H,C,x,y,w)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){v=r.opaque;k(w);for(r=0;r<v.count;r++){x=v.list[r];j(x.depthTest);A=e(s,H,C,x,w);w.render(function(N){g(N,
|
|
|
+A)})}}}for(m=0;m<z;m++){r=f.__webglObjects[m];if(r.render){w=r.object;y=r.buffer;v=r.transparent;k(w);for(r=0;r<v.count;r++){x=v.list[r];ma(x.blending);j(x.depthTest);h(s,H,C,x,y,w)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){v=r.transparent;k(w);for(r=0;r<v.count;r++){x=v.list[r];ma(x.blending);j(x.depthTest);A=e(s,H,C,x,w);w.render(function(N){g(N,A)})}}}Sa&&f.__webglShadowVolumes.length&&f.lights.length&&G(f);f.__webglLensFlares.length&&L(f,s);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=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,m=void 0,r=void 0,A=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);
|
|
|
+s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){r=s.geometry;r.geometryGroups==undefined&&O(r);for(m in r.geometryGroups){A=r.geometryGroups[m];if(!A.__webglVertexBuffer){var v=A;v.__webglVertexBuffer=c.createBuffer();v.__webglNormalBuffer=c.createBuffer();v.__webglTangentBuffer=c.createBuffer();v.__webglColorBuffer=c.createBuffer();v.__webglUVBuffer=c.createBuffer();v.__webglUV2Buffer=
|
|
|
+c.createBuffer();v.__webglSkinVertexABuffer=c.createBuffer();v.__webglSkinVertexBBuffer=c.createBuffer();v.__webglSkinIndicesBuffer=c.createBuffer();v.__webglSkinWeightsBuffer=c.createBuffer();v.__webglFaceBuffer=c.createBuffer();v.__webglLineBuffer=c.createBuffer();if(v.numMorphTargets){var x=void 0,z=void 0;v.__webglMorphTargetsBuffers=[];x=0;for(z=v.numMorphTargets;x<z;x++)v.__webglMorphTargetsBuffers.push(c.createBuffer())}v=A;x=s;var t=void 0,w=void 0,y=void 0;y=void 0;var H=void 0,C=void 0,
|
|
|
+N=void 0,W=N=z=0;w=void 0;y=void 0;var P=void 0;t=void 0;w=void 0;H=x.geometry;P=H.faces;C=v.faces;t=0;for(w=C.length;t<w;t++){y=C[t];y=P[y];if(y instanceof THREE.Face3){z+=3;N+=1;W+=3}else if(y instanceof THREE.Face4){z+=4;N+=2;W+=4}}t=v;w=x;P=void 0;C=void 0;var T=void 0,Ha=void 0;T=void 0;y=[];P=0;for(C=w.materials.length;P<C;P++){T=w.materials[P];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=t.materials.length;T<l;T++)(Ha=t.materials[T])&&y.push(Ha)}else(Ha=T)&&y.push(Ha)}t=y;a:{w=void 0;
|
|
|
+P=void 0;C=t.length;for(w=0;w<C;w++){P=t[w];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){w=!0;break a}}w=!1}a:{P=void 0;C=void 0;y=t.length;for(P=0;P<y;P++){C=t[P];if(!(C instanceof THREE.MeshBasicMaterial&&!C.envMap||C instanceof THREE.MeshDepthMaterial)){P=C&&C.shading!=undefined&&C.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{C=void 0;y=void 0;T=t.length;for(C=0;C<T;C++){y=t[C];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}v.__vertexArray=
|
|
|
+new Float32Array(z*3);if(P)v.__normalArray=new Float32Array(z*3);if(H.hasTangents)v.__tangentArray=new Float32Array(z*4);if(y)v.__colorArray=new Float32Array(z*3);if(w){if(H.faceUvs.length>0||H.faceVertexUvs.length>0)v.__uvArray=new Float32Array(z*2);if(H.faceUvs.length>1||H.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(z*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(z*4);v.__skinVertexBArray=new Float32Array(z*4);v.__skinIndexArray=
|
|
|
+new Float32Array(z*4);v.__skinWeightArray=new Float32Array(z*4)}v.__faceArray=new Uint16Array(N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(W*2);if(v.numMorphTargets){v.__morphTargetsArrays=[];H=0;for(C=v.numMorphTargets;H<C;H++)v.__morphTargetsArrays.push(new Float32Array(z*3))}v.__needsSmoothNormals=P==THREE.SmoothShading;v.__uvType=w;v.__vertexColorType=y;v.__normalType=P;v.__webglFaceCount=N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0);v.__webglLineCount=
|
|
|
+W*2;H=0;for(C=t.length;H<C;H++)if(t[H].attributes){v.__webglCustomAttributes={};for(a in t[H].attributes){w=t[H].attributes[a];N=1;if(w.type==="v2")N=2;else if(w.type==="v3")N=3;else if(w.type==="v4")N=4;else w.type==="c"&&(N=3);w.size=N;w.needsUpdate=!0;w.array=new Float32Array(z*N);w.buffer=c.createBuffer();v.__webglCustomAttributes[a]=w}}r.__dirtyVertices=!0;r.__dirtyMorphTargets=!0;r.__dirtyElements=!0;r.__dirtyUvs=!0;r.__dirtyNormals=!0;r.__dirtyTangents=!0;r.__dirtyColors=!0}s instanceof THREE.ShadowVolume?
|
|
|
+ca(n.__webglShadowVolumes,A,s):ca(n.__webglObjects,A,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__webglVertexCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.Line){r=
|
|
|
+s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__webglLineCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.ParticleSystem){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=
|
|
|
+new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__sortArray=[];m.__webglParticleCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];n=f;r=void 0;m=void 0;for(r=n.__webglObjects.length-1;r>=0;r--){m=n.__webglObjects[r].object;
|
|
|
+s==m&&n.__webglObjects.splice(r,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)Y(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)Y(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)Y(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="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.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==
|
|
|
undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};
|