|
@@ -1,7 +1,7 @@
|
|
// Three.js r42 - http://github.com/mrdoob/three.js
|
|
// Three.js r42 - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
|
|
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
|
|
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,o;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=o;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=o;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=o;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f,
|
|
|
|
-g,k)},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},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
|
|
|
|
|
|
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,h,k,m,n;if(e==0)f=g=h=0;else switch(k=Math.floor(b*6),m=b*6-k,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),k){case 1:f=n;g=e;h=b;break;case 2:f=b;g=e;h=c;break;case 3:f=b;g=n;h=e;break;case 4:f=c;g=b;h=e;break;case 5:f=e;g=b;h=n;break;case 6:case 0:f=e,g=c,h=b}this.setRGB(f,
|
|
|
|
+g,h)},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},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
|
|
THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
|
|
THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
|
|
(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
|
|
(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
|
|
unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
|
|
unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
|
|
@@ -14,67 +14,67 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w
|
|
b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
|
|
b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
|
|
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
|
|
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,k,h,m,o,p,n,t,u,v,w=b.geometry,
|
|
|
|
-C=w.vertices,z=[],f=0;for(g=w.faces.length;f<g;f++)if(k=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,h=p.multiplyVector3(C[k.a].position.clone()),m=p.multiplyVector3(C[k.b].position.clone()),o=p.multiplyVector3(C[k.c].position.clone()),p=k instanceof THREE.Face4?p.multiplyVector3(C[k.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),t=v.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(n)),
|
|
|
|
-k instanceof THREE.Face3)e(u,h,m,o)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},z.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,o,p)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},z.push(k);return z}else return[]}};
|
|
|
|
-THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,n,t){m=!1;c=h;e=k;f=n;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
|
|
|
|
-function(h,k,n,t,u,v){m?(m=!1,c=h<n?h<u?h:u:n<u?n:u,e=k<t?k<v?k:v:t<v?t:v,f=h>n?h>u?h:u:n>u?n:u,g=k>t?k>v?k:v:t>v?t:v):(c=h<n?h<u?h<c?h:c:u<c?u:c:n<u?n<c?n:c:u<c?u:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>n?h>u?h>f?h:f:u>f?u:f:n>u?n>f?n:f:u>f?u:f,g=k>t?k>v?k>g?k:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
|
|
|
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,h,k,m,n,p,o,u,v,w,x=b.geometry,
|
|
|
|
+B=x.vertices,A=[],f=0;for(g=x.faces.length;f<g;f++)if(h=x.faces[f],v=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(B[h.a].position.clone()),m=p.multiplyVector3(B[h.b].position.clone()),n=p.multiplyVector3(B[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(B[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),u=w.dot(o),b.doubleSided||(b.flipSided?u>0:u<0))if(o=o.dot((new THREE.Vector3).sub(k,v))/u,v=v.addSelf(w.multiplyScalar(o)),
|
|
|
|
+h instanceof THREE.Face3)e(v,k,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},A.push(h));else if(h instanceof THREE.Face4&&(e(v,k,m,p)||e(v,m,n,p)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},A.push(h);return A}else return[]}};
|
|
|
|
+THREE.Rectangle=function(){function b(){h=f-c;k=g-e}var c,e,f,g,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,o,u){m=!1;c=h;e=k;f=o;g=u;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
|
|
|
|
+function(h,k,o,u,v,w){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=k<u?k<w?k:w:u<w?u:w,f=h>o?h>v?h:v:o>v?o:v,g=k>u?k>w?k:w:u>w?u:w):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=k<u?k<w?k<e?k:e:w<e?w:e:u<w?u<e?u:e:w<e?w:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=k>u?k>w?k>g?k:g:w>g?w:g:u>w?u>g?u:g:w>g?w:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,k,h,m,o,p,n,t,u,v,w,C){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,o||0,p||0,n||1,t||0,u||0,v||0,w||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,o,p,n,t,u,v,w,C){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=o;this.n32=p;this.n33=n;this.n34=t;this.n41=u;this.n42=v;this.n43=w;this.n44=C;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,c,e){var f=THREE.Matrix4.__v1,
|
|
|
|
-g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
|
|
|
|
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,h,k,m,n,p,o,u,v,w,x,B){this.set(b||1,c||0,e||0,f||0,g||0,h||1,k||0,m||0,n||0,p||0,o||1,u||0,v||0,w||0,x||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,k,m,n,p,o,u,v,w,x,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=k;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=u;this.n41=v;this.n42=w;this.n43=x;this.n44=B;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,c,e){var f=THREE.Matrix4.__v1,
|
|
|
|
+g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,C=b.n42,z=b.n43,y=b.n44,G=c.n11,x=c.n12,B=c.n13,F=c.n14,D=c.n21,P=c.n22,
|
|
|
|
-I=c.n23,L=c.n24,K=c.n31,U=c.n32,H=c.n33,fa=c.n34,j=c.n41,da=c.n42,V=c.n43,$=c.n44;this.n11=e*G+f*D+g*K+k*j;this.n12=e*x+f*P+g*U+k*da;this.n13=e*B+f*I+g*H+k*V;this.n14=e*F+f*L+g*fa+k*$;this.n21=h*G+m*D+o*K+p*j;this.n22=h*x+m*P+o*U+p*da;this.n23=h*B+m*I+o*H+p*V;this.n24=h*F+m*L+o*fa+p*$;this.n31=n*G+t*D+u*K+v*j;this.n32=n*x+t*P+u*U+v*da;this.n33=n*B+t*I+u*H+v*V;this.n34=n*F+t*L+u*fa+v*$;this.n41=w*G+C*D+z*K+y*j;this.n42=w*x+C*P+z*U+y*da;this.n43=w*B+C*I+z*H+y*V;this.n44=w*F+C*L+z*fa+y*$;return this},
|
|
|
|
|
|
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44,K=c.n11,E=c.n12,J=c.n13,I=c.n14,G=c.n21,N=c.n22,
|
|
|
|
+M=c.n23,Q=c.n24,F=c.n31,U=c.n32,D=c.n33,da=c.n34,j=c.n41,ca=c.n42,V=c.n43,W=c.n44;this.n11=e*K+f*G+g*F+h*j;this.n12=e*E+f*N+g*U+h*ca;this.n13=e*J+f*M+g*D+h*V;this.n14=e*I+f*Q+g*da+h*W;this.n21=k*K+m*G+n*F+p*j;this.n22=k*E+m*N+n*U+p*ca;this.n23=k*J+m*M+n*D+p*V;this.n24=k*I+m*Q+n*da+p*W;this.n31=o*K+u*G+v*F+w*j;this.n32=o*E+u*N+v*U+w*ca;this.n33=o*J+u*M+v*D+w*V;this.n34=o*I+u*Q+v*da+w*W;this.n41=x*K+B*G+A*F+y*j;this.n42=x*E+B*N+A*U+y*ca;this.n43=x*J+B*M+A*D+y*V;this.n44=x*I+B*Q+A*da+y*W;return this},
|
|
multiplyToArray:function(b,c,e){this.multiply(b,c);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;
|
|
multiplyToArray:function(b,c,e){this.multiply(b,c);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,c=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,m=this.n24,o=this.n31,p=this.n32,n=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,C=this.n44;return f*h*p*u-e*m*p*u-f*k*n*u+c*m*n*u+e*k*t*u-c*h*t*u-f*h*o*v+e*m*o*v+f*g*n*v-b*m*n*v-e*g*t*v+b*h*t*v+f*k*o*w-c*m*o*w-f*g*p*w+b*m*p*w+c*g*t*w-b*k*t*w-e*k*o*C+c*h*o*C+e*g*p*C-b*h*p*C-c*g*n*C+b*k*n*C},transpose:function(){var 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,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,v=this.n41,w=this.n42,x=this.n43,B=this.n44;return f*k*p*v-e*m*p*v-f*h*o*v+c*m*o*v+e*h*u*v-c*k*u*v-f*k*n*w+e*m*n*w+f*g*o*w-b*m*o*w-e*g*u*w+b*k*u*w+f*h*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*u*x-b*h*u*x-e*h*n*B+c*k*n*B+e*g*p*B-b*k*p*B-c*g*o*B+b*h*o*B},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=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.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,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},
|
|
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,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},
|
|
setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},
|
|
setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},
|
|
-setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,k=b.x,h=b.y,m=b.z,o=g*k,p=g*h;this.set(o*k+e,o*h-f*m,o*m+f*h,0,o*h+f*m,p*h+e,p*m-f*k,0,o*m-f*h,p*m+f*k,g*m*m+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,
|
|
|
|
-this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=h*m,p=h*g,n=f*m,t=f*g;
|
|
|
|
-this.n11=o+t*e;this.n12=n*e-p;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=p*e-n;this.n32=t+o*e;this.n33=k*h;break;case "ZXY":o=h*m;p=h*g;n=f*m;t=f*g;this.n11=o-t*e;this.n12=-k*g;this.n13=n+p*e;this.n21=p+n*e;this.n22=k*m;this.n23=t-o*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":o=k*m;p=k*g;n=e*m;t=e*g;this.n11=h*m;this.n12=n*f-p;this.n13=o*f+t;this.n21=h*g;this.n22=t*f+o;this.n23=p*f-n;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":o=k*h;p=k*f;n=e*h;t=e*f;this.n11=
|
|
|
|
-h*m;this.n12=t-o*g;this.n13=n*g+p;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+n;this.n33=o-t*g;break;case "XZY":o=k*h;p=k*f;n=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=o*g+t;this.n22=k*m;this.n23=p*g-n;this.n31=n*g-p;this.n32=e*m;this.n33=t*g+o;break;default:o=k*m,p=k*g,n=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+n*f,this.n22=o-t*f,this.n23=-e*h,this.n31=t-o*f,this.n32=n+p*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
|
-b.x,e=b.y,f=b.z,g=b.w,k=c+c,h=e+e,m=f+f,b=c*k,o=c*h;c*=m;var p=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
|
|
|
+setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,k=b.y,m=b.z,n=g*h,p=g*k;this.set(n*h+e,n*k-f*m,n*m+f*k,0,n*k+f*m,p*k+e,p*m-f*h,0,n*m-f*k,p*m+f*h,g*m*m+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,
|
|
|
|
+this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,h=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=k*m,p=k*g,o=f*m,u=f*g;
|
|
|
|
+this.n11=n+u*e;this.n12=o*e-p;this.n13=h*f;this.n21=h*g;this.n22=h*m;this.n23=-e;this.n31=p*e-o;this.n32=u+n*e;this.n33=h*k;break;case "ZXY":n=k*m;p=k*g;o=f*m;u=f*g;this.n11=n-u*e;this.n12=-h*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=h*m;this.n23=u-n*e;this.n31=-h*f;this.n32=e;this.n33=h*k;break;case "ZYX":n=h*m;p=h*g;o=e*m;u=e*g;this.n11=k*m;this.n12=o*f-p;this.n13=n*f+u;this.n21=k*g;this.n22=u*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*k;this.n33=h*k;break;case "YZX":n=h*k;p=h*f;o=e*k;u=e*f;this.n11=
|
|
|
|
+k*m;this.n12=u-n*g;this.n13=o*g+p;this.n21=g;this.n22=h*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-u*g;break;case "XZY":n=h*k;p=h*f;o=e*k;u=e*f;this.n11=k*m;this.n12=-g;this.n13=f*m;this.n21=n*g+u;this.n22=h*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=u*g+n;break;default:n=h*m,p=h*g,o=e*m,u=e*g,this.n11=k*m,this.n12=-k*g,this.n13=f,this.n21=p+o*f,this.n22=n-u*f,this.n23=-e*k,this.n31=u-n*f,this.n32=o+p*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
|
+b.x,e=b.y,f=b.z,g=b.w,h=c+c,k=e+e,m=f+f,b=c*h,n=c*k;c*=m;var p=e*k;e*=m;f*=m;h*=g;k*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-k;this.n32=e+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;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,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,C=b.n42,z=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*v*C-p*u*C+p*t*z-m*v*z-o*t*y+m*u*y;c.n12=k*u*C-g*v*C-k*t*z+f*v*z+g*t*y-f*u*y;c.n13=g*p*C-k*o*C+k*m*z-f*p*z-g*m*y+f*o*y;c.n14=k*o*t-g*p*t-k*m*u+f*p*u+g*m*v-f*o*v;c.n21=p*u*w-o*v*w-p*n*z+h*v*z+o*n*y-h*u*y;c.n22=g*v*w-k*u*w+k*n*z-e*v*z-g*n*y+e*u*y;c.n23=k*o*w-g*p*w-k*h*z+e*p*z+g*h*y-e*o*y;c.n24=
|
|
|
|
-g*p*n-k*o*n+k*h*u-e*p*u-g*h*v+e*o*v;c.n31=m*v*w-p*t*w+p*n*C-h*v*C-m*n*y+h*t*y;c.n32=k*t*w-f*v*w-k*n*C+e*v*C+f*n*y-e*t*y;c.n33=g*p*w-k*m*w+k*h*C-e*p*C-f*h*y+e*m*y;c.n34=k*m*n-f*p*n-k*h*t+e*p*t+f*h*v-e*m*v;c.n41=o*t*w-m*u*w-o*n*C+h*u*C+m*n*z-h*t*z;c.n42=f*u*w-g*t*w+g*n*C-e*u*C-f*n*z+e*t*z;c.n43=g*m*w-f*o*w-g*h*C+e*o*C+f*h*z-e*m*z;c.n44=f*o*n-g*m*n+g*h*t-e*o*t-f*h*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=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,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*o;e[6]=b*p;e[7]=b*n;e[8]=b*t;return c};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(k+g)/(k-g);h.n34=-2*k*g/(k-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,k){var h,m,o,p;h=new THREE.Matrix4;m=c-b;o=e-f;p=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((k+g)/p);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*w*B-p*v*B+p*u*A-m*w*A-n*u*y+m*v*y;c.n12=h*v*B-g*w*B-h*u*A+f*w*A+g*u*y-f*v*y;c.n13=g*p*B-h*n*B+h*m*A-f*p*A-g*m*y+f*n*y;c.n14=h*n*u-g*p*u-h*m*v+f*p*v+g*m*w-f*n*w;c.n21=p*v*x-n*w*x-p*o*A+k*w*A+n*o*y-k*v*y;c.n22=g*w*x-h*v*x+h*o*A-e*w*A-g*o*y+e*v*y;c.n23=h*n*x-g*p*x-h*k*A+e*p*A+g*k*y-e*n*y;c.n24=
|
|
|
|
+g*p*o-h*n*o+h*k*v-e*p*v-g*k*w+e*n*w;c.n31=m*w*x-p*u*x+p*o*B-k*w*B-m*o*y+k*u*y;c.n32=h*u*x-f*w*x-h*o*B+e*w*B+f*o*y-e*u*y;c.n33=g*p*x-h*m*x+h*k*B-e*p*B-f*k*y+e*m*y;c.n34=h*m*o-f*p*o-h*k*u+e*p*u+f*k*w-e*m*w;c.n41=n*u*x-m*v*x-n*o*B+k*v*B+m*o*A-k*u*A;c.n42=f*v*x-g*u*x+g*o*B-e*v*B-f*o*A+e*u*A;c.n43=g*m*x-f*n*x-g*k*B+e*n*B+f*k*A-e*m*A;c.n44=f*n*o-g*m*o+g*k*u-e*n*u-f*k*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*u;return c};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var k;k=new THREE.Matrix4;k.n11=2*g/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*g/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+g)/(h-g);k.n34=-2*h*g/(h-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var k,m,n,p;k=new THREE.Matrix4;m=c-b;n=e-f;p=h-g;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((e+f)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+g)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
|
|
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
|
|
this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
|
|
this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
|
|
THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
|
|
THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
|
|
-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
-THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),k=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*k-m*e;this.x=h*e+m*k;this.y=f*c*k+b*g*e;this.z=b*g*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
|
|
|
|
+THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*h-m*e;this.x=k*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
f;this.z=b.z*f;this.w=Math.cos(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);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
f;this.z=b.z*f;this.w=Math.cos(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);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
-multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-e*h-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,k=this.x,h=this.y,m=this.z,o=this.w,p=o*e+h*g-m*f,n=
|
|
|
|
-o*f+m*e-k*g,t=o*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=p*o+e*-k+n*-m-t*-h;c.y=n*o+e*-h+t*-k-p*-m;c.z=t*o+e*-m+p*-h-n*-k;return c}};
|
|
|
|
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*k)/h;f=Math.sin(f*k)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(b,c,e,f,g,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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,c,e,f,g,k,h){this.a=b;this.b=c;this.c=e;this.d=f;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
|
|
|
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*k;this.y=e*b+g*k+f*h-c*m;this.z=f*b+g*m+c*k-e*h;this.w=g*b-c*h-e*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,k=this.y,m=this.z,n=this.w,p=n*e+k*g-m*f,o=
|
|
|
|
+n*f+m*e-h*g,u=n*g+h*f-k*e,e=-h*e-k*f-m*g;c.x=p*n+e*-h+o*-m-u*-k;c.y=o*n+e*-k+u*-h-p*-m;c.z=u*n+e*-m+p*-k-o*-h;return c}};
|
|
|
|
+THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
+THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
+THREE.Face4=function(b,c,e,f,g,h,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;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.UV.prototype={set:function(b,c){this.u=b;this.v=c;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,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),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)):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),
|
|
THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),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)):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 c,e,f,g,k,h,m=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],h=this.vertices[k.c],m.sub(h.position,e.position),o.sub(c.position,e.position),m.crossSelf(o);m.isZero()||
|
|
|
|
-m.normalize();k.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],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{f=
|
|
|
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,k,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
|
|
|
|
+m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],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{f=
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,j,f,g,k){m=b.vertices[e].position;o=b.vertices[c].position;p=b.vertices[j].position;n=h[f];t=h[g];u=h[k];v=o.x-m.x;w=p.x-m.x;C=o.y-m.y;z=p.y-m.y;y=o.z-m.z;G=p.z-m.z;x=t.u-n.u;B=u.u-n.u;F=t.v-n.v;D=u.v-n.v;P=1/(x*D-B*F);U.set((D*v-F*w)*
|
|
|
|
-P,(D*C-F*z)*P,(D*y-F*G)*P);H.set((x*w-B*v)*P,(x*z-B*C)*P,(x*G-B*y)*P);L[e].addSelf(U);L[c].addSelf(U);L[j].addSelf(U);K[e].addSelf(H);K[c].addSelf(H);K[j].addSelf(H)}var c,e,f,g,k,h,m,o,p,n,t,u,v,w,C,z,y,G,x,B,F,D,P,I,L=[],K=[],U=new THREE.Vector3,H=new THREE.Vector3,fa=new THREE.Vector3,j=new THREE.Vector3,da=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)L[c]=new THREE.Vector3,K[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],h=this.faceVertexUvs[0][c],k instanceof
|
|
|
|
-THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):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 V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)da.copy(k.vertexNormals[f]),g=k[V[f]],I=L[g],fa.copy(I),fa.subSelf(da.multiplyScalar(da.dot(I))).normalize(),j.cross(k.vertexNormals[f],I),g=j.dot(K[g]),g=g<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(fa.x,fa.y,fa.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,h,j){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=k[g];u=k[h];v=k[j];w=n.x-m.x;x=p.x-m.x;B=n.y-m.y;A=p.y-m.y;y=n.z-m.z;K=p.z-m.z;E=u.u-o.u;J=v.u-o.u;I=u.v-o.v;G=v.v-o.v;N=1/(E*G-J*I);U.set((G*w-I*x)*
|
|
|
|
+N,(G*B-I*A)*N,(G*y-I*K)*N);D.set((E*x-J*w)*N,(E*A-J*B)*N,(E*K-J*y)*N);Q[e].addSelf(U);Q[c].addSelf(U);Q[f].addSelf(U);F[e].addSelf(D);F[c].addSelf(D);F[f].addSelf(D)}var c,e,f,g,h,k,m,n,p,o,u,v,w,x,B,A,y,K,E,J,I,G,N,M,Q=[],F=[],U=new THREE.Vector3,D=new THREE.Vector3,da=new THREE.Vector3,j=new THREE.Vector3,ca=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)Q[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof
|
|
|
|
+THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)ca.copy(h.vertexNormals[f]),g=h[V[f]],M=Q[g],da.copy(M),da.subSelf(ca.multiplyScalar(ca.dot(M))).normalize(),j.cross(h.vertexNormals[f],M),g=j.dot(F[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(da.x,da.y,da.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 c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];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;
|
|
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 c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];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=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
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=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
-void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,k,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];k=h.vertexIndices[1];
|
|
|
|
-h.faceIndices=m[b(g,k)].array;for(g=0;g<h.faceIndices.length;g++)k=h.faceIndices[g],h.faces.push(this.faces[k])}}};THREE.GeometryIdCounter=0;
|
|
|
|
-THREE.Spline=function(b){function c(b,e,c,f,g,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,k,h,m,o,p,n,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;k=Math.floor(g);h=g-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;p=this.points[e[0]];n=this.points[e[1]];
|
|
|
|
-t=this.points[e[2]];u=this.points[e[3]];m=h*h;o=h*m;f.x=c(p.x,n.x,t.x,u.x,h,m,o);f.y=c(p.y,n.y,t.y,u.y,h,m,o);f.z=c(p.z,n.z,t.z,u.z,h,m,o);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
|
|
|
|
-m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,k,m=[],o=new THREE.Vector3,p=this.getLength();m.push(o.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];k=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=g+c*(1/k)*(h-g),position=this.getPoint(f),m.push(o.copy(position).clone());
|
|
|
|
-m.push(o.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||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;
|
|
|
|
|
|
+void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,k,m={};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(g=b(k.a,k.b),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.a,k.c),c(m,g,e)):k instanceof THREE.Face4&&(g=b(k.b,k.d),c(m,g,e),g=b(k.a,k.b),c(m,g,e),g=b(k.a,k.d),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.c,k.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];g=k.vertexIndices[0];h=k.vertexIndices[1];
|
|
|
|
+k.faceIndices=m[b(g,h)].array;for(g=0;g<k.faceIndices.length;g++)h=k.faceIndices[g],k.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
|
|
|
|
+THREE.Spline=function(b){function c(b,e,c,f,g,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,k,m,n,p,o,u,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);k=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
|
|
|
|
+u=this.points[e[2]];v=this.points[e[3]];m=k*k;n=k*m;f.x=c(p.x,o.x,u.x,v.x,k,m,n);f.y=c(p.y,o.y,u.y,v.y,k,m,n);f.z=c(p.z,o.z,u.z,v.z,k,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
|
|
|
|
+m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,k,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];k=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=g+c*(1/k)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
|
|
|
|
+m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||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,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
-THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=k;this.updateProjectionMatrix()};
|
|
|
|
|
|
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,h){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=h;this.updateProjectionMatrix()};
|
|
THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
|
|
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
|
|
@@ -103,7 +103,7 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
|
|
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
-THREE.Texture=function(b,c,e,f,g,k){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=k!==void 0?k:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
|
|
|
+THREE.Texture=function(b,c,e,f,g,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
|
|
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
@@ -113,23 +113,23 @@ e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THR
|
|
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=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,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
|
|
c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
|
|
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,k,h,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],k=g.pos,h=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(k[0],k[1],k[2]),f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
|
|
|
|
|
|
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,h,k,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],h=g.pos,k=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(k[0],k[1],k[2],k[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
|
|
f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);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,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
|
-e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[k].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
|
+e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
|
|
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
|
|
THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!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 f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!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 f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,k,h,m,o,p,n,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var C=w.egdes=this.geometry.edges,z=w.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
|
-e.normal;b=0;for(c=C.length;b<c;b++)m=C[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],k=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(o="a",n=y[g]+0):e.b===h?(o="b",n=y[g]+1):e.c===h?(o="c",n=y[g]+2):e.d===h&&(o="d",n=y[g]+3),e.a===m?(o+="a",t=y[g]+0):e.b===m?(o+="b",t=y[g]+1):e.c===m?(o+="c",t=y[g]+2):e.d===m&&(o+="d",t=y[g]+3),f.a===h?(p="a",u=y[k]+0):f.b===h?(p="b",u=y[k]+1):f.c===h?(p="c",u=y[k]+2):f.d===h&&(p="d",u=y[k]+3),f.a===m?(p+="a",v=y[k]+0):f.b===m?(p+="b",v=y[k]+
|
|
|
|
-1):f.c===m?(p+="c",v=y[k]+2):f.d===m&&(p+="d",v=y[k]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>t&&(e=n,n=t,t=e):n<t&&(e=n,n=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(n,t,u,v),e.normal.set(1,0,0),z.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,k=g.length,h,m,o,p,n,t=["a","b","c","d"];for(o=0;o<k;o++){m=c.length;h=g[o];h instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
|
|
|
|
-for(m=0;m<p;m++)n=b[h[t[m]]],c.push(new THREE.Vertex(n.position.clone()))}for(k=0;k<g.length-1;k++){b=e[k];for(h=k+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,k,h,m,o,p,n,t,u,v,w,C,z=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){k=c[y[w]];m=b[k];for(C=0;C<g;C++)if(h=e[y[C]],o=b[h],Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4&&(z++,z===1&&(p=m,n=o,t=k,u=h,v=y[w]),z===2))return v+=y[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,n,o,m],indices:[t,u,
|
|
|
|
-h,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,o,n],indices:[t,k,h,u],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,k,m,n,p,o,u,v,w,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var B=x.egdes=this.geometry.edges,A=x.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
|
+e.normal;b=0;for(c=B.length;b<c;b++)m=B[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",o=y[g]+0):e.b===k?(n="b",o=y[g]+1):e.c===k?(n="c",o=y[g]+2):e.d===k&&(n="d",o=y[g]+3),e.a===m?(n+="a",u=y[g]+0):e.b===m?(n+="b",u=y[g]+1):e.c===m?(n+="c",u=y[g]+2):e.d===m&&(n+="d",u=y[g]+3),f.a===k?(p="a",v=y[h]+0):f.b===k?(p="b",v=y[h]+1):f.c===k?(p="c",v=y[h]+2):f.d===k&&(p="d",v=y[h]+3),f.a===m?(p+="a",w=y[h]+0):f.b===m?(p+="b",w=y[h]+
|
|
|
|
+1):f.c===m?(p+="c",w=y[h]+2):f.d===m&&(p+="d",w=y[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>u&&(e=o,o=u,u=e):o<u&&(e=o,o=u,u=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>w&&(e=v,v=w,w=e):v<w&&(e=v,v=w,w=e),e=new THREE.Face4(o,u,v,w),e.normal.set(1,0,0),A.push(e);this.geometry=x}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,k,m,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
|
|
|
|
+for(m=0;m<p;m++)o=b[k[u[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(k=h+1;k<g.length;k++)m=e[k],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,k,m,n,p,o,u,v,w,x,B,A=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){h=c[y[x]];m=b[h];for(B=0;B<g;B++)if(k=e[y[B]],n=b[k],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(A++,A===1&&(p=m,o=n,u=h,v=k,w=y[x]),A===2))return w+=y[x],w==="ad"||w==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[u,v,
|
|
|
|
+k,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[u,h,k,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
|
|
THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
|
|
@@ -138,56 +138,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
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.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(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.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};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 c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};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,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
-THREE.Projector=function(){function b(){var b=o[m]=o[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&k>=0&&m>=0?!0:g<0&&h<0||k<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,k=[],h,m,o=[],p,n,t=[],u,v=[],w,C,z=[],y,G,x=[],B=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
|
-D=new THREE.Matrix4,P=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],j,m,o;g=0;m=
|
|
|
|
-b.objects;b=0;for(j=m.length;b<j;b++){o=m[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=I[u].x*n.n14+I[u].y*n.n24+I[u].z*n.n34+I[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=k[g]=k[g]||new THREE.RenderableObject,g++,f=p,B.copy(o.position),D.multiplyVector3(B),f.object=o,f.z=B.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,k){var j=[],
|
|
|
|
-B=g.near,V=g.far,$,O,ea,Y,T,ca,ha,na,ia,J,ga,X,W,ja,Z,N,ka;G=C=u=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);I[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);I[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);I[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);I[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);I[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);I[5].set(D.n41+D.n31,D.n42+D.n32,
|
|
|
|
-D.n43+D.n33,D.n44+D.n34);for($=0;$<6;$++)ia=I[$],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(f,g,!0);f=0;for($=ia.length;f<$;f++)if(J=ia[f].object,J.visible)if(ga=J.matrixWorld,X=J.matrixRotationWorld,W=J.materials,ja=J.overdraw,m=0,J instanceof THREE.Mesh){Z=J.geometry;Y=Z.vertices;N=Z.faces;Z=Z.faceVertexUvs;O=0;for(ea=Y.length;O<ea;O++)h=b(),h.positionWorld.copy(Y[O].position),ga.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),
|
|
|
|
-h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>B&&h.positionScreen.z<V;Y=0;for(O=N.length;Y<O;Y++){ea=N[Y];if(ea instanceof THREE.Face3)if(T=o[ea.a],ca=o[ea.b],ha=o[ea.c],T.visible&&ca.visible&&ha.visible&&(J.doubleSided||J.flipSided!=(ha.positionScreen.x-T.positionScreen.x)*(ca.positionScreen.y-T.positionScreen.y)-(ha.positionScreen.y-T.positionScreen.y)*(ca.positionScreen.x-T.positionScreen.x)<0))na=t[n]=t[n]||new THREE.RenderableFace3,
|
|
|
|
-n++,p=na,p.v1.copy(T),p.v2.copy(ca),p.v3.copy(ha);else continue;else if(ea instanceof THREE.Face4)if(T=o[ea.a],ca=o[ea.b],ha=o[ea.c],na=o[ea.d],T.visible&&ca.visible&&ha.visible&&na.visible&&(J.doubleSided||J.flipSided!=((na.positionScreen.x-T.positionScreen.x)*(ca.positionScreen.y-T.positionScreen.y)-(na.positionScreen.y-T.positionScreen.y)*(ca.positionScreen.x-T.positionScreen.x)<0||(ca.positionScreen.x-ha.positionScreen.x)*(na.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*
|
|
|
|
-(na.positionScreen.x-ha.positionScreen.x)<0)))ka=v[u]=v[u]||new THREE.RenderableFace4,u++,p=ka,p.v1.copy(T),p.v2.copy(ca),p.v3.copy(ha),p.v4.copy(na);else continue;p.normalWorld.copy(ea.normal);X.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ea.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);D.multiplyVector3(p.centroidScreen);ha=ea.vertexNormals;T=0;for(ca=ha.length;T<ca;T++)na=p.vertexNormalsWorld[T],na.copy(ha[T]),X.multiplyVector3(na);T=0;for(ca=Z.length;T<
|
|
|
|
-ca;T++)if(ka=Z[T][Y]){ha=0;for(na=ka.length;ha<na;ha++)p.uvs[T][ha]=ka[ha]}p.meshMaterials=W;p.faceMaterials=ea.materials;p.overdraw=ja;p.z=p.centroidScreen.z;j.push(p)}}else if(J instanceof THREE.Line){P.multiply(D,ga);Y=J.geometry.vertices;T=b();T.positionScreen.copy(Y[0].position);P.multiplyVector4(T.positionScreen);O=1;for(ea=Y.length;O<ea;O++)if(T=b(),T.positionScreen.copy(Y[O].position),P.multiplyVector4(T.positionScreen),ca=o[m-2],L.copy(T.positionScreen),K.copy(ca.positionScreen),e(L,K))L.multiplyScalar(1/
|
|
|
|
-L.w),K.multiplyScalar(1/K.w),ga=z[C]=z[C]||new THREE.RenderableLine,C++,w=ga,w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(K),w.z=Math.max(L.z,K.z),w.materials=J.materials,j.push(w)}else if(J instanceof THREE.Particle&&(F.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),D.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ga=x[G]=x[G]||new THREE.RenderableParticle,G++,y=ga,y.x=F.x/F.w,y.y=F.y/F.w,y.z=F.z,y.rotation=J.rotation.z,y.scale.x=J.scale.x*Math.abs(y.x-(F.x+g.projectionMatrix.n11)/
|
|
|
|
-(F.w+g.projectionMatrix.n14)),y.scale.y=J.scale.y*Math.abs(y.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),y.materials=J.materials,j.push(y);k&&j.sort(c);return j}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var o,p,n,t,u,v,w,C;b=c.projectScene(e,f);o=0;for(p=b.length;o<p;o++)if(u=b[o],u instanceof THREE.RenderableParticle){w=u.x*g+g;C=u.y*k+k;n=0;for(t=u.material.length;n<t;n++)if(v=u.material[n],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=C+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)w.globalAlpha=y=b}function e(b){if(G!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}G=b}}function f(b){if(x!=b.hex)x=b.hex,w.strokeStyle="#"+k(x.toString(16))}function g(b){if(B!=b.hex)B=b.hex,w.fillStyle="#"+k(B.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
|
-var h=this,m=null,o=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,t,u,v,w=p.getContext("2d"),C=new THREE.Color(0),z=0,y=1,G=0,x=null,B=null,F=null,D=null,P=null,I,L,K,U,H=new THREE.RenderableVertex,fa=new THREE.RenderableVertex,j,da,V,$,O,ea,Y,T,ca,ha,na,ia,J=new THREE.Color(0),ga=new THREE.Color(0),X=new THREE.Color(0),W=new THREE.Color(0),ja=new THREE.Color(0),Z,N,ka,la,ta,va,Ba,ya,ua,za,wa=new THREE.Rectangle,qa=new THREE.Rectangle,S=new THREE.Rectangle,
|
|
|
|
-Q=!1,oa=new THREE.Color,R=new THREE.Color,Ca=new THREE.Color,aa=new THREE.Color,pa=new THREE.Vector3,Pa,Qa,Wa,xa,Ra,Sa,b=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Qa=Pa.getContext("2d");Qa.fillStyle="rgba(0,0,0,1)";Qa.fillRect(0,0,2,2);Wa=Qa.getImageData(0,0,2,2);xa=Wa.data;Ra=document.createElement("canvas");Ra.width=Ra.height=b;Sa=Ra.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
|
|
-faces:0};this.setSize=function(b,e){n=b;t=e;u=n/2;v=t/2;p.width=n;p.height=t;wa.set(-u,-v,u,v);y=1;G=0;P=D=F=B=x=null};this.setClearColor=function(b,e){C=b;z=e};this.setClearColorHex=function(b,e){C.setHex(b);z=e};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!qa.isEmpty())qa.inflate(1),qa.minSelf(wa),C.hex==0&&z==0?w.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*
|
|
|
|
-255)+","+z+")",w.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())),qa.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;R.setRGB(0,0,0);Ca.setRGB(0,0,0);aa.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(R.r+=f.r,R.g+=f.g,R.b+=f.b):c instanceof THREE.DirectionalLight?(Ca.r+=f.r,Ca.g+=f.g,Ca.b+=f.b):c instanceof THREE.PointLight&&(aa.r+=f.r,aa.g+=f.g,aa.b+=f.b)}function n(b,e,c,f){var g,j,h,k,m=b.lights,b=0;for(g=m.length;b<g;b++)j=
|
|
|
|
-m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(pa.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,o,p,n,aa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=h.map.image,n=p.width>>1,aa=p.height>>1,h=j.scale.x*
|
|
|
|
-u,o=j.scale.y*v,k=h*n,m=o*aa,S.set(b.x-k,b.y-m,b.x+k,b.y+m),wa.instersects(S)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-o),w.translate(-n,-aa),w.drawImage(p,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,S.set(b.x-k,b.y-m,b.x+k,b.y+m),wa.instersects(S)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function y(b,g,j,h){c(h.opacity);e(h.blending);w.beginPath();
|
|
|
|
-w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(g.positionScreen.x,g.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(F!=b)w.lineWidth=F=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(P!=b)w.lineJoin=P=b;f(h.color);w.stroke();S.inflate(h.linewidth*2)}}function z(b,f,g,m,o,p,aa,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);j=b.positionScreen.x;da=b.positionScreen.y;V=f.positionScreen.x;$=f.positionScreen.y;O=g.positionScreen.x;
|
|
|
|
-ea=g.positionScreen.y;C(j,da,V,$,O,ea);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=aa.uvs[0],Ea(j,da,V,$,O,ea,t.map.image,la[m].u,la[m].v,la[o].u,la[o].v,la[p].u,la[p].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(aa.vertexNormalsWorld[0]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(aa.vertexNormalsWorld[1]),Ba=(pa.x*b.n11+
|
|
|
|
-pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(aa.vertexNormalsWorld[2]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,za=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,da,V,$,O,ea,t.envMap.image,ta,va,Ba,ya,ua,za)}else t.wireframe?B(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(la=aa.uvs[0],Ea(j,da,V,$,O,ea,t.map.image,
|
|
|
|
-la[m].u,la[m].v,la[o].u,la[o].v,la[p].u,la[p].v)),e(THREE.SubtractiveBlending)),Q?!t.wireframe&&t.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(ga.r=X.r=W.r=R.r,ga.g=X.g=W.g=R.g,ga.b=X.b=W.b=R.b,n(u,aa.v1.positionWorld,aa.vertexNormalsWorld[0],ga),n(u,aa.v2.positionWorld,aa.vertexNormalsWorld[1],X),n(u,aa.v3.positionWorld,aa.vertexNormalsWorld[2],W),ja.r=(X.r+W.r)*0.5,ja.g=(X.g+W.g)*0.5,ja.b=(X.b+W.b)*0.5,ka=Ta(ga,X,W,ja),Ea(j,da,V,$,O,ea,ka,0,0,1,0,0,1)):(oa.r=R.r,oa.g=R.g,oa.b=
|
|
|
|
-R.b,n(u,aa.centroidWorld,aa.normalWorld,oa),J.r=Math.max(0,Math.min(t.color.r*oa.r,1)),J.g=Math.max(0,Math.min(t.color.g*oa.g,1)),J.b=Math.max(0,Math.min(t.color.b*oa.b,1)),J.updateHex(),t.wireframe?B(J,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(J)):t.wireframe?B(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshDepthMaterial)Z=k.near,N=k.far,ga.r=ga.g=ga.b=1-Ja(b.positionScreen.z,Z,N),X.r=X.g=X.b=1-Ja(f.positionScreen.z,
|
|
|
|
-Z,N),W.r=W.g=W.b=1-Ja(g.positionScreen.z,Z,N),ja.r=(X.r+W.r)*0.5,ja.g=(X.g+W.g)*0.5,ja.b=(X.b+W.b)*0.5,ka=Ta(ga,X,W,ja),Ea(j,da,V,$,O,ea,ka,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)J.r=Na(aa.normalWorld.x),J.g=Na(aa.normalWorld.y),J.b=Na(aa.normalWorld.z),J.updateHex(),t.wireframe?B(J,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(J)}function x(b,f,g,m,o,p,t,aa,u){h.data.vertices+=4;h.data.faces++;c(aa.opacity);e(aa.blending);if(aa.map||aa.envMap)z(b,f,m,0,1,3,t,
|
|
|
|
-aa,u),z(o,g,p,1,2,3,t,aa,u);else if(j=b.positionScreen.x,da=b.positionScreen.y,V=f.positionScreen.x,$=f.positionScreen.y,O=g.positionScreen.x,ea=g.positionScreen.y,Y=m.positionScreen.x,T=m.positionScreen.y,ca=o.positionScreen.x,ha=o.positionScreen.y,na=p.positionScreen.x,ia=p.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color);else if(aa instanceof THREE.MeshLambertMaterial)Q?
|
|
|
|
-!aa.wireframe&&aa.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ga.r=X.r=W.r=ja.r=R.r,ga.g=X.g=W.g=ja.g=R.g,ga.b=X.b=W.b=ja.b=R.b,n(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ga),n(u,t.v2.positionWorld,t.vertexNormalsWorld[1],X),n(u,t.v4.positionWorld,t.vertexNormalsWorld[3],W),n(u,t.v3.positionWorld,t.vertexNormalsWorld[2],ja),ka=Ta(ga,X,W,ja),C(j,da,V,$,Y,T),Ea(j,da,V,$,Y,T,ka,0,0,1,0,0,1),C(ca,ha,O,ea,na,ia),Ea(ca,ha,O,ea,na,ia,ka,1,0,1,1,0,1)):(oa.r=R.r,oa.g=R.g,oa.b=R.b,n(u,
|
|
|
|
-t.centroidWorld,t.normalWorld,oa),J.r=Math.max(0,Math.min(aa.color.r*oa.r,1)),J.g=Math.max(0,Math.min(aa.color.g*oa.g,1)),J.b=Math.max(0,Math.min(aa.color.b*oa.b,1)),J.updateHex(),G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(J,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(J)):(G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)J.r=Na(t.normalWorld.x),J.g=Na(t.normalWorld.y),
|
|
|
|
-J.b=Na(t.normalWorld.z),J.updateHex(),G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(J,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(J);else if(aa instanceof THREE.MeshDepthMaterial)Z=k.near,N=k.far,ga.r=ga.g=ga.b=1-Ja(b.positionScreen.z,Z,N),X.r=X.g=X.b=1-Ja(f.positionScreen.z,Z,N),W.r=W.g=W.b=1-Ja(m.positionScreen.z,Z,N),ja.r=ja.g=ja.b=1-Ja(g.positionScreen.z,Z,N),ka=Ta(ga,X,W,ja),C(j,da,V,$,Y,T),Ea(j,da,V,$,Y,T,ka,0,0,1,0,0,1),C(ca,ha,O,ea,na,ia),Ea(ca,ha,O,ea,na,ia,ka,1,0,1,1,0,1)}function C(b,
|
|
|
|
-e,c,f,g,j){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,g,j,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function B(b,e,c,g){if(F!=e)w.lineWidth=F=e;if(D!=c)w.lineCap=D=c;if(P!=g)w.lineJoin=P=g;f(b);w.stroke();S.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,f,g,j,h,k,m,o,p,t,aa){var n,u;n=h.width-1;u=h.height-1;k*=n;m*=u;o*=n;p*=u;t*=n;aa*=u;c-=b;f-=e;g-=b;j-=e;o-=k;p-=
|
|
|
|
-m;t-=k;aa-=m;n=o*aa-t*p;n!=0&&(u=1/n,n=(aa*c-p*g)*u,p=(aa*f-p*j)*u,c=(o*g-t*c)*u,f=(o*j-t*f)*u,b=b-n*k-c*m,e=e-p*k-f*m,w.save(),w.transform(n,p,c,f,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<0?0:k>255?
|
|
|
|
-255:k;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=o<0?0:o>255?255:o;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=t<0?0:t>255?255:t;xa[14]=f<0?0:f>255?255:f;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,f=e.y-b.y,g=1/Math.sqrt(c*c+f*f);c*=g;f*=g;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ua,A,ma,Aa,Ha,Oa,Va,ra;this.autoClear?this.clear():w.setTransform(1,
|
|
|
|
-0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,k,this.sortElements);(Q=b.lights.length>0)&&p(b);Ua=0;for(A=m.length;Ua<A;Ua++){ma=m[Ua];S.empty();if(ma instanceof THREE.RenderableParticle){I=ma;I.x*=u;I.y*=v;Aa=0;for(Ha=ma.materials.length;Aa<Ha;)ra=ma.materials[Aa++],ra.opacity!=0&&t(I,ma,ra,b)}else if(ma instanceof THREE.RenderableLine){if(I=ma.v1,L=ma.v2,I.positionScreen.x*=u,I.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,S.addPoint(I.positionScreen.x,I.positionScreen.y),
|
|
|
|
-S.addPoint(L.positionScreen.x,L.positionScreen.y),wa.instersects(S)){Aa=0;for(Ha=ma.materials.length;Aa<Ha;)ra=ma.materials[Aa++],ra.opacity!=0&&y(I,L,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace3){if(I=ma.v1,L=ma.v2,K=ma.v3,I.positionScreen.x*=u,I.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,ma.overdraw&&(E(I.positionScreen,L.positionScreen),E(L.positionScreen,K.positionScreen),E(K.positionScreen,I.positionScreen)),S.add3Points(I.positionScreen.x,
|
|
|
|
-I.positionScreen.y,L.positionScreen.x,L.positionScreen.y,K.positionScreen.x,K.positionScreen.y),wa.instersects(S)){Aa=0;for(Ha=ma.meshMaterials.length;Aa<Ha;)if(ra=ma.meshMaterials[Aa++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&z(I,L,K,0,1,2,ma,ra,b)}else ra.opacity!=0&&z(I,L,K,0,1,2,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace4&&(I=ma.v1,L=ma.v2,K=ma.v3,U=ma.v4,I.positionScreen.x*=u,I.positionScreen.y*=v,
|
|
|
|
-L.positionScreen.x*=u,L.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,H.positionScreen.copy(L.positionScreen),fa.positionScreen.copy(U.positionScreen),ma.overdraw&&(E(I.positionScreen,L.positionScreen),E(L.positionScreen,U.positionScreen),E(U.positionScreen,I.positionScreen),E(K.positionScreen,H.positionScreen),E(K.positionScreen,fa.positionScreen)),S.addPoint(I.positionScreen.x,I.positionScreen.y),S.addPoint(L.positionScreen.x,L.positionScreen.y),
|
|
|
|
-S.addPoint(K.positionScreen.x,K.positionScreen.y),S.addPoint(U.positionScreen.x,U.positionScreen.y),wa.instersects(S))){Aa=0;for(Ha=ma.meshMaterials.length;Aa<Ha;)if(ra=ma.meshMaterials[Aa++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&x(I,L,K,U,H,fa,ma,ra,b)}else ra.opacity!=0&&x(I,L,K,U,H,fa,ma,ra,b)}qa.addRectangle(S)}w.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(U.sub(j.position,e.centroidWorld),U.normalize(),h=e.normalWorld.dot(U)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,m,o,t,n){h.data.vertices+=3;h.data.faces++;j=f(da++);j.setAttribute("d",
|
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?F.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?B?(D.r=P.r,D.g=P.g,D.b=P.b,b(n,o,D),F.r=Math.max(0,Math.min(t.color.r*D.r,1)),F.g=Math.max(0,Math.min(t.color.g*D.g,1)),F.b=Math.max(0,Math.min(t.color.b*D.b,1)),F.updateHex()):F.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-
|
|
|
|
-o.z*t.__farMinusNear),F.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&F.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));t.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(F.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):j.setAttribute("style","fill: #"+k(F.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(j)}function e(e,c,m,o,
|
|
|
|
-t,n,u){h.data.vertices+=4;h.data.faces++;j=f(da++);j.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?B?(D.r=P.r,D.g=P.g,D.b=P.b,b(u,t,D),F.r=Math.max(0,Math.min(n.color.r*D.r,1)),F.g=Math.max(0,Math.min(n.color.g*D.g,1)),F.b=Math.max(0,Math.min(n.color.b*
|
|
|
|
-D.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-t.z*n.__farMinusNear),F.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(t.normalWorld.x),g(t.normalWorld.y),g(t.normalWorld.z));n.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):j.setAttribute("style",
|
|
|
|
-"fill: #"+k(F.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(j)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,o=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,u,v,w,C,z,y,G=new THREE.Rectangle,x=new THREE.Rectangle,B=
|
|
|
|
-!1,F=new THREE.Color(16777215),D=new THREE.Color(16777215),P=new THREE.Color(0),I=new THREE.Color(0),L=new THREE.Color(0),K,U=new THREE.Vector3,H=[],fa=[],j,da,V,$=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":$=1;break;case "low":$=0}};this.setSize=function(b,e){n=b;t=e;u=n/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+n+" "+t);p.setAttribute("width",n);p.setAttribute("height",t);G.set(-u,
|
|
|
|
--v,u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,n,F,D,K,J,H;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,f,this.sortElements);V=da=0;if(B=b.lights.length>0){J=b.lights;P.setRGB(0,0,0);I.setRGB(0,0,0);L.setRGB(0,0,0);g=0;for(t=J.length;g<t;g++)n=J[g],F=n.color,n instanceof THREE.AmbientLight?(P.r+=F.r,P.g+=F.g,P.b+=F.b):n instanceof THREE.DirectionalLight?(I.r+=F.r,I.g+=F.g,I.b+=F.b):n instanceof
|
|
|
|
-THREE.PointLight&&(L.r+=F.r,L.g+=F.g,L.b+=F.b)}g=0;for(t=m.length;g<t;g++)if(J=m[g],x.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=u;w.y*=-v;n=0;for(F=J.materials.length;n<F;)n++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,C=J.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),G.instersects(x)){n=0;for(F=J.materials.length;n<F;)if((H=J.materials[n++])&&
|
|
|
|
-H.opacity!=0){D=w;K=C;var U=V++;fa[U]==null&&(fa[U]=document.createElementNS("http://www.w3.org/2000/svg","line"),$==0&&fa[U].setAttribute("shape-rendering","crispEdges"));j=fa[U];j.setAttribute("x1",D.positionScreen.x);j.setAttribute("y1",D.positionScreen.y);j.setAttribute("x2",K.positionScreen.x);j.setAttribute("y2",K.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(j.setAttribute("style","fill: none; stroke: ##"+k(H.color.hex.toString(16))+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+
|
|
|
|
-H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),p.appendChild(j))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,C=J.v2,z=J.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(x)){n=0;for(F=J.meshMaterials.length;n<
|
|
|
|
-F;)if(H=J.meshMaterials[n++],H instanceof THREE.MeshFaceMaterial){D=0;for(K=J.faceMaterials.length;D<K;)(H=J.faceMaterials[D++])&&H.opacity!=0&&c(w,C,z,J,H,b)}else H&&H.opacity!=0&&c(w,C,z,J,H,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,C=J.v2,z=J.v3,y=J.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,
|
|
|
|
-C.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),x.addPoint(y.positionScreen.x,y.positionScreen.y),G.instersects(x))){n=0;for(F=J.meshMaterials.length;n<F;)if(H=J.meshMaterials[n++],H instanceof THREE.MeshFaceMaterial){D=0;for(K=J.faceMaterials.length;D<K;)(H=J.faceMaterials[D++])&&H.opacity!=0&&e(w,C,z,y,J,H,b)}else H&&H.opacity!=0&&e(w,C,z,y,J,H,b)}}};
|
|
|
|
|
|
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&k>=0&&m>=0?!0:g<0&&h<0||k<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],k,m,n=[],p,o,u=[],v,w=[],x,B,A=[],y,K,E=[],J=new THREE.Vector4,I=new THREE.Vector4,
|
|
|
|
+G=new THREE.Matrix4,N=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var e=[],j,m,n;g=0;m=
|
|
|
|
+b.objects;b=0;for(j=m.length;b<j;b++){n=m[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh){a:{p=void 0;for(var o=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++)if(p=M[v].x*o.n14+M[v].y*o.n24+M[v].z*o.n34+M[v].w,p<=u){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,J.copy(n.position),G.multiplyVector3(J),f.object=n,f.z=J.z,e.push(f)}k&&e.sort(c);return e};this.projectScene=function(f,g,h){var j=[],
|
|
|
|
+J=g.near,V=g.far,W,L,fa,aa,X,ea,ia,oa,ja,R,ga,Z,Y,la,ha,pa,ma;K=B=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);G.multiply(g.projectionMatrix,g.matrixWorldInverse);M[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);M[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);M[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);M[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);M[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);M[5].set(G.n41+G.n31,G.n42+
|
|
|
|
+G.n32,G.n43+G.n33,G.n44+G.n34);for(W=0;W<6;W++)ja=M[W],ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z));ja=this.projectObjects(f,g,!0);f=0;for(W=ja.length;f<W;f++)if(R=ja[f].object,R.visible)if(ga=R.matrixWorld,Z=R.matrixRotationWorld,Y=R.materials,la=R.overdraw,m=0,R instanceof THREE.Mesh){ha=R.geometry;aa=ha.vertices;pa=ha.faces;ha=ha.faceVertexUvs;L=0;for(fa=aa.length;L<fa;L++)k=b(),k.positionWorld.copy(aa[L].position),ga.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
|
|
|
|
+G.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>J&&k.positionScreen.z<V;aa=0;for(L=pa.length;aa<L;aa++){fa=pa[aa];if(fa instanceof THREE.Face3)if(X=n[fa.a],ea=n[fa.b],ia=n[fa.c],X.visible&&ea.visible&&ia.visible&&(R.doubleSided||R.flipSided!=(ia.positionScreen.x-X.positionScreen.x)*(ea.positionScreen.y-X.positionScreen.y)-(ia.positionScreen.y-X.positionScreen.y)*(ea.positionScreen.x-X.positionScreen.x)<
|
|
|
|
+0))oa=u[o]=u[o]||new THREE.RenderableFace3,o++,p=oa,p.v1.copy(X),p.v2.copy(ea),p.v3.copy(ia);else continue;else if(fa instanceof THREE.Face4)if(X=n[fa.a],ea=n[fa.b],ia=n[fa.c],oa=n[fa.d],X.visible&&ea.visible&&ia.visible&&oa.visible&&(R.doubleSided||R.flipSided!=((oa.positionScreen.x-X.positionScreen.x)*(ea.positionScreen.y-X.positionScreen.y)-(oa.positionScreen.y-X.positionScreen.y)*(ea.positionScreen.x-X.positionScreen.x)<0||(ea.positionScreen.x-ia.positionScreen.x)*(oa.positionScreen.y-ia.positionScreen.y)-
|
|
|
|
+(ea.positionScreen.y-ia.positionScreen.y)*(oa.positionScreen.x-ia.positionScreen.x)<0)))ma=w[v]=w[v]||new THREE.RenderableFace4,v++,p=ma,p.v1.copy(X),p.v2.copy(ea),p.v3.copy(ia),p.v4.copy(oa);else continue;p.normalWorld.copy(fa.normal);Z.multiplyVector3(p.normalWorld);p.centroidWorld.copy(fa.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);G.multiplyVector3(p.centroidScreen);ia=fa.vertexNormals;X=0;for(ea=ia.length;X<ea;X++)oa=p.vertexNormalsWorld[X],oa.copy(ia[X]),
|
|
|
|
+Z.multiplyVector3(oa);X=0;for(ea=ha.length;X<ea;X++)if(ma=ha[X][aa]){ia=0;for(oa=ma.length;ia<oa;ia++)p.uvs[X][ia]=ma[ia]}p.meshMaterials=Y;p.faceMaterials=fa.materials;p.overdraw=la;p.z=p.centroidScreen.z;j.push(p)}}else if(R instanceof THREE.Line){N.multiply(G,ga);aa=R.geometry.vertices;X=b();X.positionScreen.copy(aa[0].position);N.multiplyVector4(X.positionScreen);L=1;for(fa=aa.length;L<fa;L++)if(X=b(),X.positionScreen.copy(aa[L].position),N.multiplyVector4(X.positionScreen),ea=n[m-2],Q.copy(X.positionScreen),
|
|
|
|
+F.copy(ea.positionScreen),e(Q,F))Q.multiplyScalar(1/Q.w),F.multiplyScalar(1/F.w),ga=A[B]=A[B]||new THREE.RenderableLine,B++,x=ga,x.v1.positionScreen.copy(Q),x.v2.positionScreen.copy(F),x.z=Math.max(Q.z,F.z),x.materials=R.materials,j.push(x)}else if(R instanceof THREE.Particle&&(I.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),G.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ga=E[K]=E[K]||new THREE.RenderableParticle,K++,y=ga,y.x=I.x/I.w,y.y=I.y/I.w,y.z=I.z,y.rotation=R.rotation.z,y.scale.x=
|
|
|
|
+R.scale.x*Math.abs(y.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),y.materials=R.materials,j.push(y);h&&j.sort(c);return j}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,u,v,w,x,B;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){x=v.x*g+g;B=v.y*h+h;o=0;for(u=v.material.length;o<u;o++)if(w=v.material[o],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=x+"px",w.style.top=B+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)x.globalAlpha=y=b}function e(b){if(K!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}K=b}}function f(b){if(E!=b.hex)E=b.hex,x.strokeStyle="#"+h(E.toString(16))}function g(b){if(J!=b.hex)J=b.hex,x.fillStyle="#"+h(J.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
|
+var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,u,v,w,x=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,K=0,E=null,J=null,I=null,G=null,N=null,M,Q,F,U,D=new THREE.RenderableVertex,da=new THREE.RenderableVertex,j,ca,V,W,L,fa,aa,X,ea,ia,oa,ja,R=new THREE.Color(0),ga=new THREE.Color(0),Z=new THREE.Color(0),Y=new THREE.Color(0),la=new THREE.Color(0),ha,pa,ma,ka,va,xa,Da,Aa,wa,Ba,ya=new THREE.Rectangle,sa=new THREE.Rectangle,T=new THREE.Rectangle,
|
|
|
|
+S=!1,qa=new THREE.Color,O=new THREE.Color,Ea=new THREE.Color,$=new THREE.Color,ra=new THREE.Vector3,Ra,Sa,Ya,za,Ta,Ua,b=16;Ra=document.createElement("canvas");Ra.width=Ra.height=2;Sa=Ra.getContext("2d");Sa.fillStyle="rgba(0,0,0,1)";Sa.fillRect(0,0,2,2);Ya=Sa.getImageData(0,0,2,2);za=Ya.data;Ta=document.createElement("canvas");Ta.width=Ta.height=b;Ua=Ta.getContext("2d");Ua.translate(-b/2,-b/2);Ua.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
|
|
+faces:0};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.width=o;p.height=u;ya.set(-v,-w,v,w);y=1;K=0;N=G=I=J=E=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){x.setTransform(1,0,0,-1,v,w);if(!sa.isEmpty())sa.inflate(1),sa.minSelf(ya),B.hex==0&&A==0?x.clearRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*
|
|
|
|
+255)+","+A+")",x.fillRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight())),sa.empty()};this.render=function(b,h){function p(b){var e,c,f,g=b.lights;O.setRGB(0,0,0);Ea.setRGB(0,0,0);$.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):c instanceof THREE.DirectionalLight?(Ea.r+=f.r,Ea.g+=f.g,Ea.b+=f.b):c instanceof THREE.PointLight&&($.r+=f.r,$.g+=f.g,$.b+=f.b)}function o(b,e,c,f){var g,h,j,k,m=b.lights,b=0;for(g=m.length;b<g;b++)h=
|
|
|
|
+m[b],j=h.color,h instanceof THREE.DirectionalLight?(k=c.dot(h.position),k<=0||(k*=h.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):h instanceof THREE.PointLight&&(k=c.dot(ra.sub(h.position,e).normalize()),k<=0||(k*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),k!=0&&(k*=h.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function u(b,h,j){c(j.opacity);e(j.blending);var k,m,n,p,o,$;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)p=j.map.image,o=p.width>>1,$=p.height>>1,j=h.scale.x*
|
|
|
|
+v,n=h.scale.y*w,k=j*o,m=n*$,T.set(b.x-k,b.y-m,b.x+k,b.y+m),ya.instersects(T)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,-n),x.translate(-o,-$),x.drawImage(p,0,0),x.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*v,m=h.scale.y*w,T.set(b.x-k,b.y-m,b.x+k,b.y+m),ya.instersects(T)&&(f(j.color),g(j.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,m),j.program(x),x.restore()))}function y(b,h,g,j){c(j.opacity);e(j.blending);x.beginPath();x.moveTo(b.positionScreen.x,
|
|
|
|
+b.positionScreen.y);x.lineTo(h.positionScreen.x,h.positionScreen.y);x.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(I!=b)x.lineWidth=I=b;b=j.linecap;if(G!=b)x.lineCap=G=b;b=j.linejoin;if(N!=b)x.lineJoin=N=b;f(j.color);x.stroke();T.inflate(j.linewidth*2)}}function A(b,f,g,m,n,p,u,$,v){k.data.vertices+=3;k.data.faces++;c($.opacity);e($.blending);j=b.positionScreen.x;ca=b.positionScreen.y;V=f.positionScreen.x;W=f.positionScreen.y;L=g.positionScreen.x;fa=g.positionScreen.y;E(j,
|
|
|
|
+ca,V,W,L,fa);if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.mapping instanceof THREE.UVMapping&&(ka=u.uvs[0],Ga(j,ca,V,W,L,fa,$.map.image,ka[m].u,ka[m].v,ka[n].u,ka[n].v,ka[p].u,ka[p].v));else if($.envMap){if($.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,ra.copy(u.vertexNormalsWorld[0]),va=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,xa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(u.vertexNormalsWorld[1]),Da=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+
|
|
|
|
+0.5,Aa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(u.vertexNormalsWorld[2]),wa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Ba=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Ga(j,ca,V,W,L,fa,$.envMap.image,va,xa,Da,Aa,wa,Ba)}else $.wireframe?J($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ia($.color);else if($ instanceof THREE.MeshLambertMaterial)$.map&&!$.wireframe&&($.map.mapping instanceof THREE.UVMapping&&(ka=u.uvs[0],Ga(j,ca,V,W,L,fa,$.map.image,ka[m].u,ka[m].v,ka[n].u,
|
|
|
|
+ka[n].v,ka[p].u,ka[p].v)),e(THREE.SubtractiveBlending)),S?!$.wireframe&&$.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(ga.r=Z.r=Y.r=O.r,ga.g=Z.g=Y.g=O.g,ga.b=Z.b=Y.b=O.b,o(v,u.v1.positionWorld,u.vertexNormalsWorld[0],ga),o(v,u.v2.positionWorld,u.vertexNormalsWorld[1],Z),o(v,u.v3.positionWorld,u.vertexNormalsWorld[2],Y),la.r=(Z.r+Y.r)*0.5,la.g=(Z.g+Y.g)*0.5,la.b=(Z.b+Y.b)*0.5,ma=Va(ga,Z,Y,la),Ga(j,ca,V,W,L,fa,ma,0,0,1,0,0,1)):(qa.r=O.r,qa.g=O.g,qa.b=O.b,o(v,u.centroidWorld,u.normalWorld,
|
|
|
|
+qa),R.r=Math.max(0,Math.min($.color.r*qa.r,1)),R.g=Math.max(0,Math.min($.color.g*qa.g,1)),R.b=Math.max(0,Math.min($.color.b*qa.b,1)),R.updateHex(),$.wireframe?J(R,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ia(R)):$.wireframe?J($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ia($.color);else if($ instanceof THREE.MeshDepthMaterial)ha=h.near,pa=h.far,ga.r=ga.g=ga.b=1-La(b.positionScreen.z,ha,pa),Z.r=Z.g=Z.b=1-La(f.positionScreen.z,ha,pa),Y.r=Y.g=Y.b=1-La(g.positionScreen.z,
|
|
|
|
+ha,pa),la.r=(Z.r+Y.r)*0.5,la.g=(Z.g+Y.g)*0.5,la.b=(Z.b+Y.b)*0.5,ma=Va(ga,Z,Y,la),Ga(j,ca,V,W,L,fa,ma,0,0,1,0,0,1);else if($ instanceof THREE.MeshNormalMaterial)R.r=Pa(u.normalWorld.x),R.g=Pa(u.normalWorld.y),R.b=Pa(u.normalWorld.z),R.updateHex(),$.wireframe?J(R,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):Ia(R)}function B(b,f,g,m,n,p,$,u,v){k.data.vertices+=4;k.data.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)A(b,f,m,0,1,3,$,u,v),A(n,g,p,1,2,3,$,u,v);else if(j=b.positionScreen.x,
|
|
|
|
+ca=b.positionScreen.y,V=f.positionScreen.x,W=f.positionScreen.y,L=g.positionScreen.x,fa=g.positionScreen.y,aa=m.positionScreen.x,X=m.positionScreen.y,ea=n.positionScreen.x,ia=n.positionScreen.y,oa=p.positionScreen.x,ja=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)K(j,ca,V,W,L,fa,aa,X),u.wireframe?J(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ia(u.color);else if(u instanceof THREE.MeshLambertMaterial)S?!u.wireframe&&u.shading==THREE.SmoothShading&&$.vertexNormalsWorld.length==
|
|
|
|
+4?(ga.r=Z.r=Y.r=la.r=O.r,ga.g=Z.g=Y.g=la.g=O.g,ga.b=Z.b=Y.b=la.b=O.b,o(v,$.v1.positionWorld,$.vertexNormalsWorld[0],ga),o(v,$.v2.positionWorld,$.vertexNormalsWorld[1],Z),o(v,$.v4.positionWorld,$.vertexNormalsWorld[3],Y),o(v,$.v3.positionWorld,$.vertexNormalsWorld[2],la),ma=Va(ga,Z,Y,la),E(j,ca,V,W,aa,X),Ga(j,ca,V,W,aa,X,ma,0,0,1,0,0,1),E(ea,ia,L,fa,oa,ja),Ga(ea,ia,L,fa,oa,ja,ma,1,0,1,1,0,1)):(qa.r=O.r,qa.g=O.g,qa.b=O.b,o(v,$.centroidWorld,$.normalWorld,qa),R.r=Math.max(0,Math.min(u.color.r*qa.r,1)),
|
|
|
|
+R.g=Math.max(0,Math.min(u.color.g*qa.g,1)),R.b=Math.max(0,Math.min(u.color.b*qa.b,1)),R.updateHex(),K(j,ca,V,W,L,fa,aa,X),u.wireframe?J(R,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ia(R)):(K(j,ca,V,W,L,fa,aa,X),u.wireframe?J(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ia(u.color));else if(u instanceof THREE.MeshNormalMaterial)R.r=Pa($.normalWorld.x),R.g=Pa($.normalWorld.y),R.b=Pa($.normalWorld.z),R.updateHex(),K(j,ca,V,W,L,fa,aa,X),u.wireframe?J(R,u.wireframeLinewidth,
|
|
|
|
+u.wireframeLinecap,u.wireframeLinejoin):Ia(R);else if(u instanceof THREE.MeshDepthMaterial)ha=h.near,pa=h.far,ga.r=ga.g=ga.b=1-La(b.positionScreen.z,ha,pa),Z.r=Z.g=Z.b=1-La(f.positionScreen.z,ha,pa),Y.r=Y.g=Y.b=1-La(m.positionScreen.z,ha,pa),la.r=la.g=la.b=1-La(g.positionScreen.z,ha,pa),ma=Va(ga,Z,Y,la),E(j,ca,V,W,aa,X),Ga(j,ca,V,W,aa,X,ma,0,0,1,0,0,1),E(ea,ia,L,fa,oa,ja),Ga(ea,ia,L,fa,oa,ja,ma,1,0,1,1,0,1)}function E(b,e,c,f,g,h){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(b,
|
|
|
|
+e);x.closePath()}function K(b,e,c,f,g,h,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function J(b,e,c,g){if(I!=e)x.lineWidth=I=e;if(G!=c)x.lineCap=G=c;if(N!=g)x.lineJoin=N=g;f(b);x.stroke();T.inflate(e*2)}function Ia(b){g(b);x.fill()}function Ga(b,e,c,f,g,h,j,k,m,n,p,u,$){var o,v;o=j.width-1;v=j.height-1;k*=o;m*=v;n*=o;p*=v;u*=o;$*=v;c-=b;f-=e;g-=b;h-=e;n-=k;p-=m;u-=k;$-=m;o=n*$-u*p;o!=0&&(v=1/o,o=($*c-p*g)*v,p=($*f-p*h)*v,c=(n*g-u*c)*v,f=
|
|
|
|
+(n*h-u*f)*v,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(j,0,0),x.restore())}function Va(b,e,c,f){var g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);za[0]=g<0?0:g>255?255:g;za[1]=h<0?0:h>255?255:h;za[2]=b<0?0:b>255?255:b;za[4]=j<0?0:j>255?255:j;za[5]=k<0?0:k>255?255:k;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=n<0?0:n>255?255:n;za[10]=
|
|
|
|
+c<0?0:c>255?255:c;za[12]=p<0?0:p>255?255:p;za[13]=u<0?0:u>255?255:u;za[14]=f<0?0:f>255?255:f;Sa.putImageData(Ya,0,0);Ua.drawImage(Ra,0,0);return Ta}function La(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Pa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function H(b,e){var c=e.x-b.x,f=e.y-b.y,g=1/Math.sqrt(c*c+f*f);c*=g;f*=g;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Wa,C,na,Ca,Ja,Qa,Xa,ta;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,w);k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,h,this.sortElements);
|
|
|
|
+(S=b.lights.length>0)&&p(b);Wa=0;for(C=m.length;Wa<C;Wa++){na=m[Wa];T.empty();if(na instanceof THREE.RenderableParticle){M=na;M.x*=v;M.y*=w;Ca=0;for(Ja=na.materials.length;Ca<Ja;)ta=na.materials[Ca++],ta.opacity!=0&&u(M,na,ta,b)}else if(na instanceof THREE.RenderableLine){if(M=na.v1,Q=na.v2,M.positionScreen.x*=v,M.positionScreen.y*=w,Q.positionScreen.x*=v,Q.positionScreen.y*=w,T.addPoint(M.positionScreen.x,M.positionScreen.y),T.addPoint(Q.positionScreen.x,Q.positionScreen.y),ya.instersects(T)){Ca=
|
|
|
|
+0;for(Ja=na.materials.length;Ca<Ja;)ta=na.materials[Ca++],ta.opacity!=0&&y(M,Q,na,ta,b)}}else if(na instanceof THREE.RenderableFace3){if(M=na.v1,Q=na.v2,F=na.v3,M.positionScreen.x*=v,M.positionScreen.y*=w,Q.positionScreen.x*=v,Q.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,na.overdraw&&(H(M.positionScreen,Q.positionScreen),H(Q.positionScreen,F.positionScreen),H(F.positionScreen,M.positionScreen)),T.add3Points(M.positionScreen.x,M.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,
|
|
|
|
+F.positionScreen.x,F.positionScreen.y),ya.instersects(T)){Ca=0;for(Ja=na.meshMaterials.length;Ca<Ja;)if(ta=na.meshMaterials[Ca++],ta instanceof THREE.MeshFaceMaterial){Qa=0;for(Xa=na.faceMaterials.length;Qa<Xa;)(ta=na.faceMaterials[Qa++])&&ta.opacity!=0&&A(M,Q,F,0,1,2,na,ta,b)}else ta.opacity!=0&&A(M,Q,F,0,1,2,na,ta,b)}}else if(na instanceof THREE.RenderableFace4&&(M=na.v1,Q=na.v2,F=na.v3,U=na.v4,M.positionScreen.x*=v,M.positionScreen.y*=w,Q.positionScreen.x*=v,Q.positionScreen.y*=w,F.positionScreen.x*=
|
|
|
|
+v,F.positionScreen.y*=w,U.positionScreen.x*=v,U.positionScreen.y*=w,D.positionScreen.copy(Q.positionScreen),da.positionScreen.copy(U.positionScreen),na.overdraw&&(H(M.positionScreen,Q.positionScreen),H(Q.positionScreen,U.positionScreen),H(U.positionScreen,M.positionScreen),H(F.positionScreen,D.positionScreen),H(F.positionScreen,da.positionScreen)),T.addPoint(M.positionScreen.x,M.positionScreen.y),T.addPoint(Q.positionScreen.x,Q.positionScreen.y),T.addPoint(F.positionScreen.x,F.positionScreen.y),T.addPoint(U.positionScreen.x,
|
|
|
|
+U.positionScreen.y),ya.instersects(T))){Ca=0;for(Ja=na.meshMaterials.length;Ca<Ja;)if(ta=na.meshMaterials[Ca++],ta instanceof THREE.MeshFaceMaterial){Qa=0;for(Xa=na.faceMaterials.length;Qa<Xa;)(ta=na.faceMaterials[Qa++])&&ta.opacity!=0&&B(M,Q,F,U,D,da,na,ta,b)}else ta.opacity!=0&&B(M,Q,F,U,D,da,na,ta,b)}sa.addRectangle(T)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,h,j;f=0;for(g=b.lights.length;f<g;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(j=e.normalWorld.dot(h.position)*h.intensity,j>0&&(c.r+=h.color.r*j,c.g+=h.color.g*j,c.b+=h.color.b*j)):h instanceof THREE.PointLight&&(U.sub(h.position,e.centroidWorld),U.normalize(),j=e.normalWorld.dot(U)*h.intensity,j>0&&(c.r+=h.color.r*j,c.g+=h.color.g*j,c.b+=h.color.b*j))}function c(e,c,m,n,u,o){k.data.vertices+=3;k.data.faces++;j=f(ca++);j.setAttribute("d",
|
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.hex=u.color.hex:u instanceof THREE.MeshLambertMaterial?J?(G.r=N.r,G.g=N.g,G.b=N.b,b(o,n,G),I.r=Math.max(0,Math.min(u.color.r*G.r,1)),I.g=Math.max(0,Math.min(u.color.g*G.g,1)),I.b=Math.max(0,Math.min(u.color.b*G.b,1)),I.updateHex()):I.hex=u.color.hex:u instanceof THREE.MeshDepthMaterial?(F=1-u.__2near/(u.__farPlusNear-
|
|
|
|
+n.z*u.__farMinusNear),I.setRGB(F,F,F)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));u.wireframe?j.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):j.setAttribute("style","fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+u.opacity);p.appendChild(j)}function e(e,c,m,n,
|
|
|
|
+u,o,v){k.data.vertices+=4;k.data.faces++;j=f(ca++);j.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?I.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?J?(G.r=N.r,G.g=N.g,G.b=N.b,b(v,u,G),I.r=Math.max(0,Math.min(o.color.r*G.r,1)),I.g=Math.max(0,Math.min(o.color.g*G.g,1)),I.b=Math.max(0,Math.min(o.color.b*
|
|
|
|
+G.b,1)),I.updateHex()):I.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(F=1-o.__2near/(o.__farPlusNear-u.z*o.__farMinusNear),I.setRGB(F,F,F)):o instanceof THREE.MeshNormalMaterial&&I.setRGB(g(u.normalWorld.x),g(u.normalWorld.y),g(u.normalWorld.z));o.wireframe?j.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):j.setAttribute("style",
|
|
|
|
+"fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+o.opacity);p.appendChild(j)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),W==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,u,v,w,x,B,A,y,K=new THREE.Rectangle,E=new THREE.Rectangle,J=
|
|
|
|
+!1,I=new THREE.Color(16777215),G=new THREE.Color(16777215),N=new THREE.Color(0),M=new THREE.Color(0),Q=new THREE.Color(0),F,U=new THREE.Vector3,D=[],da=[],j,ca,V,W=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":W=1;break;case "low":W=0}};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+u);p.setAttribute("width",o);p.setAttribute("height",u);K.set(-v,
|
|
|
|
+-w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,u,o,I,G,F,R,D;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);V=ca=0;if(J=b.lights.length>0){R=b.lights;N.setRGB(0,0,0);M.setRGB(0,0,0);Q.setRGB(0,0,0);g=0;for(u=R.length;g<u;g++)o=R[g],I=o.color,o instanceof THREE.AmbientLight?(N.r+=I.r,N.g+=I.g,N.b+=I.b):o instanceof THREE.DirectionalLight?(M.r+=I.r,M.g+=I.g,M.b+=I.b):o instanceof
|
|
|
|
+THREE.PointLight&&(Q.r+=I.r,Q.g+=I.g,Q.b+=I.b)}g=0;for(u=m.length;g<u;g++)if(R=m[g],E.empty(),R instanceof THREE.RenderableParticle){x=R;x.x*=v;x.y*=-w;o=0;for(I=R.materials.length;o<I;)o++}else if(R instanceof THREE.RenderableLine){if(x=R.v1,B=R.v2,x.positionScreen.x*=v,x.positionScreen.y*=-w,B.positionScreen.x*=v,B.positionScreen.y*=-w,E.addPoint(x.positionScreen.x,x.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),K.instersects(E)){o=0;for(I=R.materials.length;o<I;)if((D=R.materials[o++])&&
|
|
|
|
+D.opacity!=0){G=x;F=B;var U=V++;da[U]==null&&(da[U]=document.createElementNS("http://www.w3.org/2000/svg","line"),W==0&&da[U].setAttribute("shape-rendering","crispEdges"));j=da[U];j.setAttribute("x1",G.positionScreen.x);j.setAttribute("y1",G.positionScreen.y);j.setAttribute("x2",F.positionScreen.x);j.setAttribute("y2",F.positionScreen.y);D instanceof THREE.LineBasicMaterial&&(j.setAttribute("style","fill: none; stroke: ##"+h(D.color.hex.toString(16))+"; stroke-width: "+D.linewidth+"; stroke-opacity: "+
|
|
|
|
+D.opacity+"; stroke-linecap: "+D.linecap+"; stroke-linejoin: "+D.linejoin),p.appendChild(j))}}}else if(R instanceof THREE.RenderableFace3){if(x=R.v1,B=R.v2,A=R.v3,x.positionScreen.x*=v,x.positionScreen.y*=-w,B.positionScreen.x*=v,B.positionScreen.y*=-w,A.positionScreen.x*=v,A.positionScreen.y*=-w,E.addPoint(x.positionScreen.x,x.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),K.instersects(E)){o=0;for(I=R.meshMaterials.length;o<
|
|
|
|
+I;)if(D=R.meshMaterials[o++],D instanceof THREE.MeshFaceMaterial){G=0;for(F=R.faceMaterials.length;G<F;)(D=R.faceMaterials[G++])&&D.opacity!=0&&c(x,B,A,R,D,b)}else D&&D.opacity!=0&&c(x,B,A,R,D,b)}}else if(R instanceof THREE.RenderableFace4&&(x=R.v1,B=R.v2,A=R.v3,y=R.v4,x.positionScreen.x*=v,x.positionScreen.y*=-w,B.positionScreen.x*=v,B.positionScreen.y*=-w,A.positionScreen.x*=v,A.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,E.addPoint(x.positionScreen.x,x.positionScreen.y),E.addPoint(B.positionScreen.x,
|
|
|
|
+B.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),K.instersects(E))){o=0;for(I=R.meshMaterials.length;o<I;)if(D=R.meshMaterials[o++],D instanceof THREE.MeshFaceMaterial){G=0;for(F=R.faceMaterials.length;G<F;)(D=R.faceMaterials[G++])&&D.opacity!=0&&e(x,B,A,y,R,D,b)}else D&&D.opacity!=0&&e(x,B,A,y,R,D,b)}}};
|
|
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",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -218,130 +218,130 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
|
|
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.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,
|
|
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")}};
|
|
"}"].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 c(b,e,c){var f,g,h,k=b.vertices,m=k.length,t=b.colors,o=t.length,p=b.__vertexArray,n=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Z.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,la.copy(g),Z.multiplyVector3(la),u[f]=[la.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=k[u[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=t[u[f][1]],n[h]=color.r,n[h+1]=color.g,
|
|
|
|
-n[h+2]=color.b}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(w)for(f=0;f<o;f++)color=t[f],h=f*3,n[h]=color.r,n[h+1]=color.g,n[h+2]=color.b}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,n,e)}function e(b,e,c,f,g){f.program||fa.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=V&&(j.useProgram(h),
|
|
|
|
-V=h);j.uniformMatrix4fv(k.projectionMatrix,!1,N);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,
|
|
|
|
-o,p=0,n=0,u=0,v,w,y,z,x=ta,C=x.directional.colors,G=x.directional.positions,F=x.point.colors,D=x.point.positions,Z=x.point.distances,B=0,E=0,c=o=z=0;for(t=e.length;c<t;c++)if(o=e[c],v=o.color,w=o.position,y=o.intensity,z=o.distance,o instanceof THREE.AmbientLight)p+=v.r,n+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)z=B*3,C[z]=v.r*y,C[z+1]=v.g*y,C[z+2]=v.b*y,G[z]=w.x,G[z+1]=w.y,G[z+2]=w.z,B+=1;else if(o instanceof THREE.PointLight)o=E*3,F[o]=v.r*y,F[o+1]=v.g*y,F[o+2]=v.b*y,D[o]=w.x,D[o+
|
|
|
|
-1]=w.y,D[o+2]=w.z,Z[E]=z,E+=1;for(c=B*3;c<C.length;c++)C[c]=0;for(c=E*3;c<F.length;c++)F[c]=0;x.point.length=E;x.directional.length=B;x.ambient[0]=p;x.ambient[1]=n;x.ambient[2]=u;c=ta;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,k=b.vertices,m=k.length,n=b.colors,u=n.length,p=b.__vertexArray,o=b.__colorArray,v=b.__sortArray,w=b.__dirtyVertices,x=b.__dirtyColors;if(c.sortParticles){ha.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,ka.copy(g),ha.multiplyVector3(ka),v[f]=[ka.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=k[v[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<u;f++)h=f*3,color=n[v[f][1]],o[h]=color.r,o[h+1]=color.g,
|
|
|
|
+o[h+2]=color.b}else{if(w)for(f=0;f<m;f++)g=k[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<u;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b}if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(x||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,o,e)}function e(b,e,c,f,g){f.program||da.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=V&&(j.useProgram(h),
|
|
|
|
+V=h);j.uniformMatrix4fv(k.projectionMatrix,!1,pa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,
|
|
|
|
+u,p=0,o=0,v=0,w,x,y,A,B=va,E=B.directional.colors,I=B.directional.positions,K=B.point.colors,G=B.point.positions,F=B.point.distances,J=0,H=0,c=u=A=0;for(n=e.length;c<n;c++)if(u=e[c],w=u.color,x=u.position,y=u.intensity,A=u.distance,u instanceof THREE.AmbientLight)p+=w.r,o+=w.g,v+=w.b;else if(u instanceof THREE.DirectionalLight)A=J*3,E[A]=w.r*y,E[A+1]=w.g*y,E[A+2]=w.b*y,I[A]=x.x,I[A+1]=x.y,I[A+2]=x.z,J+=1;else if(u instanceof THREE.PointLight)u=H*3,K[u]=w.r*y,K[u+1]=w.g*y,K[u+2]=w.b*y,G[u]=x.x,G[u+
|
|
|
|
+1]=x.y,G[u+2]=x.z,F[H]=A,H+=1;for(c=J*3;c<E.length;c++)E[c]=0;for(c=H*3;c<K.length;c++)K[c]=0;B.point.length=H;B.directional.length=J;B.ambient[0]=p;B.ambient[1]=o;B.ambient[2]=v;c=va;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
|
|
THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
-if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=va.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof
|
|
|
|
-THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var L in m)if(n=h.uniforms[L])if(t=m[L],p=t.type,c=t.value,p=="i")j.uniform1i(n,c);else if(p=="f")j.uniform1f(n,c);else if(p=="fv1")j.uniform1fv(n,c);else if(p=="fv")j.uniform3fv(n,c);else if(p=="v2")j.uniform2f(n,c.x,c.y);else if(p=="v3")j.uniform3f(n,c.x,c.y,c.z);else if(p=="v4")j.uniform4f(n,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(n,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(n,c),t=t.texture))if(t.image instanceof Array&&t.image.length==
|
|
|
|
-6){if(t.image.length==6){if(t.needsUpdate){if(t.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,t.image[p])}else{t.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,t.image[p]);t.__webglInit=!0}P(j.TEXTURE_CUBE_MAP,t,t.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
|
-null);t.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}}else I(t,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
|
|
|
|
-null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,ka);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),
|
|
|
|
-j.uniformMatrix4fv(k.viewMatrix,!1,ka);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,ka),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),
|
|
|
|
-j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,t=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<t.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],o=-1,
|
|
|
|
-n=0,p=k.morphTargetInfluences,u,v=p.length,f=0;for(k.morphTargetBase!==-1&&(t[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!t[u]&&p[u]>o&&(n=u,o=p[n]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=o;t[n]=1;o=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=
|
|
|
|
|
|
+if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=xa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof
|
|
|
|
+THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var ha in m)if(o=h.uniforms[ha])if(n=m[ha],p=n.type,c=n.value,p=="i")j.uniform1i(o,c);else if(p=="f")j.uniform1f(o,c);else if(p=="fv1")j.uniform1fv(o,c);else if(p=="fv")j.uniform3fv(o,c);else if(p=="v2")j.uniform2f(o,c.x,c.y);else if(p=="v3")j.uniform3f(o,c.x,c.y,c.z);else if(p=="v4")j.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(o,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
|
|
|
|
+6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}N(j.TEXTURE_CUBE_MAP,n,n.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
|
+null);n.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else M(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
|
|
|
|
+null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,ma);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),
|
|
|
|
+j.uniformMatrix4fv(k.viewMatrix,!1,ma);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,ma),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),
|
|
|
|
+j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],u=-1,
|
|
|
|
+o=0,p=k.morphTargetInfluences,v,w=p.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(v=0;v<w;v++)!n[v]&&p[v]>u&&(o=v,u=p[o]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=u;n[o]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=
|
|
0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
|
|
h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
|
|
j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,
|
|
j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,
|
|
-j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),fa.data.vertices+=h.__webglFaceCount,fa.data.faces+=h.__webglFaceCount/3,fa.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),fa.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),fa.data.drawCalls++):k instanceof
|
|
|
|
-THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),fa.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,h,k,m,t,p,o,n,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],h=c[u+2],k=c[u+3],t=c[u+4],o=c[u+5],m=c[u+6],p=c[u+7],n=c[u+8],f=(f+k+m)/3,g=(g+t+p)/3,h=(h+o+n)/3,c[u]=f,c[u+1]=g,c[u+2]=h,c[u+3]=f,c[u+4]=g,c[u+5]=h,c[u+6]=f,c[u+7]=g,c[u+8]=h}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
|
|
|
|
-0,b.count);b.count=0}function k(b){if(ea!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ea=b.doubleSided;if(Y!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),Y=b.flipSided}function h(b){ca!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ca=b)}function m(b,e,c){ha!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ha=b);if(b&&(na!=e||ia!=c))j.polygonOffset(e,c),na=e,ia=c}function o(b){ja[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,
|
|
|
|
-b.n44-b.n14);ja[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ja[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ja[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ja[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ja[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ja[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,
|
|
|
|
-b.scale.z)),f=0;f<6;f++)if(b=ja[f].x*e.n14+ja[f].y*e.n24+ja[f].z*e.n34+ja[f].w,b<=c)return!1;return!0}function n(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?n(h,c):n(g,c)}function u(b){var e,c,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=
|
|
|
|
-j.materials.length;e<c;e++)(g=j.materials[e])&&(g.transparent?n(m,g):n(k,g))}else(g=e)&&(g.transparent?n(m,g):n(k,g))}function v(b,e){return e.z-b.z}function w(b){j.enable(j.POLYGON_OFFSET_FILL);j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,g=b.lights,h=[],k,m,t,p,o,n=b.__webglShadowVolumes.length;
|
|
|
|
-for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(o=0;o<n;o++)f=b.__webglShadowVolumes[o].object,k=b.__webglShadowVolumes[o].buffer,m=f.materials[0],m.program||fa.initMaterial(m,g,void 0,f),m=m.program,t=m.uniforms,p=m.attributes,V!==m&&(j.useProgram(m),V=m,j.uniformMatrix4fv(t.projectionMatrix,!1,N),j.uniformMatrix4fv(t.viewMatrix,!1,ka),j.uniform3fv(t.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),
|
|
|
|
-j.uniformMatrix4fv(t.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(p.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(p.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);
|
|
|
|
-j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);ca=T=-1;V=S.program;j.useProgram(S.program);j.uniformMatrix4fv(S.projectionLocation,!1,N);j.uniform1f(S.darknessLocation,S.darkness);j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.vertexAttribPointer(S.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(S.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,S.elementBuffer);
|
|
|
|
-j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(O)}function C(b,e){var c,f,g;c=R.attributes;var h=R.uniforms,k=W/X,m,t=[],o=X*0.5,p=W*0.5,n=!0;j.useProgram(R.program);V=R.program;ca=T=-1;Ca||(j.enableVertexAttribArray(R.attributes.position),j.enableVertexAttribArray(R.attributes.uv),Ca=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,
|
|
|
|
-0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.uniformMatrix4fv(h.projectionMatrix,!1,N);j.activeTexture(j.TEXTURE0);j.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],
|
|
|
|
-g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(j.uniform1i(h.useScreenCoordinates,1),j.uniform3f(h.screenPosition,(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(j.uniform1i(h.useScreenCoordinates,0),j.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),j.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?W:1),t[0]=m*k*g.scale.x,t[1]=m*g.scale.y,j.uniform2f(h.uvScale,g.uvScale.x,
|
|
|
|
-g.uvScale.y),j.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),j.uniform2f(h.alignment,g.alignment.x,g.alignment.y),j.uniform1f(h.opacity,g.opacity),j.uniform1f(h.rotation,g.rotation),j.uniform2fv(h.scale,t),g.mergeWith3D&&!n?(j.enable(j.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(j.disable(j.DEPTH_TEST),n=!1),D(g.blending),I(g.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(O)}function z(b,e){var c,f,g=b.__webglLensFlares.length,h,k,m,t=
|
|
|
|
-new THREE.Vector3,o=W/X,p=X*0.5,n=W*0.5,u=16/W,v=[u*o,u],w=[1,1,0],y=[1,1],z=Q.uniforms;c=Q.attributes;j.useProgram(Q.program);V=Q.program;ca=T=-1;oa||(j.enableVertexAttribArray(Q.attributes.vertex),j.enableVertexAttribArray(Q.attributes.uv),oa=!0);j.uniform1i(z.occlusionMap,0);j.uniform1i(z.map,1);j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.disable(j.CULL_FACE);
|
|
|
|
-j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,Q.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,t.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(t),e.projectionMatrix.multiplyVector3(t),w[0]=t.x,w[1]=t.y,w[2]=t.z,y[0]=w[0]*p+p,y[1]=w[1]*n+n,Q.hasVertexTexture||y[0]>0&&y[0]<X&&y[1]>0&&y[1]<W){j.bindTexture(j.TEXTURE_2D,Q.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-
|
|
|
|
-8,y[1]-8,16,16,0);j.uniform1i(z.renderType,0);j.uniform2fv(z.scale,v);j.uniform3fv(z.screenPosition,w);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,Q.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(z.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,Q.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=
|
|
|
|
-w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(z.renderType,2);j.enable(j.BLEND);h=0;for(k=c.lensFlares.length;h<k;h++)if(m=c.lensFlares[h],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/W,v[0]=u*o,v[1]=u,j.uniform3fv(z.screenPosition,w),j.uniform2fv(z.scale,v),j.uniform1f(z.rotation,m.rotation),j.uniform1f(z.opacity,m.opacity),D(m.blending),I(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
|
|
|
|
-j.depthMask(O)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function G(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];a:{for(var k=h=void 0,m=void 0,t=void 0,o=void 0,o=g.__materials,k=0,m=o.length;k<m;k++)if(t=o[k],t.attributes)for(h in t.attributes)if(t.attributes[h].needsUpdate){h=!0;
|
|
|
|
-break a}h=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h)if(h=g,k=b,m=j.DYNAMIC_DRAW,h.__inittedArrays){var p=o=t=void 0,n=void 0,u=p=void 0,v=void 0,w=void 0,y=void 0,z=void 0,x=void 0,C=void 0,G=void 0,F=void 0,D=void 0,B=void 0,Z=void 0,L=void 0,E=n=y=n=w=v=void 0,N=void 0,A=N=E=v=void 0,I=void 0,H=A=N=E=p=p=u=y=n=A=N=E=I=A=N=E=I=A=N=E=void 0,K=0,J=0,O=0,R=0,ka=0,Q=0,P=0,la=0,T=0,M=0,S=0,N=E=0,U=h.__vertexArray,
|
|
|
|
-da=h.__uvArray,fa=h.__uv2Array,ea=h.__normalArray,V=h.__tangentArray,$=h.__colorArray,W=h.__skinVertexAArray,X=h.__skinVertexBArray,Y=h.__skinIndexArray,ca=h.__skinWeightArray,ja=h.__morphTargetsArrays,ta=h.__webglCustomAttributes,A=void 0,ga=h.__faceArray,ha=h.__lineArray,na=h.__needsSmoothNormals,x=h.__vertexColorType,z=h.__uvType,C=h.__normalType,ia=k.geometry,va=ia.__dirtyVertices,ua=ia.__dirtyElements,oa=ia.__dirtyUvs,qa=ia.__dirtyNormals,Ba=ia.__dirtyTangents,wa=ia.__dirtyColors,za=ia.__dirtyMorphTargets,
|
|
|
|
-ya=ia.vertices,Ca=h.faces,Za=ia.faces,Xa=ia.faceVertexUvs[0],Ya=ia.faceVertexUvs[1],Ka=ia.skinVerticesA,La=ia.skinVerticesB,Ma=ia.skinIndices,Fa=ia.skinWeights,Ia=k instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Da=ia.morphTargets;if(ta)for(H in ta)ta[H].offset=0,ta[H].offsetSrc=0;t=0;for(o=Ca.length;t<o;t++)if(p=Ca[t],n=Za[p],Xa&&(G=Xa[p]),Ya&&(F=Ya[p]),p=n.vertexNormals,u=n.normal,v=n.vertexColors,w=n.color,y=n.vertexTangents,n instanceof THREE.Face3){if(va)D=ya[n.a].position,B=ya[n.b].position,
|
|
|
|
-Z=ya[n.c].position,U[J]=D.x,U[J+1]=D.y,U[J+2]=D.z,U[J+3]=B.x,U[J+4]=B.y,U[J+5]=B.z,U[J+6]=Z.x,U[J+7]=Z.y,U[J+8]=Z.z,J+=9;if(ta)for(H in ta)if(A=ta[H],A.__original.needsUpdate)E=A.offset,N=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E+0]=A.value[n.a],A.array[E+1]=A.value[n.b],A.array[E+2]=A.value[n.c]):A.boundTo==="faces"?(A.array[E+0]=A.value[N],A.array[E+1]=A.value[N],A.array[E+2]=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E+0]=A.value[N+0],A.array[E+
|
|
|
|
-1]=A.value[N+1],A.array[E+2]=A.value[N+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(D=A.value[n.a],B=A.value[n.b],Z=A.value[n.c]):A.boundTo==="faces"?(D=A.value[N],B=A.value[N],Z=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(D=A.value[N+0],B=A.value[N+1],Z=A.value[N+2],A.offsetSrc+=3),A.size===2?(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=B.x,A.array[E+3]=B.y,A.array[E+4]=Z.x,A.array[E+5]=Z.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[E+0]=D.r,A.array[E+
|
|
|
|
-1]=D.g,A.array[E+2]=D.b,A.array[E+3]=B.r,A.array[E+4]=B.g,A.array[E+5]=B.b,A.array[E+6]=Z.r,A.array[E+7]=Z.g,A.array[E+8]=Z.b):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=B.x,A.array[E+4]=B.y,A.array[E+5]=B.z,A.array[E+6]=Z.x,A.array[E+7]=Z.y,A.array[E+8]=Z.z),A.offset+=9):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=B.x,A.array[E+5]=B.y,A.array[E+6]=B.z,A.array[E+7]=B.w,A.array[E+8]=Z.x,A.array[E+9]=Z.y,A.array[E+10]=Z.z,A.array[E+11]=Z.w,
|
|
|
|
-A.offset+=12));if(za){E=0;for(N=Da.length;E<N;E++)D=Da[E].vertices[n.a].position,B=Da[E].vertices[n.b].position,Z=Da[E].vertices[n.c].position,A=ja[E],A[S+0]=D.x,A[S+1]=D.y,A[S+2]=D.z,A[S+3]=B.x,A[S+4]=B.y,A[S+5]=B.z,A[S+6]=Z.x,A[S+7]=Z.y,A[S+8]=Z.z;S+=9}if(Fa.length)E=Fa[n.a],N=Fa[n.b],A=Fa[n.c],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=N.x,ca[M+5]=N.y,ca[M+6]=N.z,ca[M+7]=N.w,ca[M+8]=A.x,ca[M+9]=A.y,ca[M+10]=A.z,ca[M+11]=A.w,E=Ma[n.a],N=Ma[n.b],A=Ma[n.c],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,
|
|
|
|
-Y[M+3]=E.w,Y[M+4]=N.x,Y[M+5]=N.y,Y[M+6]=N.z,Y[M+7]=N.w,Y[M+8]=A.x,Y[M+9]=A.y,Y[M+10]=A.z,Y[M+11]=A.w,E=Ka[n.a],N=Ka[n.b],A=Ka[n.c],W[M]=E.x,W[M+1]=E.y,W[M+2]=E.z,W[M+3]=1,W[M+4]=N.x,W[M+5]=N.y,W[M+6]=N.z,W[M+7]=1,W[M+8]=A.x,W[M+9]=A.y,W[M+10]=A.z,W[M+11]=1,E=La[n.a],N=La[n.b],A=La[n.c],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=1,X[M+4]=N.x,X[M+5]=N.y,X[M+6]=N.z,X[M+7]=1,X[M+8]=A.x,X[M+9]=A.y,X[M+10]=A.z,X[M+11]=1,M+=12;if(wa&&x)v.length==3&&x==THREE.VertexColors?(n=v[0],E=v[1],N=v[2]):N=E=n=w,$[T]=n.r,
|
|
|
|
-$[T+1]=n.g,$[T+2]=n.b,$[T+3]=E.r,$[T+4]=E.g,$[T+5]=E.b,$[T+6]=N.r,$[T+7]=N.g,$[T+8]=N.b,T+=9;if(Ba&&ia.hasTangents)v=y[0],w=y[1],n=y[2],V[P]=v.x,V[P+1]=v.y,V[P+2]=v.z,V[P+3]=v.w,V[P+4]=w.x,V[P+5]=w.y,V[P+6]=w.z,V[P+7]=w.w,V[P+8]=n.x,V[P+9]=n.y,V[P+10]=n.z,V[P+11]=n.w,P+=12;if(qa&&C)if(p.length==3&&na)for(y=0;y<3;y++)u=p[y],ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;else for(y=0;y<3;y++)ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;if(oa&&G!==void 0&&z)for(y=0;y<3;y++)p=G[y],da[O]=p.u,da[O+1]=p.v,O+=2;if(oa&&
|
|
|
|
-F!==void 0&&z)for(y=0;y<3;y++)p=F[y],fa[R]=p.u,fa[R+1]=p.v,R+=2;ua&&(ga[ka]=K,ga[ka+1]=K+1,ga[ka+2]=K+2,ka+=3,ha[la]=K,ha[la+1]=K+1,ha[la+2]=K,ha[la+3]=K+2,ha[la+4]=K+1,ha[la+5]=K+2,la+=6,K+=3)}else if(n instanceof THREE.Face4){if(va)D=ya[n.a].position,B=ya[n.b].position,Z=ya[n.c].position,L=ya[n.d].position,U[J]=D.x,U[J+1]=D.y,U[J+2]=D.z,U[J+3]=B.x,U[J+4]=B.y,U[J+5]=B.z,U[J+6]=Z.x,U[J+7]=Z.y,U[J+8]=Z.z,U[J+9]=L.x,U[J+10]=L.y,U[J+11]=L.z,J+=12;if(ta)for(H in ta)if(A=ta[H],A.__original.needsUpdate)E=
|
|
|
|
-A.offset,N=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E+0]=A.value[n.a],A.array[E+1]=A.value[n.b],A.array[E+2]=A.value[n.c],A.array[E+3]=A.value[n.d]):A.boundTo==="faces"?(A.array[E+0]=A.value[N],A.array[E+1]=A.value[N],A.array[E+2]=A.value[N],A.array[E+3]=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E+0]=A.value[N+0],A.array[E+1]=A.value[N+1],A.array[E+2]=A.value[N+2],A.array[E+3]=A.value[N+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo===
|
|
|
|
-"vertices"?(D=A.value[n.a],B=A.value[n.b],Z=A.value[n.c],L=A.value[n.d]):A.boundTo==="faces"?(D=A.value[N],B=A.value[N],Z=A.value[N],L=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(D=A.value[N+0],B=A.value[N+1],Z=A.value[N+2],L=A.value[N+3],A.offsetSrc+=4),A.size===2?(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=B.x,A.array[E+3]=B.y,A.array[E+4]=Z.x,A.array[E+5]=Z.y,A.array[E+6]=L.x,A.array[E+7]=L.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E+0]=D.r,A.array[E+1]=D.g,A.array[E+2]=D.b,
|
|
|
|
-A.array[E+3]=B.r,A.array[E+4]=B.g,A.array[E+5]=B.b,A.array[E+6]=Z.r,A.array[E+7]=Z.g,A.array[E+8]=Z.b,A.array[E+9]=L.r,A.array[E+10]=L.g,A.array[E+11]=L.b):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=B.x,A.array[E+4]=B.y,A.array[E+5]=B.z,A.array[E+6]=Z.x,A.array[E+7]=Z.y,A.array[E+8]=Z.z,A.array[E+9]=L.x,A.array[E+10]=L.y,A.array[E+11]=L.z),A.offset+=12):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=B.x,A.array[E+5]=B.y,A.array[E+6]=B.z,A.array[E+
|
|
|
|
-7]=B.w,A.array[E+8]=Z.x,A.array[E+9]=Z.y,A.array[E+10]=Z.z,A.array[E+11]=Z.w,A.array[E+12]=L.x,A.array[E+13]=L.y,A.array[E+14]=L.z,A.array[E+15]=L.w,A.offset+=16));if(za){E=0;for(N=Da.length;E<N;E++)D=Da[E].vertices[n.a].position,B=Da[E].vertices[n.b].position,Z=Da[E].vertices[n.c].position,L=Da[E].vertices[n.d].position,A=ja[E],A[S+0]=D.x,A[S+1]=D.y,A[S+2]=D.z,A[S+3]=B.x,A[S+4]=B.y,A[S+5]=B.z,A[S+6]=Z.x,A[S+7]=Z.y,A[S+8]=Z.z,A[S+9]=L.x,A[S+10]=L.y,A[S+11]=L.z;S+=12}if(Fa.length)E=Fa[n.a],N=Fa[n.b],
|
|
|
|
-A=Fa[n.c],I=Fa[n.d],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=N.x,ca[M+5]=N.y,ca[M+6]=N.z,ca[M+7]=N.w,ca[M+8]=A.x,ca[M+9]=A.y,ca[M+10]=A.z,ca[M+11]=A.w,ca[M+12]=I.x,ca[M+13]=I.y,ca[M+14]=I.z,ca[M+15]=I.w,E=Ma[n.a],N=Ma[n.b],A=Ma[n.c],I=Ma[n.d],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,Y[M+3]=E.w,Y[M+4]=N.x,Y[M+5]=N.y,Y[M+6]=N.z,Y[M+7]=N.w,Y[M+8]=A.x,Y[M+9]=A.y,Y[M+10]=A.z,Y[M+11]=A.w,Y[M+12]=I.x,Y[M+13]=I.y,Y[M+14]=I.z,Y[M+15]=I.w,E=Ka[n.a],N=Ka[n.b],A=Ka[n.c],I=Ka[n.d],W[M]=E.x,W[M+1]=E.y,W[M+2]=
|
|
|
|
-E.z,W[M+3]=1,W[M+4]=N.x,W[M+5]=N.y,W[M+6]=N.z,W[M+7]=1,W[M+8]=A.x,W[M+9]=A.y,W[M+10]=A.z,W[M+11]=1,W[M+12]=I.x,W[M+13]=I.y,W[M+14]=I.z,W[M+15]=1,E=La[n.a],N=La[n.b],A=La[n.c],n=La[n.d],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=1,X[M+4]=N.x,X[M+5]=N.y,X[M+6]=N.z,X[M+7]=1,X[M+8]=A.x,X[M+9]=A.y,X[M+10]=A.z,X[M+11]=1,X[M+12]=n.x,X[M+13]=n.y,X[M+14]=n.z,X[M+15]=1,M+=16;if(wa&&x)v.length==4&&x==THREE.VertexColors?(n=v[0],E=v[1],N=v[2],v=v[3]):v=N=E=n=w,$[T]=n.r,$[T+1]=n.g,$[T+2]=n.b,$[T+3]=E.r,$[T+4]=E.g,$[T+
|
|
|
|
-5]=E.b,$[T+6]=N.r,$[T+7]=N.g,$[T+8]=N.b,$[T+9]=v.r,$[T+10]=v.g,$[T+11]=v.b,T+=12;if(Ba&&ia.hasTangents)v=y[0],w=y[1],n=y[2],y=y[3],V[P]=v.x,V[P+1]=v.y,V[P+2]=v.z,V[P+3]=v.w,V[P+4]=w.x,V[P+5]=w.y,V[P+6]=w.z,V[P+7]=w.w,V[P+8]=n.x,V[P+9]=n.y,V[P+10]=n.z,V[P+11]=n.w,V[P+12]=y.x,V[P+13]=y.y,V[P+14]=y.z,V[P+15]=y.w,P+=16;if(qa&&C)if(p.length==4&&na)for(y=0;y<4;y++)u=p[y],ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;else for(y=0;y<4;y++)ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;if(oa&&G!==void 0&&z)for(y=0;y<4;y++)p=
|
|
|
|
-G[y],da[O]=p.u,da[O+1]=p.v,O+=2;if(oa&&F!==void 0&&z)for(y=0;y<4;y++)p=F[y],fa[R]=p.u,fa[R+1]=p.v,R+=2;ua&&(ga[ka]=K,ga[ka+1]=K+1,ga[ka+2]=K+3,ga[ka+3]=K+1,ga[ka+4]=K+2,ga[ka+5]=K+3,ka+=6,ha[la]=K,ha[la+1]=K+1,ha[la+2]=K,ha[la+3]=K+3,ha[la+4]=K+1,ha[la+5]=K+2,ha[la+6]=K+2,ha[la+7]=K+3,la+=8,K+=4)}if(Ia){t=0;for(o=Ia.length;t<o;t++)ga[ka]=Ia[t].a,ga[ka+1]=Ia[t].b,ga[ka+2]=Ia[t].c,ga[ka+3]=Ia[t].a,ga[ka+4]=Ia[t].c,ga[ka+5]=Ia[t].d,ka+=6}va&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
-U,m));if(ta)for(H in ta)A=ta[H],A.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,A.buffer),j.bufferData(j.ARRAY_BUFFER,A.array,m));if(za){E=0;for(N=Da.length;E<N;E++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),j.bufferData(j.ARRAY_BUFFER,ja[E],m)}wa&&T>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));qa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m));Ba&&ia.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
-h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,V,m));oa&&O>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));oa&&R>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,fa,m));ua&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),
|
|
|
|
-j.bufferData(j.ARRAY_BUFFER,W,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,
|
|
|
|
-delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var sa;g=g.__materials;f=0;for(b=g.length;f<b;f++)if(e=g[f],e.attributes)for(sa in e.attributes)e.attributes[sa].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;o=sa.vertices;
|
|
|
|
-g=sa.colors;z=o.length;h=g.length;x=sa.__vertexArray;k=sa.__colorArray;C=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<z;m++)t=o[m].position,e=m*3,x[e]=t.x,x[e+1]=t.y,x[e+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,x,b)}if(C){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=
|
|
|
|
-b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;o=sa.vertices;g=sa.colors;z=o.length;h=g.length;x=sa.__vertexArray;k=sa.__colorArray;C=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<z;m++)t=o[m].position,e=m*3,x[e]=t.x,x[e+1]=t.y,x[e+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,x,b)}if(C){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
-k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function x(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function B(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,h,j,k,m,n,t={},p=b.morphTargets!==void 0?b.morphTargets.length:
|
|
|
|
-0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=e(k),t[m]==void 0&&(t[m]={hash:m,counter:0}),n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(t[m].counter+=1,n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),
|
|
|
|
-b.geometryGroups[n].vertices+=j}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function D(b){if(b!=T){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,
|
|
|
|
-j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}T=b}}function P(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,H(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,H(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,H(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,H(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,
|
|
|
|
-j.TEXTURE_MAG_FILTER,U(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,U(e.minFilter)))}function I(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),P(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+
|
|
|
|
-e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function L(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,H(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,H(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,
|
|
|
|
-H(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,H(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,H(b.format),b.width,b.height,0,H(b.format),H(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
|
|
|
|
-j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
|
|
-c=X,b=W);e!=$&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(J,ga,c,b),$=e)}function K(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
|
|
|
|
-function H(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
|
|
|
|
+j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),da.data.vertices+=h.__webglFaceCount,da.data.faces+=h.__webglFaceCount/3,da.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),da.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),da.data.drawCalls++):k instanceof
|
|
|
|
+THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),da.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,n,p,u,o,v,w=b.count*3;for(v=0;v<w;v+=9)c=b.normalArray,f=c[v],h=c[v+1],g=c[v+2],k=c[v+3],n=c[v+4],u=c[v+5],m=c[v+6],p=c[v+7],o=c[v+8],f=(f+k+m)/3,h=(h+n+p)/3,g=(g+u+o)/3,c[v]=f,c[v+1]=h,c[v+2]=g,c[v+3]=f,c[v+4]=h,c[v+5]=g,c[v+6]=f,c[v+7]=h,c[v+8]=g}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
|
|
|
|
+0,b.count);b.count=0}function h(b){if(fa!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),fa=b.doubleSided;if(aa!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),aa=b.flipSided}function k(b){ea!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ea=b)}function m(b,e,c){ia!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ia=b);if(b&&(oa!=e||ja!=c))j.polygonOffset(e,c),oa=e,ja=c}function n(b){la[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,
|
|
|
|
+b.n44-b.n14);la[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);la[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);la[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);la[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);la[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=la[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,
|
|
|
|
+b.scale.z)),f=0;f<6;f++)if(b=la[f].x*e.n14+la[f].y*e.n24+la[f].z*e.n34+la[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function u(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=
|
|
|
|
+j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function w(b,e){return e.z-b.z}function x(b){j.enable(j.POLYGON_OFFSET_FILL);j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],k,m,n,p,u,o=b.__webglShadowVolumes.length;
|
|
|
|
+for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(u=0;u<o;u++)f=b.__webglShadowVolumes[u].object,k=b.__webglShadowVolumes[u].buffer,m=f.materials[0],m.program||da.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,V!==m&&(j.useProgram(m),V=m,j.uniformMatrix4fv(n.projectionMatrix,!1,pa),j.uniformMatrix4fv(n.viewMatrix,!1,ma),j.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),
|
|
|
|
+j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(p.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(p.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);
|
|
|
|
+j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);ea=X=-1;V=T.program;j.useProgram(T.program);j.uniformMatrix4fv(T.projectionLocation,!1,pa);j.uniform1f(T.darknessLocation,T.darkness);j.bindBuffer(j.ARRAY_BUFFER,T.vertexBuffer);j.vertexAttribPointer(T.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(T.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,T.elementBuffer);
|
|
|
|
+j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(L)}function B(b,e){var c,f,h;c=O.attributes;var g=O.uniforms,k=Y/Z,m,n=[],p=Z*0.5,u=Y*0.5,o=!0;j.useProgram(O.program);V=O.program;ea=X=-1;Ea||(j.enableVertexAttribArray(O.attributes.position),j.enableVertexAttribArray(O.attributes.uv),Ea=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,
|
|
|
|
+0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,!1,pa);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],
|
|
|
|
+h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,(h.position.x-p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Y:1),n[0]=m*k*h.scale.x,n[1]=m*h.scale.y,j.uniform2f(g.uvScale,h.uvScale.x,
|
|
|
|
+h.uvScale.y),j.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),j.uniform2f(g.alignment,h.alignment.x,h.alignment.y),j.uniform1f(g.opacity,h.opacity),j.uniform1f(g.rotation,h.rotation),j.uniform2fv(g.scale,n),h.mergeWith3D&&!o?(j.enable(j.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(j.disable(j.DEPTH_TEST),o=!1),G(h.blending),M(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(L)}function A(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,n=
|
|
|
|
+new THREE.Vector3,p=Y/Z,u=Z*0.5,o=Y*0.5,v=16/Y,w=[v*p,v],x=[1,1,0],y=[1,1],A=S.uniforms;c=S.attributes;j.useProgram(S.program);V=S.program;ea=X=-1;qa||(j.enableVertexAttribArray(S.attributes.vertex),j.enableVertexAttribArray(S.attributes.uv),qa=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,S.elementBuffer);j.disable(j.CULL_FACE);
|
|
|
|
+j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,S.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),x[0]=n.x,x[1]=n.y,x[2]=n.z,y[0]=x[0]*u+u,y[1]=x[1]*o+o,S.hasVertexTexture||y[0]>0&&y[0]<Z&&y[1]>0&&y[1]<Y){j.bindTexture(j.TEXTURE_2D,S.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-
|
|
|
|
+8,y[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,w);j.uniform3fv(A.screenPosition,x);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,S.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,S.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=
|
|
|
|
+x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);g=0;for(k=c.lensFlares.length;g<k;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,v=m.size*m.scale/Y,w[0]=v*p,w[1]=v,j.uniform3fv(A.screenPosition,x),j.uniform2fv(A.scale,w),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),G(m.blending),M(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
|
|
|
|
+j.depthMask(L)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function K(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var k=g=void 0,m=void 0,n=void 0,p=void 0,p=h.__materials,k=0,m=p.length;k<m;k++)if(n=p[k],n.attributes)for(g in n.attributes)if(n.attributes[g].needsUpdate){g=!0;
|
|
|
|
+break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,k=b,m=j.DYNAMIC_DRAW,g.__inittedArrays){var u=p=n=void 0,o=void 0,v=u=void 0,w=void 0,x=void 0,y=void 0,A=void 0,B=void 0,E=void 0,I=void 0,K=void 0,G=void 0,J=void 0,F=void 0,ha=void 0,H=o=y=o=x=w=void 0,D=void 0,C=D=H=w=void 0,Q=void 0,pa=C=D=H=u=u=v=y=o=C=D=H=Q=C=D=H=Q=C=D=H=void 0,M=0,L=0,R=0,U=0,O=0,ma=0,N=0,S=0,ka=0,P=0,X=0,D=H=0,T=g.__vertexArray,
|
|
|
|
+ca=g.__uvArray,da=g.__uv2Array,fa=g.__normalArray,W=g.__tangentArray,V=g.__colorArray,aa=g.__skinVertexAArray,Y=g.__skinVertexBArray,Z=g.__skinIndexArray,ea=g.__skinWeightArray,la=g.__morphTargetsArrays,va=g.__webglCustomAttributes,C=void 0,ga=g.__faceArray,ia=g.__lineArray,oa=g.__needsSmoothNormals,B=g.__vertexColorType,A=g.__uvType,E=g.__normalType,ja=k.geometry,xa=ja.__dirtyVertices,wa=ja.__dirtyElements,qa=ja.__dirtyUvs,sa=ja.__dirtyNormals,Da=ja.__dirtyTangents,ya=ja.__dirtyColors,Ba=ja.__dirtyMorphTargets,
|
|
|
|
+Aa=ja.vertices,Ea=g.faces,ab=ja.faces,Za=ja.faceVertexUvs[0],$a=ja.faceVertexUvs[1],Ma=ja.skinVerticesA,Na=ja.skinVerticesB,Oa=ja.skinIndices,Ha=ja.skinWeights,Ka=k instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Fa=ja.morphTargets;if(va)for(pa in va)va[pa].offset=0,va[pa].offsetSrc=0;n=0;for(p=Ea.length;n<p;n++)if(u=Ea[n],o=ab[u],Za&&(I=Za[u]),$a&&(K=$a[u]),u=o.vertexNormals,v=o.normal,w=o.vertexColors,x=o.color,y=o.vertexTangents,o instanceof THREE.Face3){if(xa)G=Aa[o.a].position,J=Aa[o.b].position,
|
|
|
|
+F=Aa[o.c].position,T[L]=G.x,T[L+1]=G.y,T[L+2]=G.z,T[L+3]=J.x,T[L+4]=J.y,T[L+5]=J.z,T[L+6]=F.x,T[L+7]=F.y,T[L+8]=F.z,L+=9;if(va)for(pa in va)if(C=va[pa],C.__original.needsUpdate)H=C.offset,D=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H+0]=C.value[o.a],C.array[H+1]=C.value[o.b],C.array[H+2]=C.value[o.c]):C.boundTo==="faces"?(C.array[H+0]=C.value[D],C.array[H+1]=C.value[D],C.array[H+2]=C.value[D],C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H+0]=C.value[D+0],C.array[H+
|
|
|
|
+1]=C.value[D+1],C.array[H+2]=C.value[D+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(G=C.value[o.a],J=C.value[o.b],F=C.value[o.c]):C.boundTo==="faces"?(G=C.value[D],J=C.value[D],F=C.value[D],C.offsetSrc++):C.boundTo==="faceVertices"&&(G=C.value[D+0],J=C.value[D+1],F=C.value[D+2],C.offsetSrc+=3),C.size===2?(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=J.x,C.array[H+3]=J.y,C.array[H+4]=F.x,C.array[H+5]=F.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[H+0]=G.r,C.array[H+
|
|
|
|
+1]=G.g,C.array[H+2]=G.b,C.array[H+3]=J.r,C.array[H+4]=J.g,C.array[H+5]=J.b,C.array[H+6]=F.r,C.array[H+7]=F.g,C.array[H+8]=F.b):(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=G.z,C.array[H+3]=J.x,C.array[H+4]=J.y,C.array[H+5]=J.z,C.array[H+6]=F.x,C.array[H+7]=F.y,C.array[H+8]=F.z),C.offset+=9):(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=G.z,C.array[H+3]=G.w,C.array[H+4]=J.x,C.array[H+5]=J.y,C.array[H+6]=J.z,C.array[H+7]=J.w,C.array[H+8]=F.x,C.array[H+9]=F.y,C.array[H+10]=F.z,C.array[H+11]=F.w,
|
|
|
|
+C.offset+=12));if(Ba){H=0;for(D=Fa.length;H<D;H++)G=Fa[H].vertices[o.a].position,J=Fa[H].vertices[o.b].position,F=Fa[H].vertices[o.c].position,C=la[H],C[X+0]=G.x,C[X+1]=G.y,C[X+2]=G.z,C[X+3]=J.x,C[X+4]=J.y,C[X+5]=J.z,C[X+6]=F.x,C[X+7]=F.y,C[X+8]=F.z;X+=9}if(Ha.length)H=Ha[o.a],D=Ha[o.b],C=Ha[o.c],ea[P]=H.x,ea[P+1]=H.y,ea[P+2]=H.z,ea[P+3]=H.w,ea[P+4]=D.x,ea[P+5]=D.y,ea[P+6]=D.z,ea[P+7]=D.w,ea[P+8]=C.x,ea[P+9]=C.y,ea[P+10]=C.z,ea[P+11]=C.w,H=Oa[o.a],D=Oa[o.b],C=Oa[o.c],Z[P]=H.x,Z[P+1]=H.y,Z[P+2]=H.z,
|
|
|
|
+Z[P+3]=H.w,Z[P+4]=D.x,Z[P+5]=D.y,Z[P+6]=D.z,Z[P+7]=D.w,Z[P+8]=C.x,Z[P+9]=C.y,Z[P+10]=C.z,Z[P+11]=C.w,H=Ma[o.a],D=Ma[o.b],C=Ma[o.c],aa[P]=H.x,aa[P+1]=H.y,aa[P+2]=H.z,aa[P+3]=1,aa[P+4]=D.x,aa[P+5]=D.y,aa[P+6]=D.z,aa[P+7]=1,aa[P+8]=C.x,aa[P+9]=C.y,aa[P+10]=C.z,aa[P+11]=1,H=Na[o.a],D=Na[o.b],C=Na[o.c],Y[P]=H.x,Y[P+1]=H.y,Y[P+2]=H.z,Y[P+3]=1,Y[P+4]=D.x,Y[P+5]=D.y,Y[P+6]=D.z,Y[P+7]=1,Y[P+8]=C.x,Y[P+9]=C.y,Y[P+10]=C.z,Y[P+11]=1,P+=12;if(ya&&B)w.length==3&&B==THREE.VertexColors?(o=w[0],H=w[1],D=w[2]):D=H=
|
|
|
|
+o=x,V[ka]=o.r,V[ka+1]=o.g,V[ka+2]=o.b,V[ka+3]=H.r,V[ka+4]=H.g,V[ka+5]=H.b,V[ka+6]=D.r,V[ka+7]=D.g,V[ka+8]=D.b,ka+=9;if(Da&&ja.hasTangents)w=y[0],x=y[1],o=y[2],W[N]=w.x,W[N+1]=w.y,W[N+2]=w.z,W[N+3]=w.w,W[N+4]=x.x,W[N+5]=x.y,W[N+6]=x.z,W[N+7]=x.w,W[N+8]=o.x,W[N+9]=o.y,W[N+10]=o.z,W[N+11]=o.w,N+=12;if(sa&&E)if(u.length==3&&oa)for(y=0;y<3;y++)v=u[y],fa[ma]=v.x,fa[ma+1]=v.y,fa[ma+2]=v.z,ma+=3;else for(y=0;y<3;y++)fa[ma]=v.x,fa[ma+1]=v.y,fa[ma+2]=v.z,ma+=3;if(qa&&I!==void 0&&A)for(y=0;y<3;y++)u=I[y],ca[R]=
|
|
|
|
+u.u,ca[R+1]=u.v,R+=2;if(qa&&K!==void 0&&A)for(y=0;y<3;y++)u=K[y],da[U]=u.u,da[U+1]=u.v,U+=2;wa&&(ga[O]=M,ga[O+1]=M+1,ga[O+2]=M+2,O+=3,ia[S]=M,ia[S+1]=M+1,ia[S+2]=M,ia[S+3]=M+2,ia[S+4]=M+1,ia[S+5]=M+2,S+=6,M+=3)}else if(o instanceof THREE.Face4){if(xa)G=Aa[o.a].position,J=Aa[o.b].position,F=Aa[o.c].position,ha=Aa[o.d].position,T[L]=G.x,T[L+1]=G.y,T[L+2]=G.z,T[L+3]=J.x,T[L+4]=J.y,T[L+5]=J.z,T[L+6]=F.x,T[L+7]=F.y,T[L+8]=F.z,T[L+9]=ha.x,T[L+10]=ha.y,T[L+11]=ha.z,L+=12;if(va)for(pa in va)if(C=va[pa],C.__original.needsUpdate)H=
|
|
|
|
+C.offset,D=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H+0]=C.value[o.a],C.array[H+1]=C.value[o.b],C.array[H+2]=C.value[o.c],C.array[H+3]=C.value[o.d]):C.boundTo==="faces"?(C.array[H+0]=C.value[D],C.array[H+1]=C.value[D],C.array[H+2]=C.value[D],C.array[H+3]=C.value[D],C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H+0]=C.value[D+0],C.array[H+1]=C.value[D+1],C.array[H+2]=C.value[D+2],C.array[H+3]=C.value[D+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo===
|
|
|
|
+"vertices"?(G=C.value[o.a],J=C.value[o.b],F=C.value[o.c],ha=C.value[o.d]):C.boundTo==="faces"?(G=C.value[D],J=C.value[D],F=C.value[D],ha=C.value[D],C.offsetSrc++):C.boundTo==="faceVertices"&&(G=C.value[D+0],J=C.value[D+1],F=C.value[D+2],ha=C.value[D+3],C.offsetSrc+=4),C.size===2?(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=J.x,C.array[H+3]=J.y,C.array[H+4]=F.x,C.array[H+5]=F.y,C.array[H+6]=ha.x,C.array[H+7]=ha.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[H+0]=G.r,C.array[H+1]=G.g,C.array[H+
|
|
|
|
+2]=G.b,C.array[H+3]=J.r,C.array[H+4]=J.g,C.array[H+5]=J.b,C.array[H+6]=F.r,C.array[H+7]=F.g,C.array[H+8]=F.b,C.array[H+9]=ha.r,C.array[H+10]=ha.g,C.array[H+11]=ha.b):(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=G.z,C.array[H+3]=J.x,C.array[H+4]=J.y,C.array[H+5]=J.z,C.array[H+6]=F.x,C.array[H+7]=F.y,C.array[H+8]=F.z,C.array[H+9]=ha.x,C.array[H+10]=ha.y,C.array[H+11]=ha.z),C.offset+=12):(C.array[H+0]=G.x,C.array[H+1]=G.y,C.array[H+2]=G.z,C.array[H+3]=G.w,C.array[H+4]=J.x,C.array[H+5]=J.y,C.array[H+
|
|
|
|
+6]=J.z,C.array[H+7]=J.w,C.array[H+8]=F.x,C.array[H+9]=F.y,C.array[H+10]=F.z,C.array[H+11]=F.w,C.array[H+12]=ha.x,C.array[H+13]=ha.y,C.array[H+14]=ha.z,C.array[H+15]=ha.w,C.offset+=16));if(Ba){H=0;for(D=Fa.length;H<D;H++)G=Fa[H].vertices[o.a].position,J=Fa[H].vertices[o.b].position,F=Fa[H].vertices[o.c].position,ha=Fa[H].vertices[o.d].position,C=la[H],C[X+0]=G.x,C[X+1]=G.y,C[X+2]=G.z,C[X+3]=J.x,C[X+4]=J.y,C[X+5]=J.z,C[X+6]=F.x,C[X+7]=F.y,C[X+8]=F.z,C[X+9]=ha.x,C[X+10]=ha.y,C[X+11]=ha.z;X+=12}if(Ha.length)H=
|
|
|
|
+Ha[o.a],D=Ha[o.b],C=Ha[o.c],Q=Ha[o.d],ea[P]=H.x,ea[P+1]=H.y,ea[P+2]=H.z,ea[P+3]=H.w,ea[P+4]=D.x,ea[P+5]=D.y,ea[P+6]=D.z,ea[P+7]=D.w,ea[P+8]=C.x,ea[P+9]=C.y,ea[P+10]=C.z,ea[P+11]=C.w,ea[P+12]=Q.x,ea[P+13]=Q.y,ea[P+14]=Q.z,ea[P+15]=Q.w,H=Oa[o.a],D=Oa[o.b],C=Oa[o.c],Q=Oa[o.d],Z[P]=H.x,Z[P+1]=H.y,Z[P+2]=H.z,Z[P+3]=H.w,Z[P+4]=D.x,Z[P+5]=D.y,Z[P+6]=D.z,Z[P+7]=D.w,Z[P+8]=C.x,Z[P+9]=C.y,Z[P+10]=C.z,Z[P+11]=C.w,Z[P+12]=Q.x,Z[P+13]=Q.y,Z[P+14]=Q.z,Z[P+15]=Q.w,H=Ma[o.a],D=Ma[o.b],C=Ma[o.c],Q=Ma[o.d],aa[P]=H.x,
|
|
|
|
+aa[P+1]=H.y,aa[P+2]=H.z,aa[P+3]=1,aa[P+4]=D.x,aa[P+5]=D.y,aa[P+6]=D.z,aa[P+7]=1,aa[P+8]=C.x,aa[P+9]=C.y,aa[P+10]=C.z,aa[P+11]=1,aa[P+12]=Q.x,aa[P+13]=Q.y,aa[P+14]=Q.z,aa[P+15]=1,H=Na[o.a],D=Na[o.b],C=Na[o.c],o=Na[o.d],Y[P]=H.x,Y[P+1]=H.y,Y[P+2]=H.z,Y[P+3]=1,Y[P+4]=D.x,Y[P+5]=D.y,Y[P+6]=D.z,Y[P+7]=1,Y[P+8]=C.x,Y[P+9]=C.y,Y[P+10]=C.z,Y[P+11]=1,Y[P+12]=o.x,Y[P+13]=o.y,Y[P+14]=o.z,Y[P+15]=1,P+=16;if(ya&&B)w.length==4&&B==THREE.VertexColors?(o=w[0],H=w[1],D=w[2],w=w[3]):w=D=H=o=x,V[ka]=o.r,V[ka+1]=o.g,
|
|
|
|
+V[ka+2]=o.b,V[ka+3]=H.r,V[ka+4]=H.g,V[ka+5]=H.b,V[ka+6]=D.r,V[ka+7]=D.g,V[ka+8]=D.b,V[ka+9]=w.r,V[ka+10]=w.g,V[ka+11]=w.b,ka+=12;if(Da&&ja.hasTangents)w=y[0],x=y[1],o=y[2],y=y[3],W[N]=w.x,W[N+1]=w.y,W[N+2]=w.z,W[N+3]=w.w,W[N+4]=x.x,W[N+5]=x.y,W[N+6]=x.z,W[N+7]=x.w,W[N+8]=o.x,W[N+9]=o.y,W[N+10]=o.z,W[N+11]=o.w,W[N+12]=y.x,W[N+13]=y.y,W[N+14]=y.z,W[N+15]=y.w,N+=16;if(sa&&E)if(u.length==4&&oa)for(y=0;y<4;y++)v=u[y],fa[ma]=v.x,fa[ma+1]=v.y,fa[ma+2]=v.z,ma+=3;else for(y=0;y<4;y++)fa[ma]=v.x,fa[ma+1]=v.y,
|
|
|
|
+fa[ma+2]=v.z,ma+=3;if(qa&&I!==void 0&&A)for(y=0;y<4;y++)u=I[y],ca[R]=u.u,ca[R+1]=u.v,R+=2;if(qa&&K!==void 0&&A)for(y=0;y<4;y++)u=K[y],da[U]=u.u,da[U+1]=u.v,U+=2;wa&&(ga[O]=M,ga[O+1]=M+1,ga[O+2]=M+3,ga[O+3]=M+1,ga[O+4]=M+2,ga[O+5]=M+3,O+=6,ia[S]=M,ia[S+1]=M+1,ia[S+2]=M,ia[S+3]=M+3,ia[S+4]=M+1,ia[S+5]=M+2,ia[S+6]=M+2,ia[S+7]=M+3,S+=8,M+=4)}if(Ka){n=0;for(p=Ka.length;n<p;n++)ga[O]=Ka[n].a,ga[O+1]=Ka[n].b,ga[O+2]=Ka[n].c,ga[O+3]=Ka[n].a,ga[O+4]=Ka[n].c,ga[O+5]=Ka[n].d,O+=6}xa&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+g.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));if(va)for(pa in va)C=va[pa],C.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,C.buffer),j.bufferData(j.ARRAY_BUFFER,C.array,m));if(Ba){H=0;for(D=Fa.length;H<D;H++)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[H]),j.bufferData(j.ARRAY_BUFFER,la[H],m)}ya&&ka>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,V,m));sa&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+fa,m));Da&&ja.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,W,m));qa&&R>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));qa&&U>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,da,m));wa&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ia,m));
|
|
|
|
+P>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,aa,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m));k.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,
|
|
|
|
+delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ua;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(ua in e.attributes)e.attributes[ua].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
|
|
|
|
+f.__dirtyColors){ua=f;b=j.DYNAMIC_DRAW;p=ua.vertices;h=ua.colors;A=p.length;g=h.length;B=ua.__vertexArray;k=ua.__colorArray;E=ua.__dirtyColors;if(ua.__dirtyVertices){for(m=0;m<A;m++)n=p[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(E){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=
|
|
|
|
+!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ua=f;b=j.DYNAMIC_DRAW;p=ua.vertices;h=ua.colors;A=p.length;g=h.length;B=ua.__vertexArray;k=ua.__colorArray;E=ua.__dirtyColors;if(ua.__dirtyVertices){for(m=0;m<A;m++)n=p[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(E){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+ua.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function E(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function J(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,h,k,j,m,o,n=
|
|
|
|
+{},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)k=b.faces[g],j=k.materials,m=e(j),n[m]==void 0&&(n[m]={hash:m,counter:0}),o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:u}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+k>65535&&(n[m].counter+=1,o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,
|
|
|
|
+numMorphTargets:u})),b.geometryGroups[o].faces.push(g),b.geometryGroups[o].vertices+=k}function I(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=X){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);
|
|
|
|
+break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}X=b}}function N(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,D(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,D(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,D(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,D(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,
|
|
|
|
+j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_MAG_FILTER,U(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,U(e.minFilter)))}function M(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),N(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,
|
|
|
|
+null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function Q(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,D(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,
|
|
|
|
+D(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,D(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,D(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,D(b.format),b.width,b.height,0,D(b.format),D(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
|
|
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
|
+null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=Z,b=Y);e!=W&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(R,ga,c,b),W=e)}function F(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
|
+default:return j.LINEAR}}function D(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
|
|
-var fa=this,j,da=[],V=null,$=null,O=!0,ea=null,Y=null,T=null,ca=null,ha=null,na=null,ia=null,J=0,ga=0,X=0,W=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,N=new Float32Array(16),ka=new Float32Array(16),la=new THREE.Vector4,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
-Ba=b.stencil!==void 0?b.stencil:!0,ya=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),za=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:ya,stencil:Ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
|
|
|
|
-" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(wa){console.error(wa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ua.r,ua.g,ua.b,za);this.context=j;var qa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Ba){var S={};S.vertices=new Float32Array(12);S.faces=
|
|
|
|
-new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=j.createBuffer();S.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,S.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-S.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S.faces,j.STATIC_DRAW);S.program=j.createProgram();j.attachShader(S.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(S.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(S.program);S.vertexLocation=j.getAttribLocation(S.program,"position");S.projectionLocation=j.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=j.getUniformLocation(S.program,"darkness")}var Q={};Q.vertices=
|
|
|
|
-new Float32Array(16);Q.faces=new Uint16Array(6);b=0;Q.vertices[b++]=-1;Q.vertices[b++]=-1;Q.vertices[b++]=0;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=1;b=0;Q.faces[b++]=0;Q.faces[b++]=1;Q.faces[b++]=2;Q.faces[b++]=0;Q.faces[b++]=2;Q.faces[b++]=3;Q.vertexBuffer=j.createBuffer();Q.elementBuffer=j.createBuffer();
|
|
|
|
-Q.tempTexture=j.createTexture();Q.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Q.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,Q.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);
|
|
|
|
-j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,Q.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
|
|
|
|
-0?(Q.hasVertexTexture=!1,Q.program=j.createProgram(),j.attachShader(Q.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(Q.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=j.createProgram(),j.attachShader(Q.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(Q.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(Q.program);Q.attributes={};Q.uniforms={};
|
|
|
|
-Q.attributes.vertex=j.getAttribLocation(Q.program,"position");Q.attributes.uv=j.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=j.getUniformLocation(Q.program,"renderType");Q.uniforms.map=j.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=j.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=j.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=j.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=j.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=
|
|
|
|
-j.getUniformLocation(Q.program,"screenPosition");var oa=!1,R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);b=0;R.vertices[b++]=-1;R.vertices[b++]=-1;R.vertices[b++]=0;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=0;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=0;b=R.vertices[b++]=0;R.faces[b++]=0;R.faces[b++]=1;R.faces[b++]=2;R.faces[b++]=0;R.faces[b++]=2;R.faces[b++]=
|
|
|
|
-3;R.vertexBuffer=j.createBuffer();R.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R.faces,j.STATIC_DRAW);R.program=j.createProgram();j.attachShader(R.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(R.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(R.program);R.attributes={};R.uniforms=
|
|
|
|
-{};R.attributes.position=j.getAttribLocation(R.program,"position");R.attributes.uv=j.getAttribLocation(R.program,"uv");R.uniforms.uvOffset=j.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=j.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=j.getUniformLocation(R.program,"rotation");R.uniforms.scale=j.getUniformLocation(R.program,"scale");R.uniforms.alignment=j.getUniformLocation(R.program,"alignment");R.uniforms.map=j.getUniformLocation(R.program,"map");R.uniforms.opacity=j.getUniformLocation(R.program,
|
|
|
|
-"opacity");R.uniforms.useScreenCoordinates=j.getUniformLocation(R.program,"useScreenCoordinates");R.uniforms.affectedByDistance=j.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=j.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=j.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=j.getUniformLocation(R.program,"projectionMatrix");var Ca=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,
|
|
|
|
-va.height)};this.setViewport=function(b,e,c,f){J=b;ga=e;X=c;W=f;j.viewport(J,ga,X,W)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){O=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ua.setHex(b);za=e;j.clearColor(ua.r,ua.g,ua.b,za)};this.setClearColor=function(b,e){ua.copy(b);za=e;j.clearColor(ua.r,ua.g,ua.b,za)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|
|
|
|
|
-j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){S.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof
|
|
|
|
-THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,t,p;n=p=m=0;for(t=e.length;n<t;n++)h=e[n],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&m++;m+p<=4?e=p:(e=Math.ceil(4*p/(m+p)),m=4-e);h={directional:e,point:m};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;
|
|
|
|
-var o;a:{n=b.fragmentShader;t=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},u;h=[];k?h.push(k):(h.push(n),h.push(t));for(u in c)h.push(u),h.push(c[u]);k=h.join();u=0;for(h=da.length;u<h;u++)if(da[u].code==k){o=da[u].program;break a}u=
|
|
|
|
-j.createProgram();h=[qa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.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");
|
|
|
|
-p=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(u,K("fragment",p+n));j.attachShader(u,K("vertex",h+t));j.linkProgram(u);
|
|
|
|
-j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=v.length;m<n;m++)t=v[m],u.uniforms[t]=j.getUniformLocation(u,t);n=["position","normal",
|
|
|
|
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(o in e)n.push(o);o=n;v=0;for(e=o.length;v<e;v++)c=o[v],u.attributes[c]=j.getAttribLocation(u,c);da.push({program:u,code:k});o=u}b.program=o;o=b.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);o.tangent>=0&&j.enableVertexAttribArray(o.tangent);
|
|
|
|
-b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(g in b.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;o.morphTarget0>=0&&(j.enableVertexAttribArray(o.morphTarget0),b.numSupportedMorphTargets++);o.morphTarget1>=0&&(j.enableVertexAttribArray(o.morphTarget1),
|
|
|
|
-b.numSupportedMorphTargets++);o.morphTarget2>=0&&(j.enableVertexAttribArray(o.morphTarget2),b.numSupportedMorphTargets++);o.morphTarget3>=0&&(j.enableVertexAttribArray(o.morphTarget3),b.numSupportedMorphTargets++);o.morphTarget4>=0&&(j.enableVertexAttribArray(o.morphTarget4),b.numSupportedMorphTargets++);o.morphTarget5>=0&&(j.enableVertexAttribArray(o.morphTarget5),b.numSupportedMorphTargets++);o.morphTarget6>=0&&(j.enableVertexAttribArray(o.morphTarget6),b.numSupportedMorphTargets++);o.morphTarget7>=
|
|
|
|
-0&&(j.enableVertexAttribArray(o.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,n,x){var B,G,F,I,K,J,H,P,O=b.lights,T=b.fog;fa.data.vertices=0;fa.data.faces=0;fa.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ka);c.projectionMatrix.flattenToArray(N);Z.multiply(c.projectionMatrix,
|
|
|
|
-c.matrixWorldInverse);o(Z);this.initWebGLObjects(b);L(n);(this.autoClear||x)&&this.clear();K=b.__webglObjects.length;for(x=0;x<K;x++)if(B=b.__webglObjects[x],H=B.object,H.visible)if(!(H instanceof THREE.Mesh)||p(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),u(B),B.render=!0,this.sortObjects)B.object.renderDepth?B.z=B.object.renderDepth:(la.copy(H.position),Z.multiplyVector3(la),B.z=la.z)}else B.render=!1;else B.render=!1;this.sortObjects&&b.__webglObjects.sort(v);J=b.__webglObjectsImmediate.length;
|
|
|
|
-for(x=0;x<J;x++)B=b.__webglObjectsImmediate[x],H=B.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),t(B));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);D(b.overrideMaterial.blending);for(x=0;x<K;x++)if(B=b.__webglObjects[x],B.render)H=B.object,P=B.buffer,k(H),f(c,O,T,b.overrideMaterial,P,H);for(x=0;x<J;x++)B=b.__webglObjectsImmediate[x],H=B.object,H.visible&&(k(H),G=e(c,O,T,b.overrideMaterial,H),H.render(function(e){g(e,G,b.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);
|
|
|
|
-for(x=0;x<K;x++)if(B=b.__webglObjects[x],B.render){H=B.object;P=B.buffer;F=B.opaque;k(H);for(B=0;B<F.count;B++)I=F.list[B],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,T,I,P,H)}for(x=0;x<J;x++)if(B=b.__webglObjectsImmediate[x],H=B.object,H.visible){F=B.opaque;k(H);for(B=0;B<F.count;B++)I=F.list[B],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,O,T,I,H),H.render(function(b){g(b,G,I.shading)})}for(x=0;x<K;x++)if(B=b.__webglObjects[x],
|
|
|
|
-B.render){H=B.object;P=B.buffer;F=B.transparent;k(H);for(B=0;B<F.count;B++)I=F.list[B],D(I.blending),h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,T,I,P,H)}for(x=0;x<J;x++)if(B=b.__webglObjectsImmediate[x],H=B.object,H.visible){F=B.transparent;k(H);for(B=0;B<F.count;B++)I=F.list[B],D(I.blending),h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,O,T,I,H),H.render(function(b){g(b,G,I.shading)})}}b.__webglSprites.length&&C(b,c);Ba&&
|
|
|
|
-b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&z(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,n.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
|
-c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&B(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();
|
|
|
|
-k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<
|
|
|
|
-n;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,t=void 0,o=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=n=0,z=p=o=void 0,C=z=o=t=void 0,p=void 0,u=m.geometry,v=u.faces,z=k.faces,t=0,o=z.length;t<o;t++)p=z[t],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,y+=3):p instanceof THREE.Face4&&(n+=4,w+=2,y+=4);for(var t=k,o=m,D=z=v=void 0,N=void 0,D=void 0,p=[],v=0,z=o.materials.length;v<z;v++)if(D=o.materials[v],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<
|
|
|
|
-l;D++)(N=t.materials[D])&&p.push(N)}else(N=D)&&p.push(N);t=p;k.__materials=t;a:{v=o=void 0;z=t.length;for(o=0;o<z;o++)if(v=t[o],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{z=v=void 0;p=t.length;for(v=0;v<p;v++)if(z=t[v],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{p=v=void 0;D=t.length;for(v=0;v<D;v++)if(p=t[v],
|
|
|
|
-p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(n*3);if(z)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(p)k.__colorArray=new Float32Array(n*3);if(o){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),
|
|
|
|
-k.__skinVertexBArray=new Float32Array(n*4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=z==THREE.SmoothShading;k.__uvType=o;k.__vertexColorType=p;k.__normalType=z;k.__webglFaceCount=
|
|
|
|
-w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=t.length;u<v;u++)if(o=t[u],o.attributes)for(a in k.__webglCustomAttributes={},o.attributes){p=o.attributes[a];z={};for(C in p)z[C]=p[C];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,w=1,z.type==="v2"?w=2:z.type==="v3"?w=3:z.type==="v4"?w=4:z.type==="c"&&(w=3),z.size=w,z.array=new Float32Array(n*w),z.buffer=j.createBuffer(),z.buffer.belongsToAttribute=a,p.needsUpdate=!0,z.__original=
|
|
|
|
-p;k.__webglCustomAttributes[a]=z}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?F(c.__webglShadowVolumes,h,e):F(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)F(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),
|
|
|
|
-f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(c.__webglObjects,
|
|
|
|
-g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},
|
|
|
|
-transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof THREE.ShadowVolume)x(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)x(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof
|
|
|
|
-THREE.LensFlare?x(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&x(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)G(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)G(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)G(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?
|
|
|
|
-j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return qa}};
|
|
|
|
|
|
+var da=this,j,ca=[],V=null,W=null,L=!0,fa=null,aa=null,X=null,ea=null,ia=null,oa=null,ja=null,R=0,ga=0,Z=0,Y=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,pa=new Float32Array(16),ma=new Float32Array(16),ka=new THREE.Vector4,va={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
+Da=b.stencil!==void 0?b.stencil:!0,Aa=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ba=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;try{if(!(j=xa.getContext("experimental-webgl",{antialias:Aa,stencil:Da})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
|
|
|
|
+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(ya){console.error(ya)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(wa.r,wa.g,wa.b,Ba);this.context=j;var sa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Da){var T={};T.vertices=new Float32Array(12);T.faces=
|
|
|
|
+new Uint16Array(6);T.darkness=0.5;T.vertices[0]=-20;T.vertices[1]=-20;T.vertices[2]=-1;T.vertices[3]=20;T.vertices[4]=-20;T.vertices[5]=-1;T.vertices[6]=20;T.vertices[7]=20;T.vertices[8]=-1;T.vertices[9]=-20;T.vertices[10]=20;T.vertices[11]=-1;T.faces[0]=0;T.faces[1]=1;T.faces[2]=2;T.faces[3]=0;T.faces[4]=2;T.faces[5]=3;T.vertexBuffer=j.createBuffer();T.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,T.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,T.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+T.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,T.faces,j.STATIC_DRAW);T.program=j.createProgram();j.attachShader(T.program,F("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(T.program,F("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(T.program);T.vertexLocation=j.getAttribLocation(T.program,"position");T.projectionLocation=j.getUniformLocation(T.program,"projectionMatrix");T.darknessLocation=j.getUniformLocation(T.program,"darkness")}var S={};S.vertices=
|
|
|
|
+new Float32Array(16);S.faces=new Uint16Array(6);b=0;S.vertices[b++]=-1;S.vertices[b++]=-1;S.vertices[b++]=0;S.vertices[b++]=0;S.vertices[b++]=1;S.vertices[b++]=-1;S.vertices[b++]=1;S.vertices[b++]=0;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=1;S.vertices[b++]=-1;S.vertices[b++]=1;S.vertices[b++]=0;S.vertices[b++]=1;b=0;S.faces[b++]=0;S.faces[b++]=1;S.faces[b++]=2;S.faces[b++]=0;S.faces[b++]=2;S.faces[b++]=3;S.vertexBuffer=j.createBuffer();S.elementBuffer=j.createBuffer();
|
|
|
|
+S.tempTexture=j.createTexture();S.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,S.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,S.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,S.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);
|
|
|
|
+j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,S.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
|
|
|
|
+0?(S.hasVertexTexture=!1,S.program=j.createProgram(),j.attachShader(S.program,F("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(S.program,F("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(S.hasVertexTexture=!0,S.program=j.createProgram(),j.attachShader(S.program,F("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(S.program,F("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(S.program);S.attributes={};S.uniforms={};
|
|
|
|
+S.attributes.vertex=j.getAttribLocation(S.program,"position");S.attributes.uv=j.getAttribLocation(S.program,"UV");S.uniforms.renderType=j.getUniformLocation(S.program,"renderType");S.uniforms.map=j.getUniformLocation(S.program,"map");S.uniforms.occlusionMap=j.getUniformLocation(S.program,"occlusionMap");S.uniforms.opacity=j.getUniformLocation(S.program,"opacity");S.uniforms.scale=j.getUniformLocation(S.program,"scale");S.uniforms.rotation=j.getUniformLocation(S.program,"rotation");S.uniforms.screenPosition=
|
|
|
|
+j.getUniformLocation(S.program,"screenPosition");var qa=!1,O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;b=O.vertices[b++]=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=
|
|
|
|
+3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,O.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,O.faces,j.STATIC_DRAW);O.program=j.createProgram();j.attachShader(O.program,F("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(O.program,F("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(O.program);O.attributes={};O.uniforms=
|
|
|
|
+{};O.attributes.position=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=j.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=j.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=j.getUniformLocation(O.program,"rotation");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.alignment=j.getUniformLocation(O.program,"alignment");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.opacity=j.getUniformLocation(O.program,
|
|
|
|
+"opacity");O.uniforms.useScreenCoordinates=j.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=j.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=j.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=j.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=j.getUniformLocation(O.program,"projectionMatrix");var Ea=!1;this.setSize=function(b,e){xa.width=b;xa.height=e;this.setViewport(0,0,xa.width,
|
|
|
|
+xa.height)};this.setViewport=function(b,e,c,f){R=b;ga=e;Z=c;Y=f;j.viewport(R,ga,Z,Y)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;j.depthMask(b)};this.setClearColorHex=function(b,e){wa.setHex(b);Ba=e;j.clearColor(wa.r,wa.g,wa.b,Ba)};this.setClearColor=function(b,e){wa.copy(b);Ba=e;j.clearColor(wa.r,wa.g,wa.b,Ba)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|
|
|
|
|
+j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){T.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof
|
|
|
|
+THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,n,u;o=u=m=0;for(n=e.length;o<n;o++)h=e[o],h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&m++;m+u<=4?e=u:(e=Math.ceil(4*u/(m+u)),m=4-e);h={directional:e,point:m};u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;
|
|
|
|
+var p;a:{o=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:u},v;h=[];k?h.push(k):(h.push(o),h.push(n));for(v in c)h.push(v),h.push(c[v]);k=h.join();v=0;for(h=ca.length;v<h;v++)if(ca[v].code==k){p=ca[v].program;break a}v=
|
|
|
|
+j.createProgram();h=[sa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.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");
|
|
|
|
+u=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(v,F("fragment",u+o));j.attachShader(v,F("vertex",h+n));j.linkProgram(v);
|
|
|
|
+j.getProgramParameter(v,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");v.uniforms={};v.attributes={};var w;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)o.push(w);w=o;m=0;for(o=w.length;m<o;m++)n=w[m],v.uniforms[n]=j.getUniformLocation(v,n);o=["position","normal",
|
|
|
|
+"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)o.push("morphTarget"+w);for(p in e)o.push(p);p=o;w=0;for(e=p.length;w<e;w++)c=p[w],v.attributes[c]=j.getAttribLocation(v,c);ca.push({program:v,code:k});p=v}b.program=p;p=b.program.attributes;p.position>=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent);
|
|
|
|
+b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&j.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1),
|
|
|
|
+b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
|
|
|
|
+0&&(j.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,E){var D,J,F,I,K,M,L,N,O=b.lights,R=b.fog;da.data.vertices=0;da.data.faces=0;da.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ma);c.projectionMatrix.flattenToArray(pa);ha.multiply(c.projectionMatrix,
|
|
|
|
+c.matrixWorldInverse);n(ha);this.initWebGLObjects(b);Q(o);(this.autoClear||E)&&this.clear();K=b.__webglObjects.length;for(E=0;E<K;E++)if(D=b.__webglObjects[E],L=D.object,L.visible)if(!(L instanceof THREE.Mesh)||p(L)){if(L.matrixWorld.flattenToArray(L._objectMatrixArray),y(L,c),v(D),D.render=!0,this.sortObjects)D.object.renderDepth?D.z=D.object.renderDepth:(ka.copy(L.position),ha.multiplyVector3(ka),D.z=ka.z)}else D.render=!1;else D.render=!1;this.sortObjects&&b.__webglObjects.sort(w);M=b.__webglObjectsImmediate.length;
|
|
|
|
+for(E=0;E<M;E++)D=b.__webglObjectsImmediate[E],L=D.object,L.visible&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),y(L,c),u(D));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(E=0;E<K;E++)if(D=b.__webglObjects[E],D.render)L=D.object,N=D.buffer,h(L),f(c,O,R,b.overrideMaterial,N,L);for(E=0;E<M;E++)D=b.__webglObjectsImmediate[E],L=D.object,L.visible&&(h(L),J=e(c,O,R,b.overrideMaterial,L),L.render(function(e){g(e,J,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);
|
|
|
|
+for(E=0;E<K;E++)if(D=b.__webglObjects[E],D.render){L=D.object;N=D.buffer;F=D.opaque;h(L);for(D=0;D<F.count;D++)I=F.list[D],k(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,R,I,N,L)}for(E=0;E<M;E++)if(D=b.__webglObjectsImmediate[E],L=D.object,L.visible){F=D.opaque;h(L);for(D=0;D<F.count;D++)I=F.list[D],k(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),J=e(c,O,R,I,L),L.render(function(b){g(b,J,I.shading)})}for(E=0;E<K;E++)if(D=b.__webglObjects[E],
|
|
|
|
+D.render){L=D.object;N=D.buffer;F=D.transparent;h(L);for(D=0;D<F.count;D++)I=F.list[D],G(I.blending),k(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,R,I,N,L)}for(E=0;E<M;E++)if(D=b.__webglObjectsImmediate[E],L=D.object,L.visible){F=D.transparent;h(L);for(D=0;D<F.count;D++)I=F.list[D],G(I.blending),k(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),J=e(c,O,R,I,L),L.render(function(b){g(b,J,I.shading)})}}b.__webglSprites.length&&B(b,c);Da&&
|
|
|
|
+b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,o.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
|
+c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&J(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();
|
|
|
|
+k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<
|
|
|
|
+o;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,n=void 0,p=void 0,u=void 0,v=u=void 0,w=void 0,x=void 0,y=x=o=0,A=u=p=void 0,B=A=p=n=void 0,u=void 0,v=m.geometry,w=v.faces,A=k.faces,n=0,p=A.length;n<p;n++)u=A[n],u=w[u],u instanceof THREE.Face3?(o+=3,x+=1,y+=3):u instanceof THREE.Face4&&(o+=4,x+=2,y+=4);for(var n=k,p=m,D=A=w=void 0,F=void 0,D=void 0,u=[],w=0,A=p.materials.length;w<A;w++)if(D=p.materials[w],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<
|
|
|
|
+l;D++)(F=n.materials[D])&&u.push(F)}else(F=D)&&u.push(F);n=u;k.__materials=n;a:{w=p=void 0;A=n.length;for(p=0;p<A;p++)if(w=n[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{A=w=void 0;u=n.length;for(w=0;w<u;w++)if(A=n[w],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{u=w=void 0;D=n.length;for(w=0;w<D;w++)if(u=n[w],
|
|
|
|
+u.vertexColors){u=u.vertexColors;break a}u=!1}k.__vertexArray=new Float32Array(o*3);if(A)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(u)k.__colorArray=new Float32Array(o*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
|
|
|
|
+k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=A==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=u;k.__normalType=A;k.__webglFaceCount=
|
|
|
|
+x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;v=0;for(w=n.length;v<w;v++)if(p=n[v],p.attributes)for(a in k.__webglCustomAttributes={},p.attributes){u=p.attributes[a];A={};for(B in u)A[B]=u[B];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,x=1,A.type==="v2"?x=2:A.type==="v3"?x=3:A.type==="v4"?x=4:A.type==="c"&&(x=3),A.size=x,A.array=new Float32Array(o*x),A.buffer=j.createBuffer(),A.buffer.belongsToAttribute=a,u.needsUpdate=!0,A.__original=
|
|
|
|
+u;k.__webglCustomAttributes[a]=A}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?I(c.__webglShadowVolumes,h,e):I(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)I(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),
|
|
|
|
+f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(c.__webglObjects,
|
|
|
|
+g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},
|
|
|
|
+transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof THREE.ShadowVolume)E(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)E(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof
|
|
|
|
+THREE.LensFlare?E(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&E(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)K(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)K(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)K(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?
|
|
|
|
+j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return sa}};
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
-THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,k=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==k)h=e=0;else{var m=k-h,h=m/k,e=e==k?(f-g)/m:f==k?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=k;return c},
|
|
|
|
|
|
+THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==h)k=e=0;else{var m=h-k,k=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=h;return c},
|
|
clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,k=b.vertices,h=g.vertices,m=b.faces,o=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n<t;n++){var u=new THREE.Vertex(h[n].position.clone());e&&c.matrix.multiplyVector3(u.position);k.push(u)}n=0;for(t=o.length;n<t;n++){var h=o[n],v,w,C=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+f):
|
|
|
|
-h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(k=C.length;e<k;e++)w=C[e],v.vertexNormals.push(w.clone());v.color.copy(h.color);e=0;for(k=u.length;e<k;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}n=0;for(t=g.length;n<t;n++){f=g[n];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
|
|
|
|
-THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],k=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)k.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return k}};
|
|
|
|
|
|
+var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,k=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=k.length;o<u;o++){var v=new THREE.Vertex(k[o].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}o=0;for(u=n.length;o<u;o++){var k=n[o],w,x,B=k.vertexNormals,v=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):
|
|
|
|
+k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e=0;for(h=B.length;e<h;e++)x=B[e],w.vertexNormals.push(x.clone());w.color.copy(k.color);e=0;for(h=v.length;e<h;e++)x=v[e],w.vertexColors.push(x.clone());w.materials=k.materials.slice();w.centroid.copy(k.centroid);m.push(w)}o=0;for(u=g.length;o<u;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
|
|
|
|
+THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return h}};
|
|
THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
|
|
@@ -352,23 +352,23 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,k=2*Math.ceil(b*3)+1;k>25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c<k;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<k;++c)e[c]/=f;return e}};
|
|
|
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
|
|
THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var p=b.hierarchy[e].keys[f].morphTargets[o];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var n=
|
|
|
|
-{};for(p in m){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===p){n[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(n[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=n}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
|
|
|
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
|
|
|
|
+{};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
|
|
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
|
|
2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)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.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)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.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.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.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,k,h,m,o,p,n=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,w=this.hierarchy.length;v<w;v++)if(b=this.hierarchy[v],o=b.animationCache,this.JITCompile&&n[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(b.matrix=n[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var C=0;C<3;C++){e=c[C];h=o.prevKey[e];m=o.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
|
|
|
|
-t)}o.prevKey[e]=h;o.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];k=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
|
-"rot")THREE.Quaternion.slerp(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)n[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,k,h,m,o,p;g=(b.length-1)*c;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]];m=b[e[1]];o=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],o[0],p[0],g,e,h);f[1]=this.interpolate(k[1],m[1],o[1],p[1],g,e,h);f[2]=this.interpolate(k[2],m[2],o[2],p[2],g,e,h);return f};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,k,m,n,p,o=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,x=this.hierarchy.length;w<x;w++)if(b=this.hierarchy[w],n=b.animationCache,this.JITCompile&&o[w][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
|
+!1):(b.matrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var B=0;B<3;B++){e=c[B];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(u<v)if(this.loop){k=this.data.hierarchy[w].keys[0];for(m=this.getNextKeyWith(e,w,1);m.time<u;)k=m,m=this.getNextKeyWith(e,w,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,w,m.index+1);while(m.time<
|
|
|
|
+u)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-k.time)/(m.time-k.time);g=k[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
+this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
|
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)o[w][p]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,k,m,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(h[0],m[0],n[0],p[0],g,e,k);f[1]=this.interpolate(h[1],m[1],n[1],p[1],g,e,k);f[2]=this.interpolate(h[2],m[2],n[2],p[2],g,e,k);return f};
|
|
|
|
+THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
|
|
THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
@@ -380,157 +380,179 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
|
|
(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
|
|
(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
|
|
!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
|
|
!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
-THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,k=e.getControlPointsArray(),m=e.getLength(),o=k.length,G=0;h=o-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)G=f*m.chunks[h]/m.total,e.keys[h]={time:G,pos:k[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
|
|
|
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,k=e.getControlPointsArray(),m=e.getLength(),n=k.length,K=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)K=f*m.chunks[h]/m.total,e.keys[h]={time:K,pos:k[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,k=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi=
|
|
|
|
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
|
|
|
|
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,h);b.position.set(0,10,0);this.animation=
|
|
|
|
|
|
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(b,e,c){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var m=k[1]-k[0];this.phi=
|
|
|
|
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/m)*m+k[0];f=this.horizontalAngleMap.srcRange;k=this.horizontalAngleMap.dstRange;m=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/m)*m+k[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
|
|
|
|
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,k);b.position.set(0,10,0);this.animation=
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
|
|
!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
|
|
|
|
-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
|
|
|
|
|
|
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
|
|
|
|
+c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
|
|
this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
|
|
this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,o=!1,p=1,n=0,t=0,u=0,v=0,w=0,C=window.innerWidth/2,z=window.innerHeight/2;this.update=
|
|
|
|
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*u);o&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
|
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);k.set(0,1,0);g.cross(k,h).normalize();k.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=k.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=k.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=k.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
|
|
|
|
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,u=0,v=0,w=0,x=0,B=window.innerWidth/2,A=window.innerHeight/2;this.update=
|
|
|
|
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*u);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
|
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();k.copy(this.forward);h.set(0,1,0);g.cross(h,k).normalize();h.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=k.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
-this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){k.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);k.multiplyScalar(b);this.forward.addSelf(k);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
|
-function(b){v=(b.clientX-C)/window.innerWidth;w=(b.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;
|
|
|
|
-case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:o=!0;p=1;break;case 69:o=!0;p=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:o=!1;break;case 69:o=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
|
|
|
+this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
|
+function(b){w=(b.clientX-B)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:u=-1;break;
|
|
|
|
+case 40:case 83:o=-1;break;case 39:case 68:u=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:u=0;break;case 40:case 83:o=0;break;case 39:case 68:u=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
|
|
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
|
|
|
|
-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
|
|
|
|
-this.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var c=(new THREE.Vector3).cross(k,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?k=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)};
|
|
|
|
-this.panCamera=function(){var b=n.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=n:p.addSelf(b.sub(n,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
|
-g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
|
-c(this,function(b){e&&(k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=o=this.getMouseOnScreen(b.clientX,b.clientY),p=n=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?o=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
|
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
|
|
|
+THREE.TrackballCamera=function(b){function c(b,e){return function(){e.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
|
|
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
|
|
|
|
+this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f};
|
|
|
|
+this.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var e=(new THREE.Vector3).cross(h,k).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(k);this.staticMoving?h=k:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
|
|
|
|
+this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
|
+g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,e,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
|
+c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
|
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Path=function(b){this.actions=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru"};THREE.Path.prototype.fromPoints=function(b){var c=0,e=b.length;this.moveTo(b[0].x,b[0].y);for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};
|
|
|
|
-THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};THREE.Path.prototype.lineTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};THREE.Path.prototype.quadraticCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:b})};
|
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:b})};THREE.Path.prototype.splineThru=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
|
|
|
|
-THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,k,h,m,o,p,n,t,u,v,w;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],k=g.action,g=g.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=g[2];h=g[3];p=g[0];n=g[1];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,w=THREE.FontUtils.b2(v,t,p,k),v=THREE.FontUtils.b2(v,u,n,h),c.push(new THREE.Vector2(w,
|
|
|
|
-v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];h=g[5];p=g[0];n=g[1];m=g[2];o=g[3];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,w=THREE.FontUtils.b3(v,t,p,m,k),v=THREE.FontUtils.b3(v,u,n,o,h),c.push(new THREE.Vector2(w,v));break;case THREE.PathActions.CSPLINE_THRU:u=this.actions[e-1].args;m=new THREE.Vector2(u[u.length-2],u[u.length-1]);k=g[0];h=b*k.length;k.unshift(m);m=new Spline2;for(g=0;g<h;g++)c.push(m.get2DPoint(k,
|
|
|
|
-g/h))}return c};var Spline2=function(){function b(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,k=g*g;return(2*c-2*e+b+f)*g*k+(-3*c+3*e-2*b-f)*k+b*g+c}var c=[],e,f,g,k;this.get2DPoint=function(h,m){e=new THREE.Vector2;f=(h.length-1)*m;g=Math.floor(f);k=f-g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>h.length-2?g:g+1;c[3]=g>h.length-3?g:g+2;e.x=b(h[c[0]].x,h[c[1]].x,h[c[2]].x,h[c[3]].x,k);e.y=b(h[c[0]].y,h[c[1]].y,h[c[2]].y,h[c[3]].y,k);return e}};
|
|
|
|
-THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;h<m;h++){k=b[h];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)g=k.y}return{minX:f,minY:g,maxX:c,maxY:e}};
|
|
|
|
-THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
|
|
|
|
-b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.triangulate=function(){var b=this.getPoints();THREE.FontUtils.Triangulate.area(b)>0&&(b=b.reverse());return THREE.FontUtils.Triangulate(b,!0)};
|
|
|
|
-THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,o){function p(b,c,e,h,m,o,p,t){var u,v,w=f||1,C=g||1,H=m/2,fa=o/2,j=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",C=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=k||1;var da=w+1,V=C+1;m/=w;var $=o/C;for(v=0;v<V;v++)for(o=0;o<da;o++){var O=new THREE.Vector3;O[b]=(o*m-H)*e;O[c]=(v*$-fa)*h;O[u]=p;n.vertices.push(new THREE.Vertex(O))}for(v=0;v<C;v++)for(o=0;o<w;o++)n.faces.push(new THREE.Face4(o+
|
|
|
|
-da*v+j,o+da*(v+1)+j,o+1+da*(v+1)+j,o+1+da*v+j,null,null,t)),n.faceVertexUvs[0].push([new THREE.UV(o/w,v/C),new THREE.UV(o/w,(v+1)/C),new THREE.UV((o+1)/w,(v+1)/C),new THREE.UV((o+1)/w,v/C)])}THREE.Geometry.call(this);var n=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var C in o)this.sides[C]!=void 0&&(this.sides[C]=
|
|
|
|
-o[C]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=n.vertices.length;e<f;e++){for(var h=n.vertices[e],g=!1,k=0,m=b.length;k<m;k++){var o=b[k];if(h.position.x==o.position.x&&
|
|
|
|
-h.position.y==o.position.y&&h.position.z==o.position.z){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=n.faces.length;e<f;e++)h=n.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
-THREE.CylinderGeometry=function(b,c,e,f,g,k){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,o,p=Math.PI*2,n=f/2;for(o=0;o<b;o++)h(Math.sin(p*o/b)*c,Math.cos(p*o/b)*c,-n);for(o=0;o<b;o++)h(Math.sin(p*o/b)*e,Math.cos(p*o/b)*e,n);for(o=0;o<b;o++)m.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-n-(k||0));for(o=b;o<b+b/2;o++)m.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,n+
|
|
|
|
-(g||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],k=this.vertices[e.b],n=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/p,0.5+k.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/p,0.5+n.position.z/
|
|
|
|
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
-THREE.ExtrudeGeometry=function(b,c){function e(b,c,e){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e){C?v.faces.push(new THREE.Face3(e,c,b)):v.faces.push(new THREE.Face3(b,c,e))}function g(b,c,e,f){C?v.faces.push(new THREE.Face4(f,e,c,b)):v.faces.push(new THREE.Face4(b,c,e,f))}var k=c.amount!==void 0?c.amount:100,h=c.bezelThickness!==void 0?c.bezelThickness:10,m=c.bezelEnabled!==void 0?c.bezelEnabled:!1,o=c.steps!==void 0?c.steps:1,p=c.path!==void 0?c.path:null,n,t=!1;
|
|
|
|
-if(p)n=p.getPoints(),o=n.length,t=!0;THREE.Geometry.call(this);var p=b.getPoints(),u=b.triangulate(),v=this,w=[],C=THREE.FontUtils.Triangulate.area(p)>0,z,y,G=p.length,x,B=u.length,F=w.length;for(z=0;z<G;z++)y=p[z],e(y.x,y.y,0);for(x=1;x<=o;x++)for(z=0;z<G;z++)y=p[z],t?e(y.x,y.y+n[x-1].y,n[x-1].x):e(y.x,y.y,k/o*x);if(m){for(z=0;z<F;z++)x=w[z],e(x.x,x.y,h);for(z=0;z<F;z++)x=w[z],e(x.x,x.y,k-h)}for(z=0;z<B;z++)x=u[z],f(x[2],x[1],x[0]);for(z=0;z<B;z++)x=u[z],f(x[0]+G*o,x[1]+G*o,x[2]+G*o);for(z=p.length;--z>=
|
|
|
|
-0;){k=z;h=z-1;h<0&&(h=p.length-1);for(x=0;x<o;x++)u=G*x,B=G*(x+1),g(k+u,h+u,h+B,k+B)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
|
-THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,k=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
|
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in k.faces){var o=f(k.faces[m].a,k.faces[m].b),p=f(k.faces[m].b,k.faces[m].c),n=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,o,n,h);e(k.faces[m].b,p,o,h);
|
|
|
|
-e(k.faces[m].c,n,p,h);e(o,p,n,h)}k.faces=h.faces}g.faces=k.faces;delete k;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],k=[],h=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var o=0;o<=this.angle+0.0010;o+=c){for(m=0;m<e.length;m++)o<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=k;o==0&&(k=f);
|
|
|
|
-for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-o/this.angle,m/b.length),new THREE.UV(1-o/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
|
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,k=b/2,h=c/2,e=e||1,f=f||1,m=e+1,o=f+1;b/=e;var p=c/f;for(g=0;g<o;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(g*p-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
|
|
|
|
+THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;for(var c=[],e=1,f=this.getPoint(0),g,h=0;e<=b;e++)g=this.getPoint(e/b),h+=g.distanceTo(f),c.push(h),f=g;return this.cacheLengths=c};
|
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,h;for(h=c?c:b*e[g-1];f<g;){if(e[f]>h)break;f++}return f/g};THREE.StraightCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.StraightCurve.prototype=new THREE.Curve;THREE.StraightCurve.prototype.constructor=THREE.StraightCurve;THREE.StraightCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
|
|
|
|
+THREE.QuadraticBezierCurve=function(b,c,e,f,g,h){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
|
|
|
|
+THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,h,k,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h;this.x3=k;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
|
+THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,h){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=h};
|
|
|
|
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
|
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,h=g*g;return(2*c-2*e+b+f)*g*h+(-3*c+3*e-2*b-f)*h+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};
|
|
|
|
+THREE.Path.prototype.fromPoints=function(b){var c=0,e=b.length;this.moveTo(b[0].x,b[0].y);for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
|
|
|
|
+THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.StraightCurve(f[f.length-2],f[f.length-1],b,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:e,curve:f})};
|
|
|
|
+THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],b,c,e,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
|
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,h){var k=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,g,h);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k,curve:m})};
|
|
|
|
+THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
|
|
|
|
+THREE.Path.prototype.arc=function(b,c,e,f,g,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
|
|
|
|
+THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,h,k,m,n,p,o,u,v,w,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],h=g.action,g=g.args,h){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=g[2];m=g[3];o=g[0];u=g[1];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b2(x,v,o,k),x=THREE.FontUtils.b2(x,w,u,m),c.push(new THREE.Vector2(g,
|
|
|
|
+x));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];m=g[5];o=g[0];u=g[1];n=g[2];p=g[3];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b3(x,v,o,n,k),x=THREE.FontUtils.b3(x,w,u,p,m),c.push(new THREE.Vector2(g,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*g[0].length;h=h.concat(g[0]);g=new THREE.SplineCurve(h);for(h=1;h<=x;h++)c.push(g.getPointAt(h/
|
|
|
|
+x));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=g[0];m=g[1];n=g[2];o=g[3];x=g[4];u=!!g[5];p=h[h.length-2];v=h[h.length-1];h.length==0&&(p=v=0);w=x-o;var B=b*2;for(h=1;h<=B;h++)x=h/B,u||(x=1-x),x=o+x*w,g=p+k+n*Math.cos(x),x=v+m+n*Math.sin(x),c.push(new THREE.Vector2(g,x))}return c};
|
|
|
|
+THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,k,m;k=0;for(m=b.length;k<m;k++){h=b[k];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>e)e=h.y;else if(h.y<e)g=h.y}return{minX:f,minY:g,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
|
|
|
|
+THREE.Path.prototype.getLength=function(){for(var b=[],c=0,e=0,f=this.curves.length;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};
|
|
|
|
+THREE.Path.prototype.createPathGeometry=function(b,c){var e=this.getPoints(b),f,g=new THREE.Object3D;c||(c=new THREE.LineBasicMaterial({color:0,opacity:0.7}));for(var h=1;h<e.length;h++)f=new THREE.Geometry,f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h-1].x,e[h-1].y,0))),f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h].x,e[h].y,0))),f=new THREE.Line(f,c),g.addChild(f);return g};
|
|
|
|
+THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,h,k,m,n;f=0;for(g=e.length;f<g;f++)h=e[f],k=h.x,m=h.y,n=k/c.maxX,k=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),h.x=k.x+m.x,h.y=k.y+m.y;return e};
|
|
|
|
+THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var k=this.getPoints(),m,n,p,o,u;m=0;for(n=k.length;m<n;m++)p=k[m],o=p.x,u=p.y,p.x=b*o+c*u+e,p.y=f*u+g*o+h;return k};
|
|
|
|
+THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
|
|
|
|
+-0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
|
+THREE.Shape.prototype.getHoles=function(b){for(var b=b?"getSpacedPoints":"getPoints",c=[],e=0,f=this.holes.length;e<f;e++)c[e]=this.holes[e][b]();return c};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this[b?"getSpacedPoints":"getPoints"](),holes:this.getHoles(b)}};
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f,g=e.concat(),h,k,m,n,p,o,u,v,w,x=[];for(k=0;k<c.length;k++){f=c[k];g=g.concat(f);h=Number.POSITIVE_INFINITY;for(m=0;m<f.length;m++){v=f[m];w=[];for(u=0;u<e.length;u++)o=e[u],o=v.distanceTo(o),w.push(o),o<h&&(h=o,n=m,p=u)}h=p-1>=0?p-1:e.length-1;m=n-1>=0?n-1:f.length-1;var B=[f[n],e[p],e[h]];u=THREE.FontUtils.Triangulate.area(B);var A=[f[n],f[m],e[p]];v=THREE.FontUtils.Triangulate.area(A);w=p;o=n;p+=1;n+=-1;p<0&&(p+=e.length);p%=e.length;
|
|
|
|
+n<0&&(n+=f.length);n%=f.length;h=p-1>=0?p-1:e.length-1;m=n-1>=0?n-1:f.length-1;B=[f[n],e[p],e[h]];B=THREE.FontUtils.Triangulate.area(B);A=[f[n],f[m],e[p]];A=THREE.FontUtils.Triangulate.area(A);u+v>B+A&&(p=w,n=o,p<0&&(p+=e.length),p%=e.length,n<0&&(n+=f.length),n%=f.length,h=p-1>=0?p-1:e.length-1,m=n-1>=0?n-1:f.length-1);u=e.slice(0,p);v=e.slice(p);w=f.slice(n);o=f.slice(0,n);m=[f[n],f[m],e[p]];x.push([f[n],e[p],e[h]]);x.push(m);e=u.concat(w).concat(o).concat(v)}return{shape:e,isolatedPts:x,allpoints:g}},
|
|
|
|
+triangulateShape:function(b,c){for(var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h=0;h<e.length;h++)for(var k=e[h],m=0;m<3;m++)for(var n=0;n<f.length;n++)f[n].equals(k[m])&&(k[m]=n);for(h=0;h<g.length;h++){k=g[h];for(m=0;m<3;m++)for(n=0;n<f.length;n++)f[n].equals(k[m])&&(k[m]=n)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
|
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,g,h,k,m,n){function p(b,e,c,k,m,n,p,u){var v,w,x=f||1,B=g||1,D=m/2,da=n/2,j=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",B=h||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",x=h||1;var ca=x+1,V=B+1;m/=x;var W=n/B;for(w=0;w<V;w++)for(n=0;n<ca;n++){var L=new THREE.Vector3;L[b]=(n*m-D)*c;L[e]=(w*W-da)*k;L[v]=p;o.vertices.push(new THREE.Vertex(L))}for(w=0;w<B;w++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+
|
|
|
|
+ca*w+j,n+ca*(w+1)+j,n+1+ca*(w+1)+j,n+1+ca*w+j,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/x,w/B),new THREE.UV(n/x,(w+1)/B),new THREE.UV((n+1)/x,(w+1)/B),new THREE.UV((n+1)/x,w/B)])}THREE.Geometry.call(this);var o=this,u=b/2,v=c/2,w=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var B in n)this.sides[B]!=void 0&&(this.sides[B]=
|
|
|
|
+n[B]);this.sides.px&&p("z","y",1*m,-1,e,c,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,u,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(h.position.x==n.position.x&&
|
|
|
|
+h.position.y==n.position.y&&h.position.z==n.position.z){e[c]=k;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=o.faces.length;c<f;c++)h=o.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
+THREE.CylinderGeometry=function(b,c,e,f,g,h){function k(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)k(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)k(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){k(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){k(0,0,o+
|
|
|
|
+(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
|
|
|
|
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/p,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
+THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){vectorFromCentroid=b.clone().subSelf(e);adj=c/vectorFromCentroid.length();f?adj+=1:adj=1-adj;return vectorFromCentroid.multiplyScalar(adj).addSelf(e)}function f(b){for(F=b.length;--F>=0;){j=F;ca=F-1;ca<0&&(ca=b.length-1);for(var e=0;e<u+o*2;e++){var c=D*e,f=D*(e+1);K.faces.push(new THREE.Face4(V+j+c,V+ca+c,V+ca+f,V+j+f))}}}function g(b,e,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){K.faces.push(new THREE.Face3(b,
|
|
|
|
+e,c))}var k=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var u=c.steps!==void 0?c.steps:1,v=c.path!==void 0?c.path:null,w,x=!1;if(v)w=v.getPoints(),u=w.length,x=!0;THREE.Geometry.call(this);var B,A,y,K=this,v=b.extractAllPoints(!1),E=v.shape,v=v.holes,J=!THREE.Shape.Utils.isClockWise(E);if(J){E=E.reverse();A=0;for(y=v.length;A<y;A++)B=
|
|
|
|
+v[A],THREE.Shape.Utils.isClockWise(B)&&(v[A]=B.reverse());J=!1}var J=THREE.Shape.Utils.triangulateShape(E,v),I=E;A=0;for(y=v.length;A<y;A++)B=v[A],E=E.concat(B);var G,N=new THREE.Vector2,M,Q,F=0;for(il=I.length;F<il;F++)N.addSelf(I[F]);M=N.divideScalar(I.length);Q=[];A=0;for(y=v.length;A<y;A++){N=new THREE.Vector2;B=v[A];F=0;for(il=B.length;F<il;F++)N.addSelf(B[F]);Q[A]=N.divideScalar(B.length)}var F,U,D=E.length,N=J.length,da;for(G=o;G>0;G--){t=G/o;z=m*t;da=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=
|
|
|
|
+I.length;F<il;F++)U=e(I[F],M,da,!1),g(U.x,U.y,-z);A=0;for(y=v.length;A<y;A++){B=v[A];F=0;for(il=B.length;F<il;F++)U=e(B[F],Q[A],da,!0),g(U.x,U.y,-z)}}for(F=0;F<D;F++)U=E[F],x?g(U.x,U.y+w[0].y,w[0].x):g(U.x,U.y,0);for(B=1;B<=u;B++)for(F=0;F<D;F++)U=E[F],x?g(U.x,U.y+w[B-1].y,w[B-1].x):g(U.x,U.y,k/u*B);for(G=1;G<=o;G++){t=G/o;z=m*t;da=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=I.length;F<il;F++)U=e(I[F],M,da,!1),g(U.x,U.y,k+z);A=0;for(y=v.length;A<y;A++){B=v[A];F=0;for(il=B.length;F<il;F++)U=e(B[F],
|
|
|
|
+Q[A],da,!0),x?g(U.x,U.y+w[u-1].y,w[u-1].x+z):g(U.x,U.y,k+z)}}if(p){m=D*0;for(F=0;F<N;F++)k=J[F],h(k[2]+m,k[1]+m,k[0]+m);m=D*(u+o*2);for(F=0;F<N;F++)k=J[F],h(k[0]+m,k[1]+m,k[2]+m)}else{for(F=0;F<N;F++)k=J[F],h(k[2],k[1],k[0]);for(F=0;F<N;F++)k=J[F],h(k[0]+D*u,k[1]+D*u,k[2]+D*u)}var j,ca,V=0;f(I);V+=I.length;A=0;for(y=v.length;A<y;A++)B=v[A],f(B),V+=B.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
|
|
|
|
+THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
|
+THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,k;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
|
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,k);e(h.faces[m].b,p,n,k);
|
|
|
|
+e(h.faces[m].c,o,p,k);e(n,p,o,k)}h.faces=k.faces}g.faces=h.faces;delete h;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],k=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=k.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);
|
|
|
|
+for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
|
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-k),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),o=b*Math.sin(f*g),p=[],n=0;for(f=0;f<k;f++){var t=2*f/k,u=o*Math.sin(t*g),t=o*Math.cos(t*g);(e==0||e==h)&&f>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(n)}c.push(p)}for(var v,w,C,g=c.length,e=0;e<g;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){p=f==k-1;h=c[e][p?0:f+1];m=c[e][p?k-1:f];o=c[e-1][p?
|
|
|
|
-k-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/k;var t=f/k,n=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),z=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[h].position.clone(),w=this.vertices[m].position.clone(),C=this.vertices[o].position.clone(),v.normalize(),w.normalize(),C.normalize(),this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,u,t]));e>1&&(v=
|
|
|
|
-this.vertices[h].position.clone(),w=this.vertices[o].position.clone(),C=this.vertices[p].position.clone(),v.normalize(),w.normalize(),C.normalize(),this.faces.push(new THREE.Face3(h,o,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,t,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,v=n*Math.sin(u*g),u=n*Math.cos(u*g);(e==0||e==k)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,v)))-1);p.push(o)}c.push(p)}for(var w,x,B,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;k=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
|
|
|
|
+h-1:f];p=c[e-1][p?0:f+1];v=e/(g-1);w=(e-1)/(g-1);x=(f+1)/h;var u=f/h,o=new THREE.UV(1-x,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,w),A=new THREE.UV(1-x,w);e<c.length-1&&(w=this.vertices[k].position.clone(),x=this.vertices[m].position.clone(),B=this.vertices[n].position.clone(),w.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,v,u]));e>1&&(w=
|
|
|
|
+this.vertices[k].position.clone(),x=this.vertices[n].position.clone(),B=this.vertices[p].position.clone(),w.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,u,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
-THREE.TextGeometry.prototype.set=function(b,c){function e(b,c,e){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e,f){w.faces.push(new THREE.Face4(b,c,e,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,k=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",o=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,n=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
|
|
|
|
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=o;THREE.FontUtils.bezelSize=n;var m=THREE.FontUtils.drawText(b),k=m.points,u=m.faces,h=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var C,o=k.length,z=u.length,n=v.length,m=0;m<o;m++)C=k[m],e(C.x,C.y,0);for(m=0;m<o;m++)C=k[m],e(C.x,C.y,g);if(t){for(m=0;m<n;m++)C=v[m],e(C.x,C.y,p);for(m=0;m<n;m++)C=v[m],e(C.x,C.y,g-p)}for(m=
|
|
|
|
-0;m<z;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<z;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+o,g[1]+o,g[2]+o));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];p=o*2+m;u=p-1;f(p,u,u+n,p+n);for(t=0;t<o;t++)if(k[t].equals(h[m]))break;for(g=0;g<o;g++)if(k[g].equals(h[m-1]))break;f(t,g,u,p);f(p+n,u+n,g+o,t+o)}else for(m=h.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t<o;t++)if(k[t].equals(h[m]))break;for(g=
|
|
|
|
-0;g<o;g++)if(k[g].equals(h[m-1]))break;f(t,g,g+o,t+o)}this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,k=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,u=c.bezelEnabled!==
|
|
|
|
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=k;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,v=m.faces,k=m.contour,w=m.bezel,x=this;x.vertices=[];x.faces=[];for(var B,n=h.length,A=v.length,o=w.length,m=0;m<n;m++)B=h[m],e(B.x,B.y,0);for(m=0;m<n;m++)B=h[m],e(B.x,B.y,g);if(u){for(m=0;m<o;m++)B=w[m],e(B.x,B.y,p);for(m=0;m<o;m++)B=w[m],e(B.x,B.y,g-p)}for(m=
|
|
|
|
+0;m<A;m++)g=v[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<A;m++)g=v[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var y;if(u)for(m=w.length;--m>0;){if(y){if(y.equals(k[m])){y=null;continue}}else y=k[m];p=n*2+m;v=p-1;f(p,v,v+o,p+o);for(u=0;u<n;u++)if(h[u].equals(k[m]))break;for(g=0;g<n;g++)if(h[g].equals(k[m-1]))break;f(u,g,v,p);f(p+o,v+o,g+n,u+n)}else for(m=k.length;--m>0;){if(y){if(y.equals(k[m])){y=null;continue}}else y=k[m];for(u=0;u<n;u++)if(h[u].equals(k[m]))break;for(g=
|
|
|
|
+0;g<n;g++)if(h[g].equals(k[m-1]))break;f(u,g,g+n,u+n)}this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
|
|
-{points:b,faces:[]};for(var e,f,g,k,h,m=[],o=0;o<c.length;o++){h=c[o];k=[];for(e=0;e<h.length;e++)f=h[e],k.push(f.x+","+f.y);var p;e=k.slice(1).indexOf(k[0]);var n=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<k.length;){p=e+1;e=k[p];e=k.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=h.slice(p,e+1);n?this.Triangulate.area(t)<0?(p>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}n&&m.push({shape:g,holes:f})}var u,v,w,
|
|
|
|
-C,z,y;k=[];for(h=0;h<m.length;h++){o=m[h];g=o.shape;f=o.holes;for(p=0;p<f.length;p++){n=f[p];w=Number.POSITIVE_INFINITY;for(t=0;t<n.length;t++){z=n[t];for(e=0;e<g.length;e++)C=g[e],C=z.distanceTo(C),C<w&&(w=C,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:n.length-1,G=[];G.push(n[u]);G.push(g[v]);G.push(g[e]);w=this.Triangulate.area(G);var x=[];x.push(n[u]);x.push(n[t]);x.push(g[v]);z=this.Triangulate.area(x);C=v;y=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=n.length);u%=g.length;e=v-
|
|
|
|
-1>=0?v-1:g.length-1;t=u-1>=0?u-1:n.length-1;G=[];G.push(n[u]);G.push(g[v]);G.push(g[e]);G=this.Triangulate.area(G);x=[];x.push(n[u]);x.push(n[t]);x.push(g[v]);x=this.Triangulate.area(x);w+z>G+x&&(v=C,u=y,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=n.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:n.length-1);w=g.slice(0,v);z=g.slice(v);C=n.slice(u);y=n.slice(0,u);k.push(n[u]);k.push(g[v]);k.push(g[e]);k.push(n[u]);k.push(n[t]);k.push(g[v]);g=w.concat(C).concat(y).concat(z)}o.shape=g}u=[];v=[];
|
|
|
|
-for(h=p=0;h<m.length;h++){o=m[h];g=o.shape;u=u.concat(g);n=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<n.length;f++)o=n[f],o[0]+=p,o[1]+=p,o[2]+=p;v=v.concat(n);p+=g.length}var B;for(f=0;f<k.length/3;f++){o=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)B=f*3+m,u[g].equals(k[B])&&(o.push(g),h=!0);h||(u.push(k[B]),o.push(u.length-1),console.log("not found"))}v.push(o)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),k=this.size/g.resolution,h=0;f=String(b).split("");
|
|
|
|
-for(var m=f.length,o=[],b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,k,h);h+=p.offset;c.push(p.points);e=e.concat(p.points);o.push(p.path)}b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];k=[];f=[];for(var h=[],m=new THREE.Vector2,n,b=e.length;--b>=0;){if(n){if(n.equals(e[b])){n=null;o=this.Triangulate.area(f)>0;h.push(o);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else n=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)o=e[b],
|
|
|
|
-m=k[f],o=o.clone().subSelf(m),p=this.bezelSize/o.length(),h[f]?p+=1:p=1-p,p=o.multiplyScalar(p).addSelf(m),g.unshift(p),n?n.equals(e[b])&&(n=null,f++):n=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,
|
|
|
|
-c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],k=new THREE.Path,h,m,o,p,n,t,u,v,w,C,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,p));k.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,
|
|
|
|
-p));k.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;k.quadraticCurveTo(u,v,m,p);if(h=g[g.length-1]){n=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,G=THREE.FontUtils.b2(y,n,u,m),y=THREE.FontUtils.b2(y,t,v,p);g.push(new THREE.Vector2(G,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,w=c[b++]*e+f,C=c[b++]*-e,k.quadraticCurveTo(m,p,u,v,w,C),h=g[g.length-1]){n=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=
|
|
|
|
-h/divisions,G=THREE.FontUtils.b3(y,n,u,w,m),y=THREE.FontUtils.b3(y,t,v,C,p),g.push(new THREE.Vector2(G,y))}}}k.debug(document.getElementById("boo"));console.log(k);return{offset:z.ha*e,points:g,path:k}}}};
|
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,k=c-1,h=0;h<c;k=h++)g+=b[k].x*b[h].y-b[h].x*b[k].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var k=[],h=[],m=[],o,p,n;if(c(b)>0)for(p=0;p<g;p++)h[p]=p;else for(p=0;p<g;p++)h[p]=g-1-p;var t=2*g;for(p=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}o=p;g<=o&&(o=0);p=o+1;g<=p&&(p=0);n=p+1;g<=n&&(n=0);var u;a:{u=b;var v=o,w=p,C=n,z=g,y=h,G=void 0,x=void 0,B=void 0,
|
|
|
|
-F=void 0,D=void 0,P=void 0,I=void 0,L=void 0,K=void 0,x=u[y[v]].x,B=u[y[v]].y,F=u[y[w]].x,D=u[y[w]].y,P=u[y[C]].x,I=u[y[C]].y;if(1.0E-10>(F-x)*(I-B)-(D-B)*(P-x))u=!1;else{for(G=0;G<z;G++)if(!(G==v||G==w||G==C)){var L=u[y[G]].x,K=u[y[G]].y,U=void 0,H=void 0,fa=void 0,j=void 0,da=void 0,V=void 0,$=void 0,O=void 0,ea=void 0,Y=void 0,T=void 0,ca=void 0,U=fa=da=void 0,U=P-F,H=I-D,fa=x-P,j=B-I,da=F-x,V=D-B,$=L-x,O=K-B,ea=L-F,Y=K-D,T=L-P,ca=K-I,U=U*Y-H*ea,da=da*O-V*$,fa=fa*ca-j*T;if(U>=0&&fa>=0&&da>=0){u=
|
|
|
|
-!1;break a}}u=!0}}if(u){t=h[o];u=h[p];v=h[n];k.push(b[t]);k.push(b[u]);k.push(b[v]);m.push([h[o],h[p],h[n]]);o=p;for(n=p+1;n<g;o++,n++)h[o]=h[n];g--;t=2*g}}if(f)return m;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
|
|
|
+{points:b,faces:[]};for(var e,f,g,h,k,m=[],n=0;n<c.length;n++){k=c[n];h=[];for(e=0;e<k.length;e++)f=k[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(k.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var u=k.slice(p,e+1);o?this.Triangulate.area(u)<0?(p>0&&m.push({shape:g,holes:f}),g=u,f=[]):f.push(u):this.Triangulate.area(u)<0?(m.push({shape:u,holes:f}),f=[]):f.push(u);e++}o&&m.push({shape:g,holes:f})}var v,w,x,
|
|
|
|
+B,A,y;h=[];for(k=0;k<m.length;k++){n=m[k];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(u=0;u<o.length;u++){A=o[u];for(e=0;e<g.length;e++)B=g[e],B=A.distanceTo(B),B<x&&(x=B,v=u,w=e)}e=w-1>=0?w-1:g.length-1;var u=v-1>=0?v-1:o.length-1,K=[];K.push(o[v]);K.push(g[w]);K.push(g[e]);x=this.Triangulate.area(K);var E=[];E.push(o[v]);E.push(o[u]);E.push(g[w]);A=this.Triangulate.area(E);B=w;y=v;w+=1;v+=-1;w<0&&(w+=g.length);w%=g.length;v<0&&(v+=o.length);v%=g.length;e=w-
|
|
|
|
+1>=0?w-1:g.length-1;u=v-1>=0?v-1:o.length-1;K=[];K.push(o[v]);K.push(g[w]);K.push(g[e]);K=this.Triangulate.area(K);E=[];E.push(o[v]);E.push(o[u]);E.push(g[w]);E=this.Triangulate.area(E);x+A>K+E&&(w=B,v=y,w<0&&(w+=g.length),w%=g.length,v<0&&(v+=o.length),v%=g.length,e=w-1>=0?w-1:g.length-1,u=v-1>=0?v-1:o.length-1);x=g.slice(0,w);A=g.slice(w);B=o.slice(v);y=o.slice(0,v);h.push(o[v]);h.push(g[w]);h.push(g[e]);h.push(o[v]);h.push(o[u]);h.push(g[w]);g=x.concat(B).concat(y).concat(A)}n.shape=g}v=[];w=[];
|
|
|
|
+for(k=p=0;k<m.length;k++){n=m[k];g=n.shape;v=v.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;w=w.concat(o);p+=g.length}var J;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){k=!1;for(g=0;g<v.length&&!k;g++)J=f*3+m,v[g].equals(h[J])&&(n.push(g),k=!0);k||(v.push(h[J]),n.push(v.length-1),console.log("not found"))}w.push(n)}return{points:v,faces:w}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,k=0;f=String(b).split("");
|
|
|
|
+for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,h,k,n);k+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=k/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var k=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;k.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
|
|
|
|
+0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),k[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
|
|
|
|
+(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],k,m,n,p,o,u,v,w,x,B,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
|
|
|
|
+p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;w=c[b++]*e;g.quadraticCurveTo(v,w,m,p);if(k=h[h.length-1]){o=k.x;u=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var y=k/divisions,K=THREE.FontUtils.b2(y,o,v,m),y=THREE.FontUtils.b2(y,u,w,p);h.push(new THREE.Vector2(K,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,w=c[b++]*-e,x=c[b++]*e+f,B=c[b++]*-e,g.bezierCurveTo(m,p,v,w,x,B),k=h[h.length-1]){o=k.x;u=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)y=
|
|
|
|
+k/divisions,K=THREE.FontUtils.b3(y,o,v,x,m),y=THREE.FontUtils.b3(y,u,w,B,p),h.push(new THREE.Vector2(K,y))}}}return{offset:A.ha*e,points:h,path:g}}}};
|
|
|
|
+(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,k=0;k<c;h=k++)g+=b[h].x*b[k].y-b[k].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],k=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)k[p]=p;else for(p=0;p<g;p++)k[p]=g-1-p;var u=2*g;for(p=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var v;a:{v=b;var w=n,x=p,B=o,A=g,y=k,K=void 0,E=void 0,J=void 0,
|
|
|
|
+I=void 0,G=void 0,N=void 0,M=void 0,Q=void 0,F=void 0,E=v[y[w]].x,J=v[y[w]].y,I=v[y[x]].x,G=v[y[x]].y,N=v[y[B]].x,M=v[y[B]].y;if(1.0E-10>(I-E)*(M-J)-(G-J)*(N-E))v=!1;else{for(K=0;K<A;K++)if(!(K==w||K==x||K==B)){var Q=v[y[K]].x,F=v[y[K]].y,U=void 0,D=void 0,da=void 0,j=void 0,ca=void 0,V=void 0,W=void 0,L=void 0,fa=void 0,aa=void 0,X=void 0,ea=void 0,U=da=ca=void 0,U=N-I,D=M-G,da=E-N,j=J-M,ca=I-E,V=G-J,W=Q-E,L=F-J,fa=Q-I,aa=F-G,X=Q-N,ea=F-M,U=U*aa-D*fa,ca=ca*L-V*W,da=da*ea-j*X;if(U>=0&&da>=0&&ca>=
|
|
|
|
+0){v=!1;break a}}v=!0}}if(v){h.push([b[k[n]],b[k[p]],b[k[o]]]);m.push([k[n],k[p],k[o]]);n=p;for(o=p+1;o<g;n++,o++)k[n]=k[o];g--;u=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,k=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,k,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[k][0],b[k][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,k));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
-THREE.TorusKnotGeometry=function(b,c,e,f,g,k,h){function m(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
|
-this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(o,h,this.q,this.p,this.radius,this.heightScale),o=m(o+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=o.x-g.x;e.y=o.y-g.y;e.z=o.z-g.z;f.x=o.x+g.x;f.y=o.y+g.y;f.z=o.z+g.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();o=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=o*f.x+h*k.x;g.y+=o*f.y+h*k.y;g.z+=o*f.z+h*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
|
-g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,k));this.faceVertexUvs[0].push([h,o,p,n])}this.computeCentroids();
|
|
|
|
|
|
+THREE.TorusKnotGeometry=function(b,c,e,f,g,h,k){function m(b,e,c,f,h,g){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,g*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
|
+this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,g=m(n,k,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*h.x;g.y+=n*f.y+k*h.y;g.z+=n*f.z+k*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
|
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,h));this.faceVertexUvs[0].push([k,n,p,o])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,k,m){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
|
|
|
|
-1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,o;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
|
-if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=k(b.colorDiffuse);
|
|
|
|
-else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=k(b.colorSpecular);if(b.colorAmbient)h.ambient=k(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
|
-b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;o=h.ambient;var u=h.shininess;n.tNormal.texture=h.normalMap;if(b.mapNormalFactor)n.uNormalScale.value=b.mapNormalFactor;if(h.map)n.tDiffuse.texture=h.map,n.enableDiffuse.value=!0;if(h.specularMap)n.tSpecular.texture=h.specularMap,n.enableSpecular.value=!0;if(h.lightMap)n.tAO.texture=
|
|
|
|
-h.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(t);n.uSpecularColor.value.setHex(m);n.uAmbientColor.value.setHex(o);n.uShininess.value=u;if(h.opacity)n.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:n,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
|
|
|
|
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,k,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
|
|
|
|
+1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var k,m,n;m="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
|
|
|
|
+if(b.blending)if(b.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)k.transparent=b.transparent;if(b.depthTest!==void 0)k.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(b.vertexColors)k.vertexColors=THREE.VertexColors;if(b.colorDiffuse)k.color=h(b.colorDiffuse);
|
|
|
|
+else if(b.DbgColor)k.color=b.DbgColor;if(b.colorSpecular)k.specular=h(b.colorSpecular);if(b.colorAmbient)k.ambient=h(b.colorAmbient);if(b.transparency)k.opacity=b.transparency;if(b.specularCoef)k.shininess=b.specularCoef;b.mapDiffuse&&c&&g(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(k,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(k,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
|
+b.mapSpecular&&c&&g(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),u=k.color;m=k.specular;n=k.ambient;var v=k.shininess;o.tNormal.texture=k.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(k.map)o.tDiffuse.texture=k.map,o.enableDiffuse.value=!0;if(k.specularMap)o.tSpecular.texture=k.specularMap,o.enableSpecular.value=!0;if(k.lightMap)o.tAO.texture=
|
|
|
|
+k.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(u);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(k.opacity)o.uOpacity.value=k.opacity;k=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else k=new THREE[m](k);return k}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,o,p,n,t,u,v,w,C,z,y,G,x,B=b.faces;t=b.vertices;var F=b.normals,D=b.colors,P=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&P++;for(e=0;e<P;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(n=t.length;p<n;)u=new THREE.Vertex,u.position.x=t[p++]*c,u.position.y=
|
|
|
|
-t[p++]*c,u.position.z=t[p++]*c,f.vertices.push(u);p=0;for(n=B.length;p<n;){c=B[p++];t=c&1;o=c&2;e=c&4;g=c&8;v=c&16;u=c&32;C=c&64;c&=128;t?(z=new THREE.Face4,z.a=B[p++],z.b=B[p++],z.c=B[p++],z.d=B[p++],t=4):(z=new THREE.Face3,z.a=B[p++],z.b=B[p++],z.c=B[p++],t=3);if(o)o=B[p++],z.materials=f.materials[o];o=f.faces.length;if(e)for(e=0;e<P;e++)y=b.uvs[e],w=B[p++],x=y[w*2],w=y[w*2+1],f.faceUvs[e][o]=new THREE.UV(x,w);if(g)for(e=0;e<P;e++){y=b.uvs[e];G=[];for(g=0;g<t;g++)w=B[p++],x=y[w*2],w=y[w*2+1],G[g]=
|
|
|
|
-new THREE.UV(x,w);f.faceVertexUvs[e][o]=G}if(v)v=B[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],z.normal=g;if(u)for(e=0;e<t;e++)v=B[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],z.vertexNormals.push(g);if(C)u=B[p++],u=new THREE.Color(D[u]),z.color=u;if(c)for(e=0;e<t;e++)u=B[p++],u=new THREE.Color(D[u]),z.vertexColors.push(u);f.faces.push(z)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
|
-o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,o,p,n,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;o=0;for(p=w.length;o<p;o+=3)n=w[o]*c,t=w[o+1]*
|
|
|
|
-c,u=w[o+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(n,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;n=b.morphColors[e].colors;c=0;for(o=n.length;c<o;c+=3)t=new THREE.Color(16755200),t.setRGB(n[c],n[c+1],n[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
|
-f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
-THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
|
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,k){var h=new XMLHttpRequest,m=f+"/"+b,o=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?k&&(o==0&&(o=h.getResponseHeader("Content-Length")),k({total:o,loaded:h.responseText.length})):h.readyState==2&&(o=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=n(b,c),g=n(b,c+1),h=n(b,c+2),j=n(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=n(b,c),f=n(b,c+1),h=n(b,c+2);return(n(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function p(b,c){var e=n(b,c);return e>127?e-256:e}function n(b,
|
|
|
|
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+P);c=o(b,c+I);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,n;e=g(b,c);f=g(b,c+D);h=g(b,c+P);j=o(b,c+I);k=g(b,c+L);n=g(b,c+K);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(y,B,e,f,h,j,k,n,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+H);h=g(b,c+fa);k=g(b,c+j);c=o(b,c+da);THREE.BinaryLoader.prototype.f4(y,e,f,h,k,c)}function w(c){var e,f,h,k,n,p,t,u;e=g(b,c);f=g(b,c+H);h=g(b,c+fa);k=g(b,c+j);n=
|
|
|
|
-o(b,c+da);p=g(b,c+V);t=g(b,c+$);u=g(b,c+O);c=g(b,c+ea);THREE.BinaryLoader.prototype.f4n(y,B,e,f,h,k,n,p,t,u,c)}function C(c){var e,f;e=g(b,c);f=g(b,c+Y);c=g(b,c+T);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function z(c){var e,f,h;e=g(b,c);f=g(b,c+ca);h=g(b,c+ha);c=g(b,c+na);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[c*2],F[c*2+1])}var y=this,G=0,x,B=[],F=[],D,P,I,L,K,U,H,fa,j,da,V,
|
|
|
|
-$,O,ea,Y,T,ca,ha,na,ia,J,ga,X,W,ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);x={signature:b.substr(G,8),header_bytes:n(b,G+8),vertex_coordinate_bytes:n(b,G+9),normal_coordinate_bytes:n(b,G+10),uv_coordinate_bytes:n(b,G+11),vertex_index_bytes:n(b,G+12),normal_index_bytes:n(b,G+13),uv_index_bytes:n(b,G+14),material_index_bytes:n(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b,
|
|
|
|
-G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=x.header_bytes;D=x.vertex_index_bytes;P=x.vertex_index_bytes*2;I=x.vertex_index_bytes*3;L=x.vertex_index_bytes*3+x.material_index_bytes;K=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;U=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;H=x.vertex_index_bytes;fa=x.vertex_index_bytes*2;j=x.vertex_index_bytes*3;da=x.vertex_index_bytes*4;V=x.vertex_index_bytes*
|
|
|
|
-4+x.material_index_bytes;$=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;O=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;ea=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;Y=x.uv_index_bytes;T=x.uv_index_bytes*2;ca=x.uv_index_bytes;ha=x.uv_index_bytes*2;na=x.uv_index_bytes*3;c=x.vertex_index_bytes*3+x.material_index_bytes;ja=x.vertex_index_bytes*4+x.material_index_bytes;ia=x.ntri_flat*c;J=x.ntri_smooth*(c+x.normal_index_bytes*3);ga=
|
|
|
|
-x.ntri_flat_uv*(c+x.uv_index_bytes*3);X=x.ntri_smooth_uv*(c+x.normal_index_bytes*3+x.uv_index_bytes*3);W=x.nquad_flat*ja;c=x.nquad_smooth*(ja+x.normal_index_bytes*4);ja=x.nquad_flat_uv*(ja+x.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=x.vertex_coordinate_bytes*3,m=c+x.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+x.vertex_coordinate_bytes),j=e(b,c+x.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return x.nvertices*k}(G);G+=function(c){for(var e,f,g,h=x.normal_coordinate_bytes*3,j=
|
|
|
|
-c+x.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+x.normal_coordinate_bytes),g=p(b,c+x.normal_coordinate_bytes*2),B.push(e/127,f/127,g/127);return x.nnormals*h}(G);G+=function(c){for(var f,g,j=x.uv_coordinate_bytes*2,k=c+x.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+x.uv_coordinate_bytes),F.push(f,g);return x.nuvs*j}(G);ia=G+ia;J=ia+J;ga=J+ga;X=ga+X;W=X+W;c=W+c;ja=c+ja;(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes,f=e+x.uv_index_bytes*3,g=b+x.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),C(c+e);return g-
|
|
|
|
-b})(J);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,f=e+x.uv_index_bytes*3,g=b+x.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),C(c+e);return g-b})(ga);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes,f=e+x.uv_index_bytes*4,g=b+x.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(c);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,f=e+x.uv_index_bytes*4,g=b+x.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
|
-z(c+e);return g-b})(ja);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes,f=b+x.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(G);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,f=b+x.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(ia);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes,f=b+x.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(X);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*
|
|
|
|
-4,f=b+x.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(W);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,k){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[k]))},
|
|
|
|
-f3n:function(b,c,e,f,g,k,h,m,o){var k=b.materials[k],p=c[m*3],n=c[m*3+1],m=c[m*3+2],t=c[o*3],u=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(p,n,m),new THREE.Vector3(t,u,o)],null,k))},f4n:function(b,c,e,f,g,k,h,m,o,p,n){var h=b.materials[h],t=c[o*3],u=c[o*3+1],o=c[o*3+2],v=c[p*3],w=c[p*3+1],p=c[p*3+2],C=c[n*3],z=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(e,f,g,k,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
|
|
|
|
-u,o),new THREE.Vector3(v,w,p),new THREE.Vector3(C,z,n)],null,h))},uv3:function(b,c,e,f,g,k,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(k,h));b.push(m)},uv4:function(b,c,e,f,g,k,h,m,o){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(k,h));p.push(new THREE.UV(m,o));b.push(p)}};
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,u,v,w,x,B,A,y,K,E,J=b.faces;u=b.vertices;var I=b.normals,G=b.colors,N=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&N++;for(c=0;c<N;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=u.length;p<o;)v=new THREE.Vertex,v.position.x=u[p++]*e,v.position.y=
|
|
|
|
+u[p++]*e,v.position.z=u[p++]*e,f.vertices.push(v);p=0;for(o=J.length;p<o;){e=J[p++];u=e&1;n=e&2;c=e&4;g=e&8;w=e&16;v=e&32;B=e&64;e&=128;u?(A=new THREE.Face4,A.a=J[p++],A.b=J[p++],A.c=J[p++],A.d=J[p++],u=4):(A=new THREE.Face3,A.a=J[p++],A.b=J[p++],A.c=J[p++],u=3);if(n)n=J[p++],A.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<N;c++)y=b.uvs[c],x=J[p++],E=y[x*2],x=y[x*2+1],f.faceUvs[c][n]=new THREE.UV(E,x);if(g)for(c=0;c<N;c++){y=b.uvs[c];K=[];for(g=0;g<u;g++)x=J[p++],E=y[x*2],x=y[x*2+1],K[g]=
|
|
|
|
+new THREE.UV(E,x);f.faceVertexUvs[c][n]=K}if(w)w=J[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],A.normal=g;if(v)for(c=0;c<u;c++)w=J[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],A.vertexNormals.push(g);if(B)v=J[p++],v=new THREE.Color(G[v]),A.color=v;if(e)for(c=0;c<u;c++)v=J[p++],v=new THREE.Color(G[v]),A.vertexColors.push(v);f.faces.push(A)}}})(g);(function(){var e,c,g,n;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)g=b.skinWeights[e],n=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
|
+n,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)g=b.skinIndices[e],n=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,g,n,p,o,u,v,w,x;c=0;for(g=b.morphTargets.length;c<g;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];w=f.morphTargets[c].vertices;x=b.morphTargets[c].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*e,u=x[n+1]*
|
|
|
|
+e,v=x[n+2]*e,w.push(new THREE.Vertex(new THREE.Vector3(o,u,v)))}}if(b.morphColors!==void 0){c=0;for(g=b.morphColors.length;c<g;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];p=f.morphColors[c].colors;o=b.morphColors[c].colors;e=0;for(n=o.length;e<n;e+=3)u=new THREE.Color(16755200),u.setRGB(o[e],o[e+1],o[e+2]),p.push(u)}}})(g);(function(){if(b.edges!==void 0){var e,c,g;for(e=0;e<b.edges.length;e+=2)c=b.edges[e],g=b.edges[e+1],f.edges.push(new THREE.Edge(f.vertices[c],
|
|
|
|
+f.vertices[g],c,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
|
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var k=new XMLHttpRequest,m=f+"/"+b,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",m,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
+k.setRequestHeader("Content-Type","text/plain");k.send(null)},createBinModel:function(b,c,e,f){var g=function(e){function c(b,e){var f=o(b,e),g=o(b,e+1),h=o(b,e+2),j=o(b,e+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,e){var c=o(b,e),f=o(b,e+1),h=o(b,e+2);return(o(b,e+3)<<24)+(h<<16)+(f<<8)+c}function n(b,e){var c=o(b,e);return(o(b,e+1)<<8)+c}function p(b,e){var c=o(b,e);return c>127?c-256:c}function o(b,
|
|
|
|
+e){return b.charCodeAt(e)&255}function u(e){var c,f,h;c=g(b,e);f=g(b,e+G);h=g(b,e+N);e=n(b,e+M);THREE.BinaryLoader.prototype.f3(y,c,f,h,e)}function v(e){var c,f,h,j,k,o;c=g(b,e);f=g(b,e+G);h=g(b,e+N);j=n(b,e+M);k=g(b,e+Q);o=g(b,e+F);e=g(b,e+U);THREE.BinaryLoader.prototype.f3n(y,J,c,f,h,j,k,o,e)}function w(e){var c,f,h,k;c=g(b,e);f=g(b,e+D);h=g(b,e+da);k=g(b,e+j);e=n(b,e+ca);THREE.BinaryLoader.prototype.f4(y,c,f,h,k,e)}function x(e){var c,f,h,k,o,p,u,v;c=g(b,e);f=g(b,e+D);h=g(b,e+da);k=g(b,e+j);o=
|
|
|
|
+n(b,e+ca);p=g(b,e+V);u=g(b,e+W);v=g(b,e+L);e=g(b,e+fa);THREE.BinaryLoader.prototype.f4n(y,J,c,f,h,k,o,p,u,v,e)}function B(e){var c,f;c=g(b,e);f=g(b,e+aa);e=g(b,e+X);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],I[c*2],I[c*2+1],I[f*2],I[f*2+1],I[e*2],I[e*2+1])}function A(e){var c,f,h;c=g(b,e);f=g(b,e+ea);h=g(b,e+ia);e=g(b,e+oa);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],I[c*2],I[c*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[e*2],I[e*2+1])}var y=this,K=0,E,J=[],I=[],G,N,M,Q,F,U,D,da,j,ca,
|
|
|
|
+V,W,L,fa,aa,X,ea,ia,oa,ja,R,ga,Z,Y,la;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,e);E={signature:b.substr(K,8),header_bytes:o(b,K+8),vertex_coordinate_bytes:o(b,K+9),normal_coordinate_bytes:o(b,K+10),uv_coordinate_bytes:o(b,K+11),vertex_index_bytes:o(b,K+12),normal_index_bytes:o(b,K+13),uv_index_bytes:o(b,K+14),material_index_bytes:o(b,K+15),nvertices:g(b,K+16),nnormals:g(b,K+16+4),nuvs:g(b,K+16+8),ntri_flat:g(b,K+16+12),ntri_smooth:g(b,K+16+16),ntri_flat_uv:g(b,K+16+20),
|
|
|
|
+ntri_smooth_uv:g(b,K+16+24),nquad_flat:g(b,K+16+28),nquad_smooth:g(b,K+16+32),nquad_flat_uv:g(b,K+16+36),nquad_smooth_uv:g(b,K+16+40)};K+=E.header_bytes;G=E.vertex_index_bytes;N=E.vertex_index_bytes*2;M=E.vertex_index_bytes*3;Q=E.vertex_index_bytes*3+E.material_index_bytes;F=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;U=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;D=E.vertex_index_bytes;da=E.vertex_index_bytes*2;j=E.vertex_index_bytes*3;ca=E.vertex_index_bytes*
|
|
|
|
+4;V=E.vertex_index_bytes*4+E.material_index_bytes;W=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;L=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;fa=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;aa=E.uv_index_bytes;X=E.uv_index_bytes*2;ea=E.uv_index_bytes;ia=E.uv_index_bytes*2;oa=E.uv_index_bytes*3;e=E.vertex_index_bytes*3+E.material_index_bytes;la=E.vertex_index_bytes*4+E.material_index_bytes;ja=E.ntri_flat*e;R=E.ntri_smooth*(e+E.normal_index_bytes*
|
|
|
|
+3);ga=E.ntri_flat_uv*(e+E.uv_index_bytes*3);Z=E.ntri_smooth_uv*(e+E.normal_index_bytes*3+E.uv_index_bytes*3);Y=E.nquad_flat*la;e=E.nquad_smooth*(la+E.normal_index_bytes*4);la=E.nquad_flat_uv*(la+E.uv_index_bytes*4);K+=function(e){for(var f,g,h,j=E.vertex_coordinate_bytes*3,m=e+E.nvertices*j;e<m;e+=j)f=c(b,e),g=c(b,e+E.vertex_coordinate_bytes),h=c(b,e+E.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,h);return E.nvertices*j}(K);K+=function(e){for(var c,f,g,h=E.normal_coordinate_bytes*
|
|
|
|
+3,j=e+E.nnormals*h;e<j;e+=h)c=p(b,e),f=p(b,e+E.normal_coordinate_bytes),g=p(b,e+E.normal_coordinate_bytes*2),J.push(c/127,f/127,g/127);return E.nnormals*h}(K);K+=function(e){for(var f,g,h=E.uv_coordinate_bytes*2,j=e+E.nuvs*h;e<j;e+=h)f=c(b,e),g=c(b,e+E.uv_coordinate_bytes),I.push(f,g);return E.nuvs*h}(K);ja=K+ja;R=ja+R;ga=R+ga;Z=ga+Z;Y=Z+Y;e=Y+e;la=e+la;(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,f=c+E.uv_index_bytes*3,g=b+E.ntri_flat_uv*f;for(e=b;e<g;e+=f)u(e),B(e+c);return g-
|
|
|
|
+b})(R);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=c+E.uv_index_bytes*3,g=b+E.ntri_smooth_uv*f;for(e=b;e<g;e+=f)v(e),B(e+c);return g-b})(ga);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=c+E.uv_index_bytes*4,g=b+E.nquad_flat_uv*f;for(e=b;e<g;e+=f)w(e),A(e+c);return g-b})(e);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=c+E.uv_index_bytes*4,g=b+E.nquad_smooth_uv*f;for(e=b;e<g;e+=f)x(e),
|
|
|
|
+A(e+c);return g-b})(la);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,f=b+E.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(K);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=b+E.ntri_smooth*c;for(e=b;e<f;e+=c)v(e);return f-b})(ja);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=b+E.nquad_flat*c;for(e=b;e<f;e+=c)w(e);return f-b})(Z);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*
|
|
|
|
+4,f=b+E.nquad_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Y);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
|
|
|
|
+f3n:function(b,c,e,f,g,h,k,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],u=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(u,v,n)],null,h))},f4n:function(b,c,e,f,g,h,k,m,n,p,o){var k=b.materials[k],u=c[n*3],v=c[n*3+1],n=c[n*3+2],w=c[p*3],x=c[p*3+1],p=c[p*3+2],B=c[o*3],A=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(u,
|
|
|
|
+v,n),new THREE.Vector3(w,x,p),new THREE.Vector3(B,A,o)],null,k))},uv3:function(b,c,e,f,g,h,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,k));b.push(m)},uv4:function(b,c,e,f,g,h,k,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,k));p.push(new THREE.UV(m,n));b.push(p)}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in H.objects)if(!O.objects[v])if(G=H.objects[v],G.geometry!==void 0){if(D=O.geometries[G.geometry]){var b=!1;K=[];for(Y=0;Y<G.materials.length;Y++)K[Y]=O.materials[G.materials[Y]],b=K[Y]instanceof THREE.MeshShaderMaterial;b&&D.computeTangents();x=G.position;r=G.rotation;
|
|
|
|
-q=G.quaternion;s=G.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,K);object.name=v;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;O.scene.addObject(object);O.objects[v]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),O.scene.collisions.colliders.push(b));
|
|
|
|
-if(G.castsShadow)b=new THREE.ShadowVolume(D),O.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},O.triggers[object.name]=b)}}else x=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
|
-s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},O.triggers[object.name]=b)}function o(b){return function(c){O.geometries[b]=c;m();j-=1;e.onLoadComplete();n()}}function p(b){return function(c){O.geometries[b]=c}}function n(){e.callbackProgress({totalModels:V,totalTextures:$,loadedModels:V-j,loadedTextures:$-da},O);e.onLoadProgress();j==0&&da==0&&c(O)}
|
|
|
|
-var t,u,v,w,C,z,y,G,x,B,F,D,P,I,L,K,U,H,fa,j,da,V,$,O;H=b.data;L=new THREE.BinaryLoader;fa=new THREE.JSONLoader;da=j=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in H.objects)if(G=H.objects[v],G.meshCollider){b=!0;break}if(b)O.scene.collisions=new THREE.CollisionSystem;if(H.transform){b=H.transform.position;B=H.transform.rotation;var ea=H.transform.scale;b&&O.scene.position.set(b[0],b[1],b[2]);B&&O.scene.rotation.set(B[0],
|
|
|
|
-B[1],B[2]);ea&&O.scene.scale.set(ea[0],ea[1],ea[2]);(b||B||ea)&&O.scene.updateMatrix()}b=function(){da-=1;n();e.onLoadComplete()};for(C in H.cameras){B=H.cameras[C];if(B.type=="perspective")P=new THREE.Camera(B.fov,B.aspect,B.near,B.far);else if(B.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(B.left,B.right,B.top,B.bottom,B.near,B.far);x=B.position;B=B.target;P.position.set(x[0],x[1],x[2]);P.target.position.set(B[0],B[1],B[2]);O.cameras[C]=P}for(w in H.lights)C=H.lights[w],
|
|
|
|
-P=C.color!==void 0?C.color:16777215,B=C.intensity!==void 0?C.intensity:1,C.type=="directional"?(x=C.direction,U=new THREE.DirectionalLight(P,B),U.position.set(x[0],x[1],x[2]),U.position.normalize()):C.type=="point"?(x=C.position,d=C.distance,U=new THREE.PointLight(P,B,d),U.position.set(x[0],x[1],x[2])):C.type=="ambient"&&(U=new THREE.AmbientLight(P)),O.scene.addLight(U),O.lights[w]=U;for(z in H.fogs)w=H.fogs[z],w.type=="linear"?I=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(I=new THREE.FogExp2(0,
|
|
|
|
-w.density)),B=w.color,I.color.setRGB(B[0],B[1],B[2]),O.fogs[z]=I;if(O.cameras&&H.defaults.camera)O.currentCamera=O.cameras[H.defaults.camera];if(O.fogs&&H.defaults.fog)O.scene.fog=O.fogs[H.defaults.fog];B=H.defaults.bgcolor;O.bgColor=new THREE.Color;O.bgColor.setRGB(B[0],B[1],B[2]);O.bgColorAlpha=H.defaults.bgalpha;for(t in H.geometries)if(z=H.geometries[t],z.type=="bin_mesh"||z.type=="ascii_mesh")j+=1,e.onLoadStart();V=j;for(t in H.geometries)z=H.geometries[t],z.type=="cube"?(D=new THREE.CubeGeometry(z.width,
|
|
|
|
-z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),O.geometries[t]=D):z.type=="plane"?(D=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),O.geometries[t]=D):z.type=="sphere"?(D=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),O.geometries[t]=D):z.type=="cylinder"?(D=new THREE.CylinderGeometry(z.numSegs,z.topRad,z.botRad,z.height,z.topOffset,z.botOffset),O.geometries[t]=D):z.type=="torus"?(D=new THREE.TorusGeometry(z.radius,
|
|
|
|
-z.tube,z.segmentsR,z.segmentsT),O.geometries[t]=D):z.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(z.subdivisions),O.geometries[t]=D):z.type=="bin_mesh"?L.load({model:f(z.url,H.urlBaseType),callback:o(t)}):z.type=="ascii_mesh"?fa.load({model:f(z.url,H.urlBaseType),callback:o(t)}):z.type=="embedded_mesh"&&(z=H.embeds[z.id])&&fa.createModel(z,p(t),"");for(y in H.textures)if(t=H.textures[y],t.url instanceof Array){da+=t.url.length;for(L=0;L<t.url.length;L++)e.onLoadStart()}else da+=1,e.onLoadStart();
|
|
|
|
-$=da;for(y in H.textures){t=H.textures[y];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){L=[];for(var Y=0;Y<t.url.length;Y++)L[Y]=f(t.url[Y],H.urlBaseType);L=THREE.ImageUtils.loadTextureCube(L,t.mapping,b)}else{L=THREE.ImageUtils.loadTexture(f(t.url,H.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)L.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)L.magFilter=THREE[t.magFilter];if(t.repeat){L.repeat.set(t.repeat[0],t.repeat[1]);
|
|
|
|
-if(t.repeat[0]!=1)L.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)L.wrapT=THREE.RepeatWrapping}t.offset&&L.offset.set(t.offset[0],t.offset[1]);if(t.wrap){fa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(fa[t.wrap[0]]!==void 0)L.wrapS=fa[t.wrap[0]];if(fa[t.wrap[1]]!==void 0)L.wrapT=fa[t.wrap[1]]}}O.textures[y]=L}for(u in H.materials){y=H.materials[u];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=O.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=
|
|
|
|
-y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else if(F=="combine")y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(y.parameters[F]=="face")y.parameters[F]=THREE.FaceColors;else if(y.parameters[F])y.parameters[F]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
|
|
|
|
-!0;if(y.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);L=y.parameters.color;fa=y.parameters.specular;z=y.parameters.ambient;I=y.parameters.shininess;b.tNormal.texture=O.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
|
|
|
|
-O.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(L);b.uSpecularColor.value.setHex(fa);b.uAmbientColor.value.setHex(z);b.uShininess.value=I;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);O.materials[u]=y}m();e.callbackSync(O)}}};
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:g+"/"+b}function m(){for(w in D.objects)if(!L.objects[w])if(K=D.objects[w],K.geometry!==void 0){if(G=L.geometries[K.geometry]){var b=!1;F=[];for(aa=0;aa<K.materials.length;aa++)F[aa]=L.materials[K.materials[aa]],b=F[aa]instanceof THREE.MeshShaderMaterial;b&&G.computeTangents();E=K.position;r=
|
|
|
|
+K.rotation;q=K.quaternion;s=K.scale;q=0;F.length==0&&(F[0]=new THREE.MeshFaceMaterial);F.length>1&&(F=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,F);object.name=w;object.position.set(E[0],E[1],E[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=K.visible;L.scene.addObject(object);L.objects[w]=object;K.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
|
|
|
|
+if(K.castsShadow)b=new THREE.ShadowVolume(G),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},L.triggers[object.name]=b)}}else E=K.position,r=K.rotation,q=K.quaternion,s=K.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(E[0],E[1],E[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
|
+s[1],s[2]),object.visible=K.visible!==void 0?K.visible:!1,L.scene.addObject(object),L.objects[w]=object,L.empties[w]=object,K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},L.triggers[object.name]=b)}function n(b){return function(c){L.geometries[b]=c;m();j-=1;e.onLoadComplete();o()}}function p(b){return function(e){L.geometries[b]=e}}function o(){e.callbackProgress({totalModels:V,totalTextures:W,loadedModels:V-j,loadedTextures:W-ca},L);e.onLoadProgress();j==0&&ca==0&&c(L)}
|
|
|
|
+var u,v,w,x,B,A,y,K,E,J,I,G,N,M,Q,F,U,D,da,j,ca,V,W,L;D=b.data;Q=new THREE.BinaryLoader;da=new THREE.JSONLoader;ca=j=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in D.objects)if(K=D.objects[w],K.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(D.transform){b=D.transform.position;J=D.transform.rotation;var fa=D.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);J&&L.scene.rotation.set(J[0],
|
|
|
|
+J[1],J[2]);fa&&L.scene.scale.set(fa[0],fa[1],fa[2]);(b||J||fa)&&L.scene.updateMatrix()}b=function(){ca-=1;o();e.onLoadComplete()};for(B in D.cameras){J=D.cameras[B];if(J.type=="perspective")N=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")N=new THREE.Camera,N.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);E=J.position;J=J.target;N.position.set(E[0],E[1],E[2]);N.target.position.set(J[0],J[1],J[2]);L.cameras[B]=N}for(x in D.lights)B=D.lights[x],
|
|
|
|
+N=B.color!==void 0?B.color:16777215,J=B.intensity!==void 0?B.intensity:1,B.type=="directional"?(E=B.direction,U=new THREE.DirectionalLight(N,J),U.position.set(E[0],E[1],E[2]),U.position.normalize()):B.type=="point"?(E=B.position,d=B.distance,U=new THREE.PointLight(N,J,d),U.position.set(E[0],E[1],E[2])):B.type=="ambient"&&(U=new THREE.AmbientLight(N)),L.scene.addLight(U),L.lights[x]=U;for(A in D.fogs)x=D.fogs[A],x.type=="linear"?M=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(M=new THREE.FogExp2(0,
|
|
|
|
+x.density)),J=x.color,M.color.setRGB(J[0],J[1],J[2]),L.fogs[A]=M;if(L.cameras&&D.defaults.camera)L.currentCamera=L.cameras[D.defaults.camera];if(L.fogs&&D.defaults.fog)L.scene.fog=L.fogs[D.defaults.fog];J=D.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(J[0],J[1],J[2]);L.bgColorAlpha=D.defaults.bgalpha;for(u in D.geometries)if(A=D.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")j+=1,e.onLoadStart();V=j;for(u in D.geometries)A=D.geometries[u],A.type=="cube"?(G=new THREE.CubeGeometry(A.width,
|
|
|
|
+A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),L.geometries[u]=G):A.type=="plane"?(G=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),L.geometries[u]=G):A.type=="sphere"?(G=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),L.geometries[u]=G):A.type=="cylinder"?(G=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),L.geometries[u]=G):A.type=="torus"?(G=new THREE.TorusGeometry(A.radius,
|
|
|
|
+A.tube,A.segmentsR,A.segmentsT),L.geometries[u]=G):A.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(A.subdivisions),L.geometries[u]=G):A.type=="bin_mesh"?Q.load({model:f(A.url,D.urlBaseType),callback:n(u)}):A.type=="ascii_mesh"?da.load({model:f(A.url,D.urlBaseType),callback:n(u)}):A.type=="embedded_mesh"&&(A=D.embeds[A.id])&&da.createModel(A,p(u),"");for(y in D.textures)if(u=D.textures[y],u.url instanceof Array){ca+=u.url.length;for(Q=0;Q<u.url.length;Q++)e.onLoadStart()}else ca+=1,e.onLoadStart();
|
|
|
|
+W=ca;for(y in D.textures){u=D.textures[y];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){Q=[];for(var aa=0;aa<u.url.length;aa++)Q[aa]=f(u.url[aa],D.urlBaseType);Q=THREE.ImageUtils.loadTextureCube(Q,u.mapping,b)}else{Q=THREE.ImageUtils.loadTexture(f(u.url,D.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)Q.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)Q.magFilter=THREE[u.magFilter];if(u.repeat){Q.repeat.set(u.repeat[0],
|
|
|
|
+u.repeat[1]);if(u.repeat[0]!=1)Q.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)Q.wrapT=THREE.RepeatWrapping}u.offset&&Q.offset.set(u.offset[0],u.offset[1]);if(u.wrap){da={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(da[u.wrap[0]]!==void 0)Q.wrapS=da[u.wrap[0]];if(da[u.wrap[1]]!==void 0)Q.wrapT=da[u.wrap[1]]}}L.textures[y]=Q}for(v in D.materials){y=D.materials[v];for(I in y.parameters)if(I=="envMap"||I=="map"||I=="lightMap")y.parameters[I]=L.textures[y.parameters[I]];else if(I==
|
|
|
|
+"shading")y.parameters[I]=y.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")y.parameters[I]=THREE[y.parameters[I]]?THREE[y.parameters[I]]:THREE.NormalBlending;else if(I=="combine")y.parameters[I]=y.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(y.parameters[I]=="face")y.parameters[I]=THREE.FaceColors;else if(y.parameters[I])y.parameters[I]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<
|
|
|
|
+1)y.parameters.transparent=!0;if(y.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);Q=y.parameters.color;da=y.parameters.specular;A=y.parameters.ambient;M=y.parameters.shininess;b.tNormal.texture=L.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=
|
|
|
|
+!0;if(y.parameters.specularMap)b.tSpecular.texture=L.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(Q);b.uSpecularColor.value.setHex(da);b.uAmbientColor.value.setHex(A);b.uShininess.value=M;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);L.materials[v]=y}m();e.callbackSync(L)}}};
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m+h*this.delta;c[k+1]=o;c[k+2]=p;g[k]=this.lerp(n[b],n[b+3],h);g[k+1]=this.lerp(n[b+1],n[b+4],h);g[k+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,c,g,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m;c[k+1]=o+h*this.delta;c[k+
|
|
|
|
-2]=p;c=b+this.yd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[c+2],h)};this.VIntZ=function(b,c,g,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m;c[k+1]=o;c[k+2]=p+h*this.delta;c=b+this.zd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,k,h,m){var o=k+1,p=k+this.yd,n=k+this.zd,t=o+this.yd,u=o+this.zd,v=k+this.yd+this.zd,w=o+this.yd+this.zd,C=0,z=this.field[k],y=this.field[o],G=this.field[p],x=this.field[t],B=this.field[n],F=this.field[u],D=this.field[v],P=this.field[w];z<h&&(C|=1);y<h&&(C|=2);G<h&&(C|=8);x<h&&(C|=4);B<h&&(C|=16);F<h&&(C|=32);D<h&&(C|=128);P<h&&(C|=64);var I=THREE.edgeTable[C];if(I==0)return 0;var L=this.delta,
|
|
|
|
-K=b+L,U=c+L,L=g+L;I&1&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,0,h,b,c,g,z,y));I&2&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,3,h,K,c,g,y,x));I&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,h,b,U,g,G,x));I&8&&(this.compNorm(k),this.compNorm(p),this.VIntY(k*3,this.vlist,this.nlist,9,h,b,c,g,z,G));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,h,b,c,L,B,F));I&32&&(this.compNorm(u),
|
|
|
|
-this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,h,K,c,L,F,P));I&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,U,L,D,P));I&128&&(this.compNorm(n),this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,21,h,b,c,L,B,D));I&256&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,24,h,b,c,g,z,B));I&512&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,27,h,K,c,g,y,F));I&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
|
|
|
|
-3,this.vlist,this.nlist,30,h,K,U,g,x,P));I&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,b,U,g,G,D));C<<=4;for(h=k=0;THREE.triTable[C+h]!=-1;)b=C+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,k++;return k};this.posnormtriv=function(b,c,g,k,h,m){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[k];this.positionArray[o+
|
|
|
|
-4]=b[k+1];this.positionArray[o+5]=b[k+2];this.positionArray[o+6]=b[h];this.positionArray[o+7]=b[h+1];this.positionArray[o+8]=b[h+2];this.normalArray[o]=c[g];this.normalArray[o+1]=c[g+1];this.normalArray[o+2]=c[g+2];this.normalArray[o+3]=c[k];this.normalArray[o+4]=c[k+1];this.normalArray[o+5]=c[k+2];this.normalArray[o+6]=c[h];this.normalArray[o+7]=c[h+1];this.normalArray[o+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,k,h){var m=this.size*Math.sqrt(k/h),o=g*this.size,p=c*this.size,n=b*this.size,t=Math.floor(o-m);t<1&&(t=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(n-m);v<1&&(v=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size-
|
|
|
|
-1);for(var w,C,z,y,G,x;t<o;t++){n=this.size2*t;C=t/this.size-g;G=C*C;for(C=u;C<p;C++){z=n+this.size*C;w=C/this.size-c;x=w*w;for(w=v;w<m;w++)y=w/this.size-b,y=k/(1.0E-6+y*y+x+G)-h,y>0&&(this.field[z+w]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,m,o,p=this.size,n=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(k=g/p,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<p;k++){o=g+k*n;for(h=0;h<p;h++)u[t*h+o]+=m}};this.addPlaneY=function(b,c){var g,k,h,m,o,p,n=this.size,t=this.yd,u=
|
|
|
|
-this.zd,v=this.field,w=n*Math.sqrt(b/c);w>n&&(w=n);for(k=0;k<w;k++)if(g=k/n,g*=g,m=b/(1.0E-4+g)-c,m>0){o=k*t;for(g=0;g<n;g++){p=o+g;for(h=0;h<n;h++)v[u*h+p]+=m}}};this.addPlaneZ=function(b,c){var g,k,h,m,o,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){o=zd*h;for(k=0;k<size;k++){p=o+k*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
|
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,k,h,m,o,p,n,t,u=this.size-2;for(h=1;h<u;h++){t=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(k=1;k<u;k++){n=t+this.size*k;o=(k-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(m,o,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(k){var h,m,o,p,n,t,u,v;for(h=0;h<k.count;h++)u=h*3,n=u+1,v=u+2,m=k.positionArray[u],
|
|
|
|
-o=k.positionArray[n],p=k.positionArray[v],t=new THREE.Vector3(m,o,p),m=k.normalArray[u],o=k.normalArray[n],p=k.normalArray[v],u=new THREE.Vector3(m,o,p),u.normalize(),n=new THREE.Vertex(t),c.vertices.push(n),g.push(u);nfaces=k.count/3;for(h=0;h<nfaces;h++)u=(b+h)*3,n=u+1,v=u+2,t=g[u],m=g[n],o=g[v],u=new THREE.Face3(u,n,v,[t,m,o]),c.faces.push(u);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,k,m,n,p,o,u){k=(k-o)/(u-o);o=this.normal_cache;c[h]=m+k*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],k);g[h+1]=this.lerp(o[b+1],o[b+4],k);g[h+2]=this.lerp(o[b+2],o[b+5],k)};this.VIntY=function(b,c,g,h,k,m,n,p,o,u){k=(k-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n+k*this.delta;c[h+
|
|
|
|
+2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],k);g[h+1]=this.lerp(o[b+1],o[c+1],k);g[h+2]=this.lerp(o[b+2],o[c+2],k)};this.VIntZ=function(b,c,g,h,k,m,n,p,o,u){k=(k-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+k*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],k);g[h+1]=this.lerp(o[b+1],o[c+1],k);g[h+2]=this.lerp(o[b+2],o[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,h,k,m){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,v=n+this.zd,w=h+this.yd+this.zd,x=n+this.yd+this.zd,B=0,A=this.field[h],y=this.field[n],K=this.field[p],E=this.field[u],J=this.field[o],I=this.field[v],G=this.field[w],N=this.field[x];A<k&&(B|=1);y<k&&(B|=2);K<k&&(B|=8);E<k&&(B|=4);J<k&&(B|=16);I<k&&(B|=32);G<k&&(B|=128);N<k&&(B|=64);var M=THREE.edgeTable[B];if(M==0)return 0;var Q=this.delta,
|
|
|
|
+F=b+Q,U=c+Q,Q=g+Q;M&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,g,A,y));M&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,k,F,c,g,y,E));M&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,U,g,K,E));M&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,g,A,K));M&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,k,b,c,Q,J,I));M&32&&(this.compNorm(v),
|
|
|
|
+this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,k,F,c,Q,I,N));M&64&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,U,Q,G,N));M&128&&(this.compNorm(o),this.compNorm(w),this.VIntY(o*3,this.vlist,this.nlist,21,k,b,c,Q,J,G));M&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,g,A,J));M&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,F,c,g,y,I));M&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
|
|
|
|
+3,this.vlist,this.nlist,30,k,F,U,g,E,N));M&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,U,g,K,G));B<<=4;for(k=h=0;THREE.triTable[B+k]!=-1;)b=B+k,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),k+=3,h++;return h};this.posnormtriv=function(b,c,g,h,k,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
|
|
|
|
+4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[k];this.positionArray[n+7]=b[k+1];this.positionArray[n+8]=b[k+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[k];this.normalArray[n+7]=c[k+1];this.normalArray[n+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,h,k){var m=this.size*Math.sqrt(h/k),n=g*this.size,p=c*this.size,o=b*this.size,u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
|
|
|
|
+1);for(var x,B,A,y,K,E;u<n;u++){o=this.size2*u;B=u/this.size-g;K=B*B;for(B=v;B<p;B++){A=o+this.size*B;x=B/this.size-c;E=x*x;for(x=w;x<m;x++)y=x/this.size-b,y=h/(1.0E-6+y*y+E+K)-k,y>0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,h,k,m,n,p=this.size,o=this.yd,u=this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(g=0;g<w;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(k=0;k<p;k++)v[u*k+n]+=m}};this.addPlaneY=function(b,c){var g,h,k,m,n,p,o=this.size,u=this.yd,v=
|
|
|
|
+this.zd,w=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(h=0;h<x;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(k=0;k<o;k++)w[v*k+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,k,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(g=k/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
|
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,h,k,m,n,p,o,u,v=this.size-2;for(k=1;k<v;k++){u=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var k,m,n,p,o,u,v,w;for(k=0;k<h.count;k++)v=k*3,o=v+1,w=v+2,m=h.positionArray[v],
|
|
|
|
+n=h.positionArray[o],p=h.positionArray[w],u=new THREE.Vector3(m,n,p),m=h.normalArray[v],n=h.normalArray[o],p=h.normalArray[w],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(u),c.vertices.push(o),g.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(b+k)*3,o=v+1,w=v+2,u=g[v],m=g[o],n=g[w],v=new THREE.Face3(v,o,w,[u,m,n]),c.faces.push(v);b+=nfaces;h.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -559,23 +581,23 @@ THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.Cylinder
|
|
this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
|
|
this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
|
|
THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
|
|
THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
|
|
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,k=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>k?this.hits.push(g):this.hits.unshift(g),k=f;return this.hits};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,k=0;k<c.numFaces;k++){var h=c.mesh.geometry.faces[k],m=c.mesh.geometry.vertices[h.a].position,o=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,n=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,o,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,o,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,o,p,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,k,h){var m=THREE.CollisionSystem.__v1,o=THREE.CollisionSystem.__v2;k.set(0,0,0);m.sub(e,c);o.sub(f,e);k.cross(m,o);m=k.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)k.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=k.dot(c)-k.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)>
|
|
|
|
-Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var k=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,p=c.mesh.geometry.vertices[k.c].position,o=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
+k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h,k){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);m.sub(e,c);n.sub(f,e);h.cross(m,n);m=h.dot(b.direction);if(!(m<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;k=h.dot(c)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=m*g))return Number.MAX_VALUE;k/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(k);m.addSelf(b.origin);Math.abs(h.x)>
|
|
|
|
+Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,k=0,h=0,m=0,o=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
|
-p=!1,m=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,p=!1,o=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,p=!1,o=1);if(p)return-1;p=0;g>f&&(p=1,f=g);k>f&&(p=2,f=k);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
|
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,o)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,k=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
|
+p=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);h>f&&(p=2,f=h);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
|
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,o,p,n;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
|
|
|
|
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
|
-var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||p!==e.near||n!==e.fov){o=e.aspect;p=e.near;n=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,x=G*p/125,B=p*Math.tan(n*Math.PI/360),F;h.n14=G;m.n14=-G;G=-B*o+x;F=B*o+x;y.n11=2*p/(F-G);y.n13=(F+G)/(F-G);g.projectionMatrix=y.clone();G=-B*o-x;F=B*o-x;y.n11=2*p/(F-G);
|
|
|
|
-y.n13=(F+G)/(F-G);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,u,!0);f.call(c,w,v)}};
|
|
|
|
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,k,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;k=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
|
|
-h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}};
|
|
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,k=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
|
|
|
|
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
|
+var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var y=e.projectionMatrix.clone(),K=125/30*0.5,E=K*p/125,J=p*Math.tan(o*Math.PI/360),I;k.n14=K;m.n14=-K;K=-J*n+E;I=J*n+E;y.n11=2*p/(I-K);y.n13=(I+K)/(I-K);g.projectionMatrix=y.clone();K=-J*n-E;I=J*n-E;y.n11=2*p/(I-K);
|
|
|
|
+y.n13=(I+K)/(I-K);h.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,u,!0);h.matrix=e.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,v,!0);f.call(c,x,w)}};
|
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,k=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
|
|
|
|
+k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);m.projectionMatrix=k.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,k);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};
|