|
@@ -1,7 +1,7 @@
|
|
// Three.js r41/ROME - http://github.com/mrdoob/three.js
|
|
// Three.js r41/ROME - 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,j,k,m,n;if(e==0)f=g=j=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;j=b;break;case 2:f=b;g=e;j=c;break;case 3:f=b;g=n;j=e;break;case 4:f=c;g=b;j=e;break;case 5:f=e;g=b;j=n;break;case 6:case 0:f=e,g=c,j=b}this.setRGB(f,
|
|
|
|
-g,j)},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,61 +14,61 @@ 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;f=c.position.clone().subSelf(b).dot(e);if(f<0)return!1;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.position.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;f=c.position.clone().subSelf(b).dot(e);if(f<0)return!1;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.position.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),j=c.dot(c),c=c.dot(g),g=1/(b*j-e*e),j=(j*f-e*c)*g,b=(b*c-e*f)*g;return j>0&&b>0&&j+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,j,k,m,n,o,p,t,v,u,w=b.geometry,
|
|
|
|
-E=w.vertices,H=[],f=0;for(g=w.faces.length;f<g;f++)if(j=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(E[j.a].position.clone()),m=o.multiplyVector3(E[j.b].position.clone()),n=o.multiplyVector3(E[j.c].position.clone()),o=j instanceof THREE.Face4?o.multiplyVector3(E[j.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(k,v))/t,v=v.addSelf(u.multiplyScalar(p)),
|
|
|
|
-j instanceof THREE.Face3)e(v,k,m,n)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},H.push(j));else if(j instanceof THREE.Face4&&(e(v,k,m,o)||e(v,m,n,o)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},H.push(j);return H}else return[]}};
|
|
|
|
-THREE.Rectangle=function(){function b(){j=f-c;k=g-e}var c,e,f,g,j,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};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(j,k,p,t){m=!1;c=j;e=k;f=p;g=t;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,g=k):(c=c<j?c:j,e=e<k?e:k,f=f>j?f:j,g=g>k?g:k);b()};this.add3Points=
|
|
|
|
-function(j,k,p,t,v,u){m?(m=!1,c=j<p?j<v?j:v:p<v?p:v,e=k<t?k<u?k:u:t<u?t:u,f=j>p?j>v?j:v:p>v?p:v,g=k>t?k>u?k:u:t>u?t:u):(c=j<p?j<v?j<c?j:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c,e=k<t?k<u?k<e?k:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=j>p?j>v?j>f?j:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=k>t?k>u?k>g?k:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),g=j.getBottom()):(c=c<j.getLeft()?c:j.getLeft(),e=e<j.getTop()?e:j.getTop(),f=f>j.getRight()?f:j.getRight(),g=g>
|
|
|
|
-j.getBottom()?g:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;g+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f<j.getRight()?f:j.getRight();g=g<j.getBottom()?g:j.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,j,k,m,n,o,p,t,v,u,w,E){this.set(b||1,c||0,e||0,f||0,g||0,j||1,k||0,m||0,n||0,o||0,p||1,t||0,v||0,u||0,w||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,k,m,n,o,p,t,v,u,w,E){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=k;this.n24=m;this.n31=n;this.n32=o;this.n33=p;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=E;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,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.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*
|
|
|
|
|
|
+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,o,p,t,v,u,w=b.geometry,
|
|
|
|
+E=w.vertices,H=[],f=0;for(g=w.faces.length;f<g;f++)if(h=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(E[h.a].position.clone()),m=o.multiplyVector3(E[h.b].position.clone()),n=o.multiplyVector3(E[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(E[h.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),t=u.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(k,v))/t,v=v.addSelf(u.multiplyScalar(p)),
|
|
|
|
+h instanceof THREE.Face3)e(v,k,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},H.push(h));else if(h instanceof THREE.Face4&&(e(v,k,m,o)||e(v,m,n,o)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},H.push(h);return H}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,p,t){m=!1;c=h;e=k;f=p;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,p,t,v,u){m?(m=!1,c=h<p?h<v?h:v:p<v?p:v,e=k<t?k<u?k:u:t<u?t:u,f=h>p?h>v?h:v:p>v?p:v,g=k>t?k>u?k:u:t>u?t:u):(c=h<p?h<v?h<c?h:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c,e=k<t?k<u?k<e?k:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=h>p?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=k>t?k>u?k>g?k:g:u>g?u:g:t>u?t>g?t:g:u>g?u: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=[]};
|
|
|
|
+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,o,p,t,v,u,w,E){this.set(b||1,c||0,e||0,f||0,g||0,h||1,k||0,m||0,n||0,o||0,p||1,t||0,v||0,u||0,w||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,k,m,n,o,p,t,v,u,w,E){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=o;this.n33=p;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=E;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,j=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44,K=c.n11,A=c.n12,I=c.n13,G=c.n14,C=c.n21,R=c.n22,
|
|
|
|
-D=c.n23,N=c.n24,J=c.n31,V=c.n32,h=c.n33,X=c.n34;this.n11=e*K+f*C+g*J;this.n12=e*A+f*R+g*V;this.n13=e*I+f*D+g*h;this.n14=e*G+f*N+g*X+j;this.n21=k*K+m*C+n*J;this.n22=k*A+m*R+n*V;this.n23=k*I+m*D+n*h;this.n24=k*G+m*N+n*X+o;this.n31=p*K+t*C+v*J;this.n32=p*A+t*R+v*V;this.n33=p*I+t*D+v*h;this.n34=p*G+t*N+v*X+u;this.n41=w*K+E*C+H*J;this.n42=w*A+E*R+H*V;this.n43=w*I+E*D+H*h;this.n44=w*G+E*N+H*X+B;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]=
|
|
|
|
|
|
+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,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44,K=c.n11,A=c.n12,I=c.n13,G=c.n14,C=c.n21,R=c.n22,
|
|
|
|
+D=c.n23,N=c.n24,J=c.n31,V=c.n32,j=c.n33,X=c.n34;this.n11=e*K+f*C+g*J;this.n12=e*A+f*R+g*V;this.n13=e*I+f*D+g*j;this.n14=e*G+f*N+g*X+h;this.n21=k*K+m*C+n*J;this.n22=k*A+m*R+n*V;this.n23=k*I+m*D+n*j;this.n24=k*G+m*N+n*X+o;this.n31=p*K+t*C+v*J;this.n32=p*A+t*R+v*V;this.n33=p*I+t*D+v*j;this.n34=p*G+t*N+v*X+u;this.n41=w*K+E*C+H*J;this.n42=w*A+E*R+H*V;this.n43=w*I+E*D+H*j;this.n44=w*G+E*N+H*X+B;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;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.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,j=this.n22,k=this.n23,m=this.n24,n=this.n31,o=this.n32,p=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,E=this.n44;return f*k*o*v-e*m*o*v-f*j*p*v+c*m*p*v+e*j*t*v-c*k*t*v-f*k*n*u+e*m*n*u+f*g*p*u-b*m*p*u-e*g*t*u+b*k*t*u+f*j*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*j*t*w-e*j*n*E+c*k*n*E+e*g*o*E-b*k*o*E-c*g*p*E+b*j*p*E},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.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,o=this.n32,p=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,E=this.n44;return f*k*o*v-e*m*o*v-f*h*p*v+c*m*p*v+e*h*t*v-c*k*t*v-f*k*n*u+e*m*n*u+f*g*p*u-b*m*p*u-e*g*t*u+b*k*t*u+f*h*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*h*t*w-e*h*n*E+c*k*n*E+e*g*o*E-b*k*o*E-c*g*p*E+b*h*p*E},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
|
|
this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
|
|
this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
|
|
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
|
|
this.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},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,
|
|
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},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,k=b.y,m=b.z,n=g*j,o=g*k;this.set(n*
|
|
|
|
-j+e,n*k-f*m,n*m+f*k,0,n*k+f*m,o*k+e,o*m-f*j,0,n*m-f*k,o*m+f*j,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){var c=b.x,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*j;this.n12=-g*f;this.n13=e;this.n21=m*j+b*f;this.n22=-m*f+b*j;this.n23=-c*g;this.n31=-k*j+c*f;this.n32=k*f+c*j;this.n33=b*g;return this},
|
|
|
|
-setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c,k=e+e,m=f+f,b=c*j,n=c*k;c*=m;var o=e*k;e*=m;f*=m;j*=g;k*=g;g*=m;this.n11=1-(o+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-k;this.n32=e+j;this.n33=1-(b+o);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=
|
|
|
|
|
|
+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,h=b.x,k=b.y,m=b.z,n=g*h,o=g*k;this.set(n*
|
|
|
|
+h+e,n*k-f*m,n*m+f*k,0,n*k+f*m,o*k+e,o*m-f*h,0,n*m-f*k,o*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){var c=b.x,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*h;this.n12=-g*f;this.n13=e;this.n21=m*h+b*f;this.n22=-m*f+b*h;this.n23=-c*g;this.n31=-k*h+c*f;this.n32=k*f+c*h;this.n33=b*g;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 o=e*k;e*=m;f*=m;h*=g;k*=g;g*=m;this.n11=1-(o+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+o);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}};
|
|
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}};
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*E-o*v*E+o*t*H-m*u*H-n*t*B+m*v*B;c.n12=j*v*E-g*u*E-j*t*H+f*u*H+g*t*B-f*v*B;c.n13=g*o*E-j*n*E+j*m*H-f*o*H-g*m*B+f*n*B;c.n14=j*n*t-g*o*t-j*m*v+f*o*v+g*m*u-f*n*u;c.n21=o*v*w-n*u*w-o*p*H+k*u*H+n*p*B-k*v*B;c.n22=g*u*w-j*v*w+j*p*H-e*u*H-g*p*B+e*v*B;c.n23=j*n*w-g*o*w-j*k*H+e*o*H+g*k*B-e*n*B;c.n24=
|
|
|
|
-g*o*p-j*n*p+j*k*v-e*o*v-g*k*u+e*n*u;c.n31=m*u*w-o*t*w+o*p*E-k*u*E-m*p*B+k*t*B;c.n32=j*t*w-f*u*w-j*p*E+e*u*E+f*p*B-e*t*B;c.n33=g*o*w-j*m*w+j*k*E-e*o*E-f*k*B+e*m*B;c.n34=j*m*p-f*o*p-j*k*t+e*o*t+f*k*u-e*m*u;c.n41=n*t*w-m*v*w-n*p*E+k*v*E+m*p*H-k*t*H;c.n42=f*v*w-g*t*w+g*p*E-e*v*E-f*p*H+e*t*H;c.n43=g*m*w-f*n*w-g*k*E+e*n*E+f*k*H-e*m*H;c.n44=f*n*p-g*m*p+g*k*t-e*n*t-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,j=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,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*o;e[7]=b*p;e[8]=b*t;return c};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){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=-(j+g)/(j-g);k.n34=-2*j*g/(j-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,j){var k,m,n,o;k=new THREE.Matrix4;m=c-b;n=e-f;o=j-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/o;k.n34=-((j+g)/o);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.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,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*E-o*v*E+o*t*H-m*u*H-n*t*B+m*v*B;c.n12=h*v*E-g*u*E-h*t*H+f*u*H+g*t*B-f*v*B;c.n13=g*o*E-h*n*E+h*m*H-f*o*H-g*m*B+f*n*B;c.n14=h*n*t-g*o*t-h*m*v+f*o*v+g*m*u-f*n*u;c.n21=o*v*w-n*u*w-o*p*H+k*u*H+n*p*B-k*v*B;c.n22=g*u*w-h*v*w+h*p*H-e*u*H-g*p*B+e*v*B;c.n23=h*n*w-g*o*w-h*k*H+e*o*H+g*k*B-e*n*B;c.n24=
|
|
|
|
+g*o*p-h*n*p+h*k*v-e*o*v-g*k*u+e*n*u;c.n31=m*u*w-o*t*w+o*p*E-k*u*E-m*p*B+k*t*B;c.n32=h*t*w-f*u*w-h*p*E+e*u*E+f*p*B-e*t*B;c.n33=g*o*w-h*m*w+h*k*E-e*o*E-f*k*B+e*m*B;c.n34=h*m*p-f*o*p-h*k*t+e*o*t+f*k*u-e*m*u;c.n41=n*t*w-m*v*w-n*p*E+k*v*E+m*p*H-k*t*H;c.n42=f*v*w-g*t*w+g*p*E-e*v*E-f*p*H+e*t*H;c.n43=g*m*w-f*n*w-g*k*E+e*n*E+f*k*H-e*m*H;c.n44=f*n*p-g*m*p+g*k*t-e*n*t-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,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;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*o;e[7]=b*p;e[8]=b*t;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,o;k=new THREE.Matrix4;m=c-b;n=e-f;o=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/o;k.n34=-((h+g)/o);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.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;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;
|
|
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.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;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.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);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.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,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.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),j=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*j-m*e;this.x=k*e+m*j;this.y=f*c*j+b*g*e;this.z=b*g*j-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,j=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*j+e*m-f*k;this.y=e*b+g*k+f*j-c*m;this.z=f*b+g*m+c*k-e*j;this.w=g*b-c*j-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,j=this.x,k=this.y,m=this.z,n=this.w,o=n*e+k*g-m*f,p=
|
|
|
|
-n*f+m*e-j*g,t=n*g+j*f-k*e,e=-j*e-k*f-m*g;c.x=o*n+e*-j+p*-m-t*-k;c.y=p*n+e*-k+t*-j-o*-m;c.z=t*n+e*-m+o*-k-p*-j;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 j=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)*j)/k;f=Math.sin(f*j)/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,j){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=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
|
-THREE.Face4=function(b,c,e,f,g,j,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=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];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)};
|
|
|
|
|
|
+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,o=n*e+k*g-m*f,p=
|
|
|
|
+n*f+m*e-h*g,t=n*g+h*f-k*e,e=-h*e-k*f-m*g;c.x=o*n+e*-h+p*-m-t*-k;c.y=p*n+e*-k+t*-h-o*-m;c.z=t*n+e*-m+o*-k-p*-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,j,k,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],k=this.vertices[j.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
|
|
|
|
-m.normalize();j.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,f,j,g,D){m=b.vertices[e].position;n=b.vertices[c].position;o=b.vertices[f].position;p=k[j];t=k[g];v=k[D];u=n.x-m.x;w=o.x-m.x;E=n.y-m.y;H=o.y-m.y;B=n.z-m.z;K=o.z-m.z;A=t.u-p.u;I=v.u-p.u;G=t.v-p.v;C=v.v-p.v;R=1/(A*C-I*G);V.set((C*u-G*w)*
|
|
|
|
-R,(C*E-G*H)*R,(C*B-G*K)*R);h.set((A*w-I*u)*R,(A*H-I*E)*R,(A*K-I*B)*R);N[e].addSelf(V);N[c].addSelf(V);N[f].addSelf(V);J[e].addSelf(h);J[c].addSelf(h);J[f].addSelf(h)}var c,e,f,g,j,k,m,n,o,p,t,v,u,w,E,H,B,K,A,I,G,C,R,D,N=[],J=[],V=new THREE.Vector3,h=new THREE.Vector3,X=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,J[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],k=this.faceVertexUvs[0][c],j instanceof
|
|
|
|
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var M=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)$.copy(j.vertexNormals[f]),g=j[M[f]],D=N[g],X.copy(D),X.subSelf($.multiplyScalar($.dot(D))).normalize(),O.cross(j.vertexNormals[f],D),g=O.dot(J[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.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,h,g,D){m=b.vertices[e].position;n=b.vertices[c].position;o=b.vertices[f].position;p=k[h];t=k[g];v=k[D];u=n.x-m.x;w=o.x-m.x;E=n.y-m.y;H=o.y-m.y;B=n.z-m.z;K=o.z-m.z;A=t.u-p.u;I=v.u-p.u;G=t.v-p.v;C=v.v-p.v;R=1/(A*C-I*G);V.set((C*u-G*w)*
|
|
|
|
+R,(C*E-G*H)*R,(C*B-G*K)*R);j.set((A*w-I*u)*R,(A*H-I*E)*R,(A*K-I*B)*R);N[e].addSelf(V);N[c].addSelf(V);N[f].addSelf(V);J[e].addSelf(j);J[c].addSelf(j);J[f].addSelf(j)}var c,e,f,g,h,k,m,n,o,p,t,v,u,w,E,H,B,K,A,I,G,C,R,D,N=[],J=[],V=new THREE.Vector3,j=new THREE.Vector3,X=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,J[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 M=["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++)$.copy(h.vertexNormals[f]),g=h[M[f]],D=N[g],X.copy(D),X.subSelf($.multiplyScalar($.dot(D))).normalize(),O.cross(h.vertexNormals[f],D),g=O.dot(J[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.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,j,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];j=k.vertexIndices[1];
|
|
|
|
-k.faceIndices=m[b(g,j)].array;for(g=0;g<k.faceIndices.length;g++)j=k.faceIndices[g],k.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
|
|
|
|
-THREE.Spline=function(b){function c(b,e,c,f,j,g,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*g+b*j+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,k,m,n,o,p,t,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;j=Math.floor(g);k=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;o=this.points[e[0]];p=this.points[e[1]];
|
|
|
|
-t=this.points[e[2]];v=this.points[e[3]];m=k*k;n=k*m;f.x=c(o.x,p.x,t.x,v.x,k,m,n);f.y=c(o.y,p.y,t.y,v.y,k,m,n);f.z=c(o.z,p.z,t.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,j=new THREE.Vector3,g=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;j.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
|
|
|
|
-m+=g.distanceTo(j),j.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,j,g,k,m=[],n=new THREE.Vector3,o=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=o.chunks[e]-o.chunks[e-1];k=Math.ceil(b*c/o.total);j=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<k-1;c++)f=j+c*(1/k)*(g-j),position=this.getPoint(f),m.push(n.copy(position).clone());
|
|
|
|
|
|
+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,h,g,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*g+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,k,m,n,o,p,t,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;o=this.points[e[0]];p=this.points[e[1]];
|
|
|
|
+t=this.points[e[2]];v=this.points[e[3]];m=k*k;n=k*m;f.x=c(o.x,p.x,t.x,v.x,k,m,n);f.y=c(o.y,p.y,t.y,v.y,k,m,n);f.z=c(o.z,p.z,t.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,h=new THREE.Vector3,g=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;h.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
|
|
|
|
+m+=g.distanceTo(h),h.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,h,g,k,m=[],n=new THREE.Vector3,o=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=o.chunks[e]-o.chunks[e-1];k=Math.ceil(b*c/o.total);h=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<k-1;c++)f=h+c*(1/k)*(g-h),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;
|
|
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.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
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(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
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=
|
|
@@ -98,7 +98,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,j){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=j!==void 0?j: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;
|
|
@@ -108,12 +108,12 @@ 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,j,k,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],j=g.pos,k=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(j[0],j[1],j[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],
|
|
|
|
|
|
+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,j=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[j].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.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];this.doubleSided=this.flipSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.doubleSided=this.flipSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
THREE.Sound=function(b,c,e,f){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=c!==void 0?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,e!==void 0?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==void 0?f:!0;this.sources=b instanceof Array?b:[b];for(var g,e=this.sources.length,b=0;b<e;b++)if(c=this.sources[b],c.toLowerCase(),c.indexOf(".mp3")!==-1?g="audio/mpeg":
|
|
THREE.Sound=function(b,c,e,f){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=c!==void 0?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,e!==void 0?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==void 0?f:!0;this.sources=b instanceof Array?b:[b];for(var g,e=this.sources.length,b=0;b<e;b++)if(c=this.sources[b],c.toLowerCase(),c.indexOf(".mp3")!==-1?g="audio/mpeg":
|
|
c.indexOf(".ogg")!==-1?g="audio/ogg":c.indexOf(".wav")!==-1&&(g="audio/wav"),this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
c.indexOf(".ogg")!==-1?g="audio/ogg":c.indexOf(".wav")!==-1&&(g="audio/wav"),this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
@@ -124,13 +124,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
|
|
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,j,k,m,n,o,p,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var E=w.egdes=this.geometry.edges,H=w.edgeFaces=[];g=0;var B=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],B.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=E.length;b<c;b++)m=E[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",p=B[g]+0):e.b===k?(n="b",p=B[g]+1):e.c===k?(n="c",p=B[g]+2):e.d===k&&(n="d",p=B[g]+3),e.a===m?(n+="a",t=B[g]+0):e.b===m?(n+="b",t=B[g]+1):e.c===m?(n+="c",t=B[g]+2):e.d===m&&(n+="d",t=B[g]+3),f.a===k?(o="a",v=B[j]+0):f.b===k?(o="b",v=B[j]+1):f.c===k?(o="c",v=B[j]+2):f.d===k&&(o="d",v=B[j]+3),f.a===m?(o+="a",u=B[j]+0):f.b===m?(o+="b",u=B[j]+
|
|
|
|
-1):f.c===m?(o+="c",u=B[j]+2):f.d===m&&(o+="d",u=B[j]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?p>t&&(e=p,p=t,t=e):p<t&&(e=p,p=t,t=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(p,t,v,u),e.normal.set(1,0,0),H.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,j=g.length,k,m,n,o,p,t=["a","b","c","d"];for(n=0;n<j;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(o=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(o=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
|
|
|
|
-for(m=0;m<o;m++)p=b[k[t[m]]],c.push(new THREE.Vertex(p.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(k=j+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,j,k,m,n,o,p,t,v,u,w,E,H=0,B=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){j=c[B[w]];m=b[j];for(E=0;E<g;E++)if(k=e[B[E]],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&&(H++,H===1&&(o=m,p=n,t=j,v=k,u=B[w]),H===2))return u+=B[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[o,p,n,m],indices:[t,v,
|
|
|
|
-k,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[o,m,n,p],indices:[t,j,k,v],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,o,p,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var E=w.egdes=this.geometry.edges,H=w.edgeFaces=[];g=0;var B=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],B.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=E.length;b<c;b++)m=E[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",p=B[g]+0):e.b===k?(n="b",p=B[g]+1):e.c===k?(n="c",p=B[g]+2):e.d===k&&(n="d",p=B[g]+3),e.a===m?(n+="a",t=B[g]+0):e.b===m?(n+="b",t=B[g]+1):e.c===m?(n+="c",t=B[g]+2):e.d===m&&(n+="d",t=B[g]+3),f.a===k?(o="a",v=B[h]+0):f.b===k?(o="b",v=B[h]+1):f.c===k?(o="c",v=B[h]+2):f.d===k&&(o="d",v=B[h]+3),f.a===m?(o+="a",u=B[h]+0):f.b===m?(o+="b",u=B[h]+
|
|
|
|
+1):f.c===m?(o+="c",u=B[h]+2):f.d===m&&(o+="d",u=B[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?p>t&&(e=p,p=t,t=e):p<t&&(e=p,p=t,t=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(p,t,v,u),e.normal.set(1,0,0),H.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,h=g.length,k,m,n,o,p,t=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(o=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(o=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
|
|
|
|
+for(m=0;m<o;m++)p=b[k[t[m]]],c.push(new THREE.Vertex(p.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,o,p,t,v,u,w,E,H=0,B=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){h=c[B[w]];m=b[h];for(E=0;E<g;E++)if(k=e[B[E]],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&&(H++,H===1&&(o=m,p=n,t=h,v=k,u=B[w]),H===2))return u+=B[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[o,p,n,m],indices:[t,v,
|
|
|
|
+k,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[o,m,n,p],indices:[t,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: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=
|
|
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: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.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;
|
|
b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;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.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
|
|
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.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
|
|
@@ -139,53 +139,53 @@ 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.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[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.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var 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.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):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.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.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):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.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.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,j=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return j>=0&&g>=0&&k>=0&&m>=0?!0:j<0&&g<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-g)):g<0&&(f=Math.min(f,j/(j-g))),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,j=[],k,m,n=[],o,p,t=[],v,u=[],w,E,H=[],B,K,A=[],I=new THREE.Vector4,G=new THREE.Vector4,
|
|
|
|
|
|
+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,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return h>=0&&g>=0&&k>=0&&m>=0?!0:h<0&&g<0||k<0&&m<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),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=[],o,p,t=[],v,u=[],w,E,H=[],B,K,A=[],I=new THREE.Vector4,G=new THREE.Vector4,
|
|
C=new THREE.Matrix4,R=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var e=[],m,n,o;g=0;n=
|
|
C=new THREE.Matrix4,R=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var e=[],m,n,o;g=0;n=
|
|
-b.objects;b=0;for(m=n.length;b<m;b++){o=n[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var t=o.matrixWorld,v=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=D[u].x*t.n14+D[u].y*t.n24+D[u].z*t.n34+D[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=j[g]=j[g]||new THREE.RenderableObject,g++,f=p,I.copy(o.position),C.multiplyVector3(I),f.object=o,f.z=I.z,e.push(f)}k&&e.sort(c);return e};this.projectScene=function(f,h,j){var g=[],
|
|
|
|
-I=h.near,M=h.far,ca,U,S,ja,W,ga,Y,ha,ea,Q,T,Z,ka,na,aa,ma,ia;K=E=v=p=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);C.multiply(h.projectionMatrix,h.matrixWorldInverse);D[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);D[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);D[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);D[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);D[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);D[5].set(C.n41+C.n31,C.n42+
|
|
|
|
-C.n32,C.n43+C.n33,C.n44+C.n34);for(ca=0;ca<6;ca++)ea=D[ca],ea.divideScalar(Math.sqrt(ea.x*ea.x+ea.y*ea.y+ea.z*ea.z));ea=this.projectObjects(f,h,!0);f=0;for(ca=ea.length;f<ca;f++)if(Q=ea[f].object,Q.visible)if(T=Q.matrixWorld,Z=Q.matrixRotationWorld,ka=Q.materials,na=Q.overdraw,m=0,Q instanceof THREE.Mesh){aa=Q.geometry;ja=aa.vertices;ma=aa.faces;aa=aa.faceVertexUvs;U=0;for(S=ja.length;U<S;U++)k=b(),k.positionWorld.copy(ja[U].position),T.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
|
|
|
|
-C.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>I&&k.positionScreen.z<M;ja=0;for(U=ma.length;ja<U;ja++){S=ma[ja];if(S instanceof THREE.Face3)if(W=n[S.a],ga=n[S.b],Y=n[S.c],W.visible&&ga.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-W.positionScreen.x)*(ga.positionScreen.y-W.positionScreen.y)-(Y.positionScreen.y-W.positionScreen.y)*(ga.positionScreen.x-W.positionScreen.x)<0))ha=t[p]=
|
|
|
|
-t[p]||new THREE.RenderableFace3,p++,o=ha,o.v1.copy(W),o.v2.copy(ga),o.v3.copy(Y);else continue;else if(S instanceof THREE.Face4)if(W=n[S.a],ga=n[S.b],Y=n[S.c],ha=n[S.d],W.visible&&ga.visible&&Y.visible&&ha.visible&&(Q.doubleSided||Q.flipSided!=((ha.positionScreen.x-W.positionScreen.x)*(ga.positionScreen.y-W.positionScreen.y)-(ha.positionScreen.y-W.positionScreen.y)*(ga.positionScreen.x-W.positionScreen.x)<0||(ga.positionScreen.x-Y.positionScreen.x)*(ha.positionScreen.y-Y.positionScreen.y)-(ga.positionScreen.y-
|
|
|
|
-Y.positionScreen.y)*(ha.positionScreen.x-Y.positionScreen.x)<0)))ia=u[v]=u[v]||new THREE.RenderableFace4,v++,o=ia,o.v1.copy(W),o.v2.copy(ga),o.v3.copy(Y),o.v4.copy(ha);else continue;o.normalWorld.copy(S.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(S.centroid);T.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);Y=S.vertexNormals;W=0;for(ga=Y.length;W<ga;W++)ha=o.vertexNormalsWorld[W],ha.copy(Y[W]),Z.multiplyVector3(ha);W=0;
|
|
|
|
-for(ga=aa.length;W<ga;W++)if(ia=aa[W][ja]){Y=0;for(ha=ia.length;Y<ha;Y++)o.uvs[W][Y]=ia[Y]}o.meshMaterials=ka;o.faceMaterials=S.materials;o.overdraw=na;o.z=o.centroidScreen.z;g.push(o)}}else if(Q instanceof THREE.Line){R.multiply(C,T);ja=Q.geometry.vertices;W=b();W.positionScreen.copy(ja[0].position);R.multiplyVector4(W.positionScreen);U=1;for(S=ja.length;U<S;U++)if(W=b(),W.positionScreen.copy(ja[U].position),R.multiplyVector4(W.positionScreen),ga=n[m-2],N.copy(W.positionScreen),J.copy(ga.positionScreen),
|
|
|
|
|
|
+b.objects;b=0;for(m=n.length;b<m;b++){o=n[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var t=o.matrixWorld,v=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=D[u].x*t.n14+D[u].y*t.n24+D[u].z*t.n34+D[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,I.copy(o.position),C.multiplyVector3(I),f.object=o,f.z=I.z,e.push(f)}k&&e.sort(c);return e};this.projectScene=function(f,j,h){var g=[],
|
|
|
|
+I=j.near,M=j.far,ca,U,S,ja,W,fa,Y,ga,ea,Q,T,Z,ka,na,aa,ma,ia;K=E=v=p=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);C.multiply(j.projectionMatrix,j.matrixWorldInverse);D[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);D[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);D[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);D[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);D[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);D[5].set(C.n41+C.n31,C.n42+
|
|
|
|
+C.n32,C.n43+C.n33,C.n44+C.n34);for(ca=0;ca<6;ca++)ea=D[ca],ea.divideScalar(Math.sqrt(ea.x*ea.x+ea.y*ea.y+ea.z*ea.z));ea=this.projectObjects(f,j,!0);f=0;for(ca=ea.length;f<ca;f++)if(Q=ea[f].object,Q.visible)if(T=Q.matrixWorld,Z=Q.matrixRotationWorld,ka=Q.materials,na=Q.overdraw,m=0,Q instanceof THREE.Mesh){aa=Q.geometry;ja=aa.vertices;ma=aa.faces;aa=aa.faceVertexUvs;U=0;for(S=ja.length;U<S;U++)k=b(),k.positionWorld.copy(ja[U].position),T.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
|
|
|
|
+C.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>I&&k.positionScreen.z<M;ja=0;for(U=ma.length;ja<U;ja++){S=ma[ja];if(S instanceof THREE.Face3)if(W=n[S.a],fa=n[S.b],Y=n[S.c],W.visible&&fa.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(Y.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0))ga=t[p]=
|
|
|
|
+t[p]||new THREE.RenderableFace3,p++,o=ga,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y);else continue;else if(S instanceof THREE.Face4)if(W=n[S.a],fa=n[S.b],Y=n[S.c],ga=n[S.d],W.visible&&fa.visible&&Y.visible&&ga.visible&&(Q.doubleSided||Q.flipSided!=((ga.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(ga.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0||(fa.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(fa.positionScreen.y-
|
|
|
|
+Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0)))ia=u[v]=u[v]||new THREE.RenderableFace4,v++,o=ia,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y),o.v4.copy(ga);else continue;o.normalWorld.copy(S.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(S.centroid);T.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);Y=S.vertexNormals;W=0;for(fa=Y.length;W<fa;W++)ga=o.vertexNormalsWorld[W],ga.copy(Y[W]),Z.multiplyVector3(ga);W=0;
|
|
|
|
+for(fa=aa.length;W<fa;W++)if(ia=aa[W][ja]){Y=0;for(ga=ia.length;Y<ga;Y++)o.uvs[W][Y]=ia[Y]}o.meshMaterials=ka;o.faceMaterials=S.materials;o.overdraw=na;o.z=o.centroidScreen.z;g.push(o)}}else if(Q instanceof THREE.Line){R.multiply(C,T);ja=Q.geometry.vertices;W=b();W.positionScreen.copy(ja[0].position);R.multiplyVector4(W.positionScreen);U=1;for(S=ja.length;U<S;U++)if(W=b(),W.positionScreen.copy(ja[U].position),R.multiplyVector4(W.positionScreen),fa=n[m-2],N.copy(W.positionScreen),J.copy(fa.positionScreen),
|
|
e(N,J))N.multiplyScalar(1/N.w),J.multiplyScalar(1/J.w),T=H[E]=H[E]||new THREE.RenderableLine,E++,w=T,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(J),w.z=Math.max(N.z,J.z),w.materials=Q.materials,g.push(w)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))T=A[K]=A[K]||new THREE.RenderableParticle,K++,B=T,B.x=G.x/G.w,B.y=G.y/G.w,B.z=G.z,B.rotation=Q.rotation.z,B.scale.x=Q.scale.x*Math.abs(B.x-(G.x+
|
|
e(N,J))N.multiplyScalar(1/N.w),J.multiplyScalar(1/J.w),T=H[E]=H[E]||new THREE.RenderableLine,E++,w=T,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(J),w.z=Math.max(N.z,J.z),w.materials=Q.materials,g.push(w)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))T=A[K]=A[K]||new THREE.RenderableParticle,K++,B=T,B.x=G.x/G.w,B.y=G.y/G.w,B.z=G.z,B.rotation=Q.rotation.z,B.scale.x=Q.scale.x*Math.abs(B.x-(G.x+
|
|
-h.projectionMatrix.n11)/(G.w+h.projectionMatrix.n14)),B.scale.y=Q.scale.y*Math.abs(B.y-(G.y+h.projectionMatrix.n22)/(G.w+h.projectionMatrix.n24)),B.materials=Q.materials,g.push(B);j&&g.sort(c);return g}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var n,o,p,t,v,u,w,E;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*g+g;E=v.y*j+j;p=0;for(t=v.material.length;p<t;p++)if(u=v.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=E+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)w.globalAlpha=B=b}function e(b){if(K!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}K=b}}function f(b){if(A!=b.hex)A=b.hex,w.strokeStyle="#"+j(A.toString(16))}function g(b){if(I!=b.hex)I=b.hex,w.fillStyle="#"+j(I.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
|
-var k=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,v,u,w=o.getContext("2d"),E=new THREE.Color(0),H=0,B=1,K=0,A=null,I=null,G=null,C=null,R=null,D,N,J,V,h=new THREE.RenderableVertex,X=new THREE.RenderableVertex,O,$,M,ca,U,S,ja,W,ga,Y,ha,ea,Q=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),na=new THREE.Color(0),aa,ma,ia,pa,la,Ba,ya,da,P,za,ta=new THREE.Rectangle,fa=new THREE.Rectangle,sa=new THREE.Rectangle,
|
|
|
|
|
|
+j.projectionMatrix.n11)/(G.w+j.projectionMatrix.n14)),B.scale.y=Q.scale.y*Math.abs(B.y-(G.y+j.projectionMatrix.n22)/(G.w+j.projectionMatrix.n24)),B.materials=Q.materials,g.push(B);h&&g.sort(c);return g}};
|
|
|
|
+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,o,p,t,v,u,w,E;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*g+g;E=v.y*h+h;p=0;for(t=v.material.length;p<t;p++)if(u=v.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=E+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)w.globalAlpha=B=b}function e(b){if(K!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}K=b}}function f(b){if(A!=b.hex)A=b.hex,w.strokeStyle="#"+h(A.toString(16))}function g(b){if(I!=b.hex)I=b.hex,w.fillStyle="#"+h(I.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||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,v,u,w=o.getContext("2d"),E=new THREE.Color(0),H=0,B=1,K=0,A=null,I=null,G=null,C=null,R=null,D,N,J,V,j=new THREE.RenderableVertex,X=new THREE.RenderableVertex,O,$,M,ca,U,S,ja,W,fa,Y,ga,ea,Q=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),na=new THREE.Color(0),aa,ma,ia,pa,la,Ba,ya,da,P,za,ta=new THREE.Rectangle,ha=new THREE.Rectangle,sa=new THREE.Rectangle,
|
|
Va=!1,va=new THREE.Color,ua=new THREE.Color,Pa=new THREE.Color,Qa=new THREE.Color,qa=new THREE.Vector3,Ma,Na,Wa,wa,Oa,Ra,b=16;Ma=document.createElement("canvas");Ma.width=Ma.height=2;Na=Ma.getContext("2d");Na.fillStyle="rgba(0,0,0,1)";Na.fillRect(0,0,2,2);Wa=Na.getImageData(0,0,2,2);wa=Wa.data;Oa=document.createElement("canvas");Oa.width=Oa.height=b;Ra=Oa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
Va=!1,va=new THREE.Color,ua=new THREE.Color,Pa=new THREE.Color,Qa=new THREE.Color,qa=new THREE.Vector3,Ma,Na,Wa,wa,Oa,Ra,b=16;Ma=document.createElement("canvas");Ma.width=Ma.height=2;Na=Ma.getContext("2d");Na.fillStyle="rgba(0,0,0,1)";Na.fillRect(0,0,2,2);Wa=Na.getImageData(0,0,2,2);wa=Wa.data;Oa=document.createElement("canvas");Oa.width=Oa.height=b;Ra=Oa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
|
|
-faces:0};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.width=p;o.height=t;ta.set(-v,-u,v,u);B=1;K=0;R=C=G=I=A=null};this.setClearColor=function(b,e){E=b;H=e};this.setClearColorHex=function(b,e){E.setHex(b);H=e};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!fa.isEmpty())fa.inflate(1),fa.minSelf(ta),E.hex==0&&H==0?w.clearRect(fa.getX(),fa.getY(),fa.getWidth(),fa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*
|
|
|
|
-255)+","+H+")",w.fillRect(fa.getX(),fa.getY(),fa.getWidth(),fa.getHeight())),fa.empty()};this.render=function(b,j){function o(b){var e,c,f,h=b.lights;ua.setRGB(0,0,0);Pa.setRGB(0,0,0);Qa.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.DirectionalLight?(Pa.r+=f.r,Pa.g+=f.g,Pa.b+=f.b):c instanceof THREE.PointLight&&(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b)}function p(b,e,c,f){var h,j,g,k,m=b.lights,b=0;for(h=m.length;b<
|
|
|
|
-h;b++)j=m[b],g=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)):j instanceof THREE.PointLight&&(k=c.dot(qa.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+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)))}function t(b,h,j){c(j.opacity);e(j.blending);var k,m,fa,n,o,p;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)n=j.map.image,o=n.width>>1,p=n.height>>1,
|
|
|
|
-j=h.scale.x*v,fa=h.scale.y*u,k=j*o,m=fa*p,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(j,-fa),w.translate(-o,-p),w.drawImage(n,0,0),w.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*v,m=h.scale.y*u,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(f(j.color),g(j.color),w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(k,m),j.program(w),w.restore()))}function B(b,h,j,g){c(g.opacity);e(g.blending);
|
|
|
|
-w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(G!=b)w.lineWidth=G=b;b=g.linecap;if(C!=b)w.lineCap=C=b;b=g.linejoin;if(R!=b)w.lineJoin=R=b;f(g.color);w.stroke();sa.inflate(g.linewidth*2)}}function A(b,f,h,g,m,fa,n,o,t){k.data.vertices+=3;k.data.faces++;c(o.opacity);e(o.blending);O=b.positionScreen.x;$=b.positionScreen.y;M=f.positionScreen.x;ca=f.positionScreen.y;U=
|
|
|
|
-h.positionScreen.x;S=h.positionScreen.y;H(O,$,M,ca,U,S);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(pa=n.uvs[0],z(O,$,M,ca,U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[fa].u,pa[fa].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,qa.copy(n.vertexNormalsWorld[0]),la=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,Ba=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(n.vertexNormalsWorld[1]),
|
|
|
|
-ya=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,da=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(n.vertexNormalsWorld[2]),P=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,za=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,z(O,$,M,ca,U,S,o.envMap.image,la,Ba,ya,da,P,za)}else o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(pa=n.uvs[0],z(O,$,M,ca,U,
|
|
|
|
-S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[fa].u,pa[fa].v)),e(THREE.SubtractiveBlending)),Va?!o.wireframe&&o.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(T.r=Z.r=ka.r=ua.r,T.g=Z.g=ka.g=ua.g,T.b=Z.b=ka.b=ua.b,p(t,n.v1.positionWorld,n.vertexNormalsWorld[0],T),p(t,n.v2.positionWorld,n.vertexNormalsWorld[1],Z),p(t,n.v3.positionWorld,n.vertexNormalsWorld[2],ka),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1)):(va.r=ua.r,
|
|
|
|
-va.g=ua.g,va.b=ua.b,p(t,n.centroidWorld,n.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshDepthMaterial)aa=j.near,ma=j.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=1-Fa(f.positionScreen.z,
|
|
|
|
-aa,ma),ka.r=ka.g=ka.b=1-Fa(h.positionScreen.z,aa,ma),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(n.normalWorld.x),Q.g=Ka(n.normalWorld.y),Q.b=Ka(n.normalWorld.z),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)}function E(b,f,h,g,m,n,fa,o,t){k.data.vertices+=4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)A(b,f,g,0,1,3,fa,
|
|
|
|
-o,t),A(m,h,n,1,2,3,fa,o,t);else if(O=b.positionScreen.x,$=b.positionScreen.y,M=f.positionScreen.x,ca=f.positionScreen.y,U=h.positionScreen.x,S=h.positionScreen.y,ja=g.positionScreen.x,W=g.positionScreen.y,ga=m.positionScreen.x,Y=m.positionScreen.y,ha=n.positionScreen.x,ea=n.positionScreen.y,o instanceof THREE.MeshBasicMaterial)K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)Va?!o.wireframe&&
|
|
|
|
-o.shading==THREE.SmoothShading&&fa.vertexNormalsWorld.length==4?(T.r=Z.r=ka.r=na.r=ua.r,T.g=Z.g=ka.g=na.g=ua.g,T.b=Z.b=ka.b=na.b=ua.b,p(t,fa.v1.positionWorld,fa.vertexNormalsWorld[0],T),p(t,fa.v2.positionWorld,fa.vertexNormalsWorld[1],Z),p(t,fa.v4.positionWorld,fa.vertexNormalsWorld[3],ka),p(t,fa.v3.positionWorld,fa.vertexNormalsWorld[2],na),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(ga,Y,U,S,ha,ea),z(ga,Y,U,S,ha,ea,ia,1,0,1,1,0,1)):(va.r=ua.r,va.g=ua.g,va.b=ua.b,p(t,fa.centroidWorld,
|
|
|
|
-fa.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):(K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color));else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(fa.normalWorld.x),Q.g=Ka(fa.normalWorld.y),Q.b=Ka(fa.normalWorld.z),
|
|
|
|
-Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q);else if(o instanceof THREE.MeshDepthMaterial)aa=j.near,ma=j.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=1-Fa(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Fa(g.positionScreen.z,aa,ma),na.r=na.g=na.b=1-Fa(h.positionScreen.z,aa,ma),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(ga,Y,U,S,ha,ea),z(ga,Y,U,S,ha,ea,ia,1,0,1,1,0,1)}function H(b,e,c,f,h,j){w.beginPath();
|
|
|
|
-w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,j);w.lineTo(b,e);w.closePath()}function K(b,e,c,f,h,j,g,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,j);w.lineTo(g,k);w.lineTo(b,e);w.closePath()}function F(b,e,c,h){if(G!=e)w.lineWidth=G=e;if(C!=c)w.lineCap=C=c;if(R!=h)w.lineJoin=R=h;f(b);w.stroke();sa.inflate(e*2)}function I(b){g(b);w.fill()}function z(b,e,c,f,h,j,g,k,m,o,fa,n,p){var t,u;t=g.width-1;u=g.height-1;k*=t;m*=u;o*=t;fa*=u;n*=t;p*=u;c-=b;f-=e;h-=b;j-=e;o-=k;fa-=m;n-=k;p-=m;t=o*p-n*fa;t!=
|
|
|
|
-0&&(u=1/t,t=(p*c-fa*h)*u,fa=(p*f-fa*j)*u,c=(o*h-n*c)*u,f=(o*j-n*f)*u,b=b-t*k-c*m,e=e-fa*k-f*m,w.save(),w.transform(t,fa,c,f,b,e),w.clip(),w.drawImage(g,0,0),w.restore())}function Sa(b,e,c,f){var h=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),g=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),fa=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);wa[0]=h<0?0:h>255?255:h;wa[1]=j<0?0:j>255?255:j;wa[2]=b<0?0:b>255?255:b;wa[4]=g<0?0:g>255?255:g;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?
|
|
|
|
-255:e;wa[8]=m<0?0:m>255?255:m;wa[9]=o<0?0:o>255?255:o;wa[10]=c<0?0:c>255?255:c;wa[12]=fa<0?0:fa>255?255:fa;wa[13]=n<0?0:n>255?255:n;wa[14]=f<0?0:f>255?255:f;Na.putImageData(Wa,0,0);Ra.drawImage(Ma,0,0);return Oa}function Fa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ca(b,e){var c=e.x-b.x,f=e.y-b.y,h=1/Math.sqrt(c*c+f*f);c*=h;f*=h;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,$a,oa,xa,Da,La,Ua,L;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);k.data.vertices=
|
|
|
|
-0;k.data.faces=0;m=n.projectScene(b,j,this.sortElements);(Va=b.lights.length>0)&&o(b);Ta=0;for($a=m.length;Ta<$a;Ta++){oa=m[Ta];sa.empty();if(oa instanceof THREE.RenderableParticle){D=oa;D.x*=v;D.y*=u;xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&t(D,oa,L,b)}else if(oa instanceof THREE.RenderableLine){if(D=oa.v1,N=oa.v2,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,
|
|
|
|
|
|
+faces:0};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.width=p;o.height=t;ta.set(-v,-u,v,u);B=1;K=0;R=C=G=I=A=null};this.setClearColor=function(b,e){E=b;H=e};this.setClearColorHex=function(b,e){E.setHex(b);H=e};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!ha.isEmpty())ha.inflate(1),ha.minSelf(ta),E.hex==0&&H==0?w.clearRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*
|
|
|
|
+255)+","+H+")",w.fillRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight())),ha.empty()};this.render=function(b,h){function o(b){var e,c,f,j=b.lights;ua.setRGB(0,0,0);Pa.setRGB(0,0,0);Qa.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.DirectionalLight?(Pa.r+=f.r,Pa.g+=f.g,Pa.b+=f.b):c instanceof THREE.PointLight&&(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b)}function p(b,e,c,f){var j,h,g,k,m=b.lights,b=0;for(j=m.length;b<
|
|
|
|
+j;b++)h=m[b],g=h.color,h instanceof THREE.DirectionalLight?(k=c.dot(h.position),k<=0||(k*=h.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)):h instanceof THREE.PointLight&&(k=c.dot(qa.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+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,ha,n,o,p;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=h.map.image,o=n.width>>1,p=n.height>>1,
|
|
|
|
+h=j.scale.x*v,ha=j.scale.y*u,k=h*o,m=ha*p,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-ha),w.translate(-o,-p),w.drawImage(n,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(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 B(b,j,h,g){c(g.opacity);e(g.blending);
|
|
|
|
+w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(G!=b)w.lineWidth=G=b;b=g.linecap;if(C!=b)w.lineCap=C=b;b=g.linejoin;if(R!=b)w.lineJoin=R=b;f(g.color);w.stroke();sa.inflate(g.linewidth*2)}}function A(b,f,j,g,m,n,ha,o,t){k.data.vertices+=3;k.data.faces++;c(o.opacity);e(o.blending);O=b.positionScreen.x;$=b.positionScreen.y;M=f.positionScreen.x;ca=f.positionScreen.y;U=
|
|
|
|
+j.positionScreen.x;S=j.positionScreen.y;H(O,$,M,ca,U,S);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(pa=ha.uvs[0],z(O,$,M,ca,U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,qa.copy(ha.vertexNormalsWorld[0]),la=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,Ba=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ha.vertexNormalsWorld[1]),
|
|
|
|
+ya=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,da=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ha.vertexNormalsWorld[2]),P=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,za=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,z(O,$,M,ca,U,S,o.envMap.image,la,Ba,ya,da,P,za)}else o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(pa=ha.uvs[0],z(O,$,M,ca,
|
|
|
|
+U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v)),e(THREE.SubtractiveBlending)),Va?!o.wireframe&&o.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3?(T.r=Z.r=ka.r=ua.r,T.g=Z.g=ka.g=ua.g,T.b=Z.b=ka.b=ua.b,p(t,ha.v1.positionWorld,ha.vertexNormalsWorld[0],T),p(t,ha.v2.positionWorld,ha.vertexNormalsWorld[1],Z),p(t,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ka),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1)):(va.r=
|
|
|
|
+ua.r,va.g=ua.g,va.b=ua.b,p(t,ha.centroidWorld,ha.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshDepthMaterial)aa=h.near,ma=h.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=
|
|
|
|
+1-Fa(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Fa(j.positionScreen.z,aa,ma),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(ha.normalWorld.x),Q.g=Ka(ha.normalWorld.y),Q.b=Ka(ha.normalWorld.z),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)}function E(b,f,j,g,m,ha,n,o,t){k.data.vertices+=4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||
|
|
|
|
+o.envMap)A(b,f,g,0,1,3,n,o,t),A(m,j,ha,1,2,3,n,o,t);else if(O=b.positionScreen.x,$=b.positionScreen.y,M=f.positionScreen.x,ca=f.positionScreen.y,U=j.positionScreen.x,S=j.positionScreen.y,ja=g.positionScreen.x,W=g.positionScreen.y,fa=m.positionScreen.x,Y=m.positionScreen.y,ga=ha.positionScreen.x,ea=ha.positionScreen.y,o instanceof THREE.MeshBasicMaterial)K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)Va?
|
|
|
|
+!o.wireframe&&o.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(T.r=Z.r=ka.r=na.r=ua.r,T.g=Z.g=ka.g=na.g=ua.g,T.b=Z.b=ka.b=na.b=ua.b,p(t,n.v1.positionWorld,n.vertexNormalsWorld[0],T),p(t,n.v2.positionWorld,n.vertexNormalsWorld[1],Z),p(t,n.v4.positionWorld,n.vertexNormalsWorld[3],ka),p(t,n.v3.positionWorld,n.vertexNormalsWorld[2],na),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(fa,Y,U,S,ga,ea),z(fa,Y,U,S,ga,ea,ia,1,0,1,1,0,1)):(va.r=ua.r,va.g=ua.g,va.b=ua.b,p(t,
|
|
|
|
+n.centroidWorld,n.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):(K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color));else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(n.normalWorld.x),Q.g=Ka(n.normalWorld.y),Q.b=Ka(n.normalWorld.z),
|
|
|
|
+Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q);else if(o instanceof THREE.MeshDepthMaterial)aa=h.near,ma=h.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=1-Fa(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Fa(g.positionScreen.z,aa,ma),na.r=na.g=na.b=1-Fa(j.positionScreen.z,aa,ma),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(fa,Y,U,S,ga,ea),z(fa,Y,U,S,ga,ea,ia,1,0,1,1,0,1)}function H(b,e,c,f,j,h){w.beginPath();
|
|
|
|
+w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,h);w.lineTo(b,e);w.closePath()}function K(b,e,c,f,j,h,g,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,h);w.lineTo(g,k);w.lineTo(b,e);w.closePath()}function F(b,e,c,j){if(G!=e)w.lineWidth=G=e;if(C!=c)w.lineCap=C=c;if(R!=j)w.lineJoin=R=j;f(b);w.stroke();sa.inflate(e*2)}function I(b){g(b);w.fill()}function z(b,e,c,f,j,h,g,k,m,o,n,ha,p){var t,u;t=g.width-1;u=g.height-1;k*=t;m*=u;o*=t;n*=u;ha*=t;p*=u;c-=b;f-=e;j-=b;h-=e;o-=k;n-=m;ha-=k;p-=m;t=o*p-ha*n;t!=
|
|
|
|
+0&&(u=1/t,t=(p*c-n*j)*u,n=(p*f-n*h)*u,c=(o*j-ha*c)*u,f=(o*h-ha*f)*u,b=b-t*k-c*m,e=e-n*k-f*m,w.save(),w.transform(t,n,c,f,b,e),w.clip(),w.drawImage(g,0,0),w.restore())}function Sa(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),g=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),ha=~~(f.g*255),f=~~(f.b*255);wa[0]=j<0?0:j>255?255:j;wa[1]=h<0?0:h>255?255:h;wa[2]=b<0?0:b>255?255:b;wa[4]=g<0?0:g>255?255:g;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:
|
|
|
|
+e;wa[8]=m<0?0:m>255?255:m;wa[9]=o<0?0:o>255?255:o;wa[10]=c<0?0:c>255?255:c;wa[12]=n<0?0:n>255?255:n;wa[13]=ha<0?0:ha>255?255:ha;wa[14]=f<0?0:f>255?255:f;Na.putImageData(Wa,0,0);Ra.drawImage(Ma,0,0);return Oa}function Fa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ca(b,e){var c=e.x-b.x,f=e.y-b.y,j=1/Math.sqrt(c*c+f*f);c*=j;f*=j;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,$a,oa,xa,Da,La,Ua,L;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);k.data.vertices=
|
|
|
|
+0;k.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Va=b.lights.length>0)&&o(b);Ta=0;for($a=m.length;Ta<$a;Ta++){oa=m[Ta];sa.empty();if(oa instanceof THREE.RenderableParticle){D=oa;D.x*=v;D.y*=u;xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&t(D,oa,L,b)}else if(oa instanceof THREE.RenderableLine){if(D=oa.v1,N=oa.v2,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,
|
|
N.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&B(D,N,oa,L,b)}}else if(oa instanceof THREE.RenderableFace3){if(D=oa.v1,N=oa.v2,J=oa.v3,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,J.positionScreen.x*=v,J.positionScreen.y*=u,oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,J.positionScreen),Ca(J.positionScreen,D.positionScreen)),sa.add3Points(D.positionScreen.x,D.positionScreen.y,
|
|
N.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&B(D,N,oa,L,b)}}else if(oa instanceof THREE.RenderableFace3){if(D=oa.v1,N=oa.v2,J=oa.v3,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,J.positionScreen.x*=v,J.positionScreen.y*=u,oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,J.positionScreen),Ca(J.positionScreen,D.positionScreen)),sa.add3Points(D.positionScreen.x,D.positionScreen.y,
|
|
N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}else L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}}else if(oa instanceof THREE.RenderableFace4&&(D=oa.v1,N=oa.v2,J=oa.v3,V=oa.v4,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=
|
|
N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}else L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}}else if(oa instanceof THREE.RenderableFace4&&(D=oa.v1,N=oa.v2,J=oa.v3,V=oa.v4,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=
|
|
-u,J.positionScreen.x*=v,J.positionScreen.y*=u,V.positionScreen.x*=v,V.positionScreen.y*=u,h.positionScreen.copy(N.positionScreen),X.positionScreen.copy(V.positionScreen),oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,V.positionScreen),Ca(V.positionScreen,D.positionScreen),Ca(J.positionScreen,h.positionScreen),Ca(J.positionScreen,X.positionScreen)),sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(J.positionScreen.x,
|
|
|
|
-J.positionScreen.y),sa.addPoint(V.positionScreen.x,V.positionScreen.y),ta.instersects(sa))){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&E(D,N,J,V,h,X,oa,L,b)}else L.opacity!=0&&E(D,N,J,V,h,X,oa,L,b)}fa.addRectangle(sa)}w.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,h,j,g;f=0;for(h=b.lights.length;f<h;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(g=e.normalWorld.dot(j.position)*j.intensity,g>0&&(c.r+=j.color.r*g,c.g+=j.color.g*g,c.b+=j.color.b*g)):j instanceof THREE.PointLight&&(V.sub(j.position,e.centroidWorld),V.normalize(),g=e.normalWorld.dot(V)*j.intensity,g>0&&(c.r+=j.color.r*g,c.g+=j.color.g*g,c.b+=j.color.b*g))}function c(e,c,h,m,n,p){k.data.vertices+=3;k.data.faces++;O=f($++);O.setAttribute("d",
|
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(p,m,C),G.r=Math.max(0,Math.min(n.color.r*C.r,1)),G.g=Math.max(0,Math.min(n.color.g*C.g,1)),G.b=Math.max(0,Math.min(n.color.b*C.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
|
|
|
|
-m.z*n.__farMinusNear),G.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(O)}function e(e,c,h,m,
|
|
|
|
-n,p,t){k.data.vertices+=4;k.data.faces++;O=f($++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(t,n,C),G.r=Math.max(0,Math.min(p.color.r*C.r,1)),G.g=Math.max(0,Math.min(p.color.g*C.g,1)),G.b=Math.max(0,Math.min(p.color.b*
|
|
|
|
-C.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(J=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(J,J,J)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style",
|
|
|
|
-"fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(O)}function f(b){h[b]==null&&(h[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ca==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 j(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,v,u,w,E,H,B,K=new THREE.Rectangle,A=new THREE.Rectangle,
|
|
|
|
-I=!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),R=new THREE.Color(0),D=new THREE.Color(0),N=new THREE.Color(0),J,V=new THREE.Vector3,h=[],X=[],O,$,M,ca=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ca=1;break;case "low":ca=0}};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.setAttribute("viewBox",-v+" "+-u+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);K.set(-v,
|
|
|
|
--u,v,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var h,g,p,t,C,G,J,T;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);M=$=0;if(I=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);D.setRGB(0,0,0);N.setRGB(0,0,0);h=0;for(g=J.length;h<g;h++)p=J[h],t=p.color,p instanceof THREE.AmbientLight?(R.r+=t.r,R.g+=t.g,R.b+=t.b):p instanceof THREE.DirectionalLight?(D.r+=t.r,D.g+=t.g,D.b+=t.b):p instanceof
|
|
|
|
-THREE.PointLight&&(N.r+=t.r,N.g+=t.g,N.b+=t.b)}h=0;for(g=m.length;h<g;h++)if(J=m[h],A.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=v;w.y*=-u;p=0;for(t=J.materials.length;p<t;)p++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,E=J.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),K.instersects(A)){p=0;for(t=J.materials.length;p<t;)if((T=J.materials[p++])&&
|
|
|
|
-T.opacity!=0){C=w;G=E;var V=M++;X[V]==null&&(X[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),ca==0&&X[V].setAttribute("shape-rendering","crispEdges"));O=X[V];O.setAttribute("x1",C.positionScreen.x);O.setAttribute("y1",C.positionScreen.y);O.setAttribute("x2",G.positionScreen.x);O.setAttribute("y2",G.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+j(T.color.hex.toString(16))+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+
|
|
|
|
|
|
+u,J.positionScreen.x*=v,J.positionScreen.y*=u,V.positionScreen.x*=v,V.positionScreen.y*=u,j.positionScreen.copy(N.positionScreen),X.positionScreen.copy(V.positionScreen),oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,V.positionScreen),Ca(V.positionScreen,D.positionScreen),Ca(J.positionScreen,j.positionScreen),Ca(J.positionScreen,X.positionScreen)),sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(J.positionScreen.x,
|
|
|
|
+J.positionScreen.y),sa.addPoint(V.positionScreen.x,V.positionScreen.y),ta.instersects(sa))){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&E(D,N,J,V,j,X,oa,L,b)}else L.opacity!=0&&E(D,N,J,V,j,X,oa,L,b)}ha.addRectangle(sa)}w.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,j,h,g;f=0;for(j=b.lights.length;f<j;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(g=e.normalWorld.dot(h.position)*h.intensity,g>0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g)):h instanceof THREE.PointLight&&(V.sub(h.position,e.centroidWorld),V.normalize(),g=e.normalWorld.dot(V)*h.intensity,g>0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g))}function c(e,c,j,m,n,p){k.data.vertices+=3;k.data.faces++;O=f($++);O.setAttribute("d",
|
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(p,m,C),G.r=Math.max(0,Math.min(n.color.r*C.r,1)),G.g=Math.max(0,Math.min(n.color.g*C.g,1)),G.b=Math.max(0,Math.min(n.color.b*C.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
|
|
|
|
+m.z*n.__farMinusNear),G.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(O)}function e(e,c,j,m,
|
|
|
|
+n,p,t){k.data.vertices+=4;k.data.faces++;O=f($++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(t,n,C),G.r=Math.max(0,Math.min(p.color.r*C.r,1)),G.g=Math.max(0,Math.min(p.color.g*C.g,1)),G.b=Math.max(0,Math.min(p.color.b*
|
|
|
|
+C.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(J=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(J,J,J)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style",
|
|
|
|
+"fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(O)}function f(b){j[b]==null&&(j[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ca==0&&j[b].setAttribute("shape-rendering","crispEdges"));return j[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,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,v,u,w,E,H,B,K=new THREE.Rectangle,A=new THREE.Rectangle,
|
|
|
|
+I=!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),R=new THREE.Color(0),D=new THREE.Color(0),N=new THREE.Color(0),J,V=new THREE.Vector3,j=[],X=[],O,$,M,ca=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ca=1;break;case "low":ca=0}};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.setAttribute("viewBox",-v+" "+-u+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);K.set(-v,
|
|
|
|
+-u,v,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var j,g,p,t,C,G,J,T;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);M=$=0;if(I=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);D.setRGB(0,0,0);N.setRGB(0,0,0);j=0;for(g=J.length;j<g;j++)p=J[j],t=p.color,p instanceof THREE.AmbientLight?(R.r+=t.r,R.g+=t.g,R.b+=t.b):p instanceof THREE.DirectionalLight?(D.r+=t.r,D.g+=t.g,D.b+=t.b):p instanceof
|
|
|
|
+THREE.PointLight&&(N.r+=t.r,N.g+=t.g,N.b+=t.b)}j=0;for(g=m.length;j<g;j++)if(J=m[j],A.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=v;w.y*=-u;p=0;for(t=J.materials.length;p<t;)p++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,E=J.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),K.instersects(A)){p=0;for(t=J.materials.length;p<t;)if((T=J.materials[p++])&&
|
|
|
|
+T.opacity!=0){C=w;G=E;var V=M++;X[V]==null&&(X[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),ca==0&&X[V].setAttribute("shape-rendering","crispEdges"));O=X[V];O.setAttribute("x1",C.positionScreen.x);O.setAttribute("y1",C.positionScreen.y);O.setAttribute("x2",G.positionScreen.x);O.setAttribute("y2",G.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+h(T.color.hex.toString(16))+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+
|
|
T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),o.appendChild(O))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,E=J.v2,H=J.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),K.instersects(A)){p=0;for(t=J.meshMaterials.length;p<
|
|
T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),o.appendChild(O))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,E=J.v2,H=J.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),K.instersects(A)){p=0;for(t=J.meshMaterials.length;p<
|
|
t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&c(w,E,H,J,T,b)}else T&&T.opacity!=0&&c(w,E,H,J,T,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,E=J.v2,H=J.v3,B=J.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,B.positionScreen.x*=v,B.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,
|
|
t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&c(w,E,H,J,T,b)}else T&&T.opacity!=0&&c(w,E,H,J,T,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,E=J.v2,H=J.v3,B=J.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,B.positionScreen.x*=v,B.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,
|
|
E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),K.instersects(A))){p=0;for(t=J.meshMaterials.length;p<t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&e(w,E,H,B,J,T,b)}else T&&T.opacity!=0&&e(w,E,H,B,J,T,b)}}};
|
|
E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),K.instersects(A))){p=0;for(t=J.meshMaterials.length;p<t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&e(w,E,H,B,J,T,b)}else T&&T.opacity!=0&&e(w,E,H,B,J,T,b)}}};
|
|
@@ -220,52 +220,52 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
|
|
"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,
|
|
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.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,j,g,k=b.vertices,m=k.length,n=b.colors,o=n.length,p=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Q.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)j=k[f].position,ka.copy(j),Q.multiplyVector3(ka),u[f]=[ka.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)j=k[u[f][1]].position,g=f*3,p[g]=j.x,p[g+1]=j.y,p[g+2]=j.z;for(f=0;f<o;f++)g=f*3,color=n[u[f][1]],t[g]=color.r,t[g+1]=color.g,
|
|
|
|
-t[g+2]=color.b}else{if(v)for(f=0;f<m;f++)j=k[f].position,g=f*3,p[g]=j.x,p[g+1]=j.y,p[g+2]=j.z;if(w)for(f=0;f<o;f++)color=n[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b}if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,p,e);if(w||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,t,e)}function e(b,e,c,f,j){f.program||V.initMaterial(f,e,c,j);var g=f.program,k=g.uniforms,m=f.uniforms;g!=O&&(h.useProgram(g),
|
|
|
|
-O=g);h.uniformMatrix4fv(k.projectionMatrix,!1,T);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,
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,h,g,k=b.vertices,m=k.length,n=b.colors,o=n.length,p=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Q.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=k[f].position,ka.copy(h),Q.multiplyVector3(ka),u[f]=[ka.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=k[u[f][1]].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;for(f=0;f<o;f++)g=f*3,color=n[u[f][1]],t[g]=color.r,t[g+1]=color.g,
|
|
|
|
+t[g+2]=color.b}else{if(v)for(f=0;f<m;f++)h=k[f].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;if(w)for(f=0;f<o;f++)color=n[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+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,t,e)}function e(b,e,c,f,h){f.program||V.initMaterial(f,e,c,h);var g=f.program,k=g.uniforms,m=f.uniforms;g!=O&&(j.useProgram(g),
|
|
|
|
+O=g);j.uniformMatrix4fv(k.projectionMatrix,!1,T);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,
|
|
o,p=0,t=0,u=0,v,w,B,A,E=na,H=E.directional.colors,J=E.directional.positions,I=E.point.colors,K=E.point.positions,ma=E.point.distances,D=0,F=0,c=o=A=0;for(n=e.length;c<n;c++)if(o=e[c],v=o.color,w=o.position,B=o.intensity,A=o.distance,o instanceof THREE.AmbientLight)p+=v.r,t+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)A=D*3,H[A]=v.r*B,H[A+1]=v.g*B,H[A+2]=v.b*B,J[A]=w.x,J[A+1]=w.y,J[A+2]=w.z,D+=1;else if(o instanceof THREE.PointLight)o=F*3,I[o]=v.r*B,I[o+1]=v.g*B,I[o+2]=v.b*B,K[o]=w.x,K[o+
|
|
o,p=0,t=0,u=0,v,w,B,A,E=na,H=E.directional.colors,J=E.directional.positions,I=E.point.colors,K=E.point.positions,ma=E.point.distances,D=0,F=0,c=o=A=0;for(n=e.length;c<n;c++)if(o=e[c],v=o.color,w=o.position,B=o.intensity,A=o.distance,o instanceof THREE.AmbientLight)p+=v.r,t+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)A=D*3,H[A]=v.r*B,H[A+1]=v.g*B,H[A+2]=v.b*B,J[A]=w.x,J[A+1]=w.y,J[A+2]=w.z,D+=1;else if(o instanceof THREE.PointLight)o=F*3,I[o]=v.r*B,I[o+1]=v.g*B,I[o+2]=v.b*B,K[o]=w.x,K[o+
|
|
1]=w.y,K[o+2]=w.z,ma[F]=A,F+=1;for(c=D*3;c<H.length;c++)H[c]=0;for(c=F*3;c<I.length;c++)I[c]=0;E.point.length=F;E.directional.length=D;E.ambient[0]=p;E.ambient[1]=t;E.ambient[2]=u;c=na;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
|
|
1]=w.y,K[o+2]=w.z,ma[F]=A,F+=1;for(c=D*3;c<H.length;c++)H[c]=0;for(c=F*3;c<I.length;c++)I[c]=0;E.point.length=F;E.directional.length=D;E.ambient[0]=p;E.ambient[1]=t;E.ambient[2]=u;c=na;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=aa.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
|
|
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=aa.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 N in m)if(t=g.uniforms[N])if(n=m[N],p=n.type,c=n.value,p=="i")h.uniform1i(t,c);else if(p=="f")h.uniform1f(t,c);else if(p=="fv1")h.uniform1fv(t,c);else if(p=="fv")h.uniform3fv(t,c);else if(p=="v2")h.uniform2f(t,c.x,c.y);else if(p=="v3")h.uniform3f(t,c.x,c.y,c.z);else if(p=="v4")h.uniform4f(t,c.x,c.y,c.z,c.w);else if(p=="c")h.uniform3f(t,c.r,c.g,c.b);else if(p=="t"&&(h.uniform1i(t,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
|
|
|
|
-6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,h.RGBA,h.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}G(h.TEXTURE_CUBE_MAP,n,n.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,
|
|
|
|
-null);n.needsUpdate=!1}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else C(n,c);h.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);h.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&h.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
|
|
|
|
-null&&h.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&h.uniformMatrix4fv(k.viewMatrix,!1,Z);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,h.uniform3fv(k.directionalLightDirection,b),h.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray),
|
|
|
|
-h.uniformMatrix4fv(k.viewMatrix,!1,Z);f.skinning&&(h.uniformMatrix4fv(k.cameraInverseMatrix,!1,Z),h.uniformMatrix4fv(k.boneGlobalMatrices,!1,j.boneMatrices));return g}function f(b,c,f,j,g,k){if(j.opacity!=0){var m,b=e(b,c,f,j,k).attributes;if(!j.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,!1,0,0);else{c=j.program.attributes;k.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k.morphTargetBase]),
|
|
|
|
-h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,o=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<n.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),h.vertexAttribPointer(c["morphTarget"+f],3,h.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],p=-1,
|
|
|
|
-t=0,o=k.morphTargetInfluences,u,v=o.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&o[u]>p&&(t=u,p=o[t]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);h.vertexAttribPointer(c["morphTarget"+f],3,h.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;n[t]=1;p=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&h.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=
|
|
|
|
-0&&(c=g.__webglCustomAttributes[m],h.bindBuffer(h.ARRAY_BUFFER,c.buffer),h.vertexAttribPointer(b[m],c.size,h.FLOAT,!1,0,0));b.color>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,!1,0,0));b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,!1,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER,
|
|
|
|
-g.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.vertexAttribPointer(b.uv2,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4,
|
|
|
|
-h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,4,h.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(h.lineWidth(j.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount,
|
|
|
|
-h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),V.data.vertices+=g.__webglFaceCount,V.data.faces+=g.__webglFaceCount/3,V.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(j.linewidth),h.drawArrays(k,0,g.__webglLineCount),V.data.drawCalls++):k instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),V.data.drawCalls++):k instanceof
|
|
|
|
-THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),V.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(e.attributes.position),h.vertexAttribPointer(e.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,
|
|
|
|
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,j,k,m,n,o,p,t,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],j=c[u+2],k=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],o=c[u+7],t=c[u+8],f=(f+k+m)/3,g=(g+n+o)/3,j=(j+p+t)/3,c[u]=f,c[u+1]=g,c[u+2]=j,c[u+3]=f,c[u+4]=g,c[u+5]=j,c[u+6]=f,c[u+7]=g,c[u+8]=j}h.bufferData(h.ARRAY_BUFFER,b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(e.attributes.normal);h.vertexAttribPointer(e.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,
|
|
|
|
-0,b.count);b.count=0}function j(b){if(ca!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),ca=b.doubleSided;if(U!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),U=b.flipSided}function k(b){ja!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),ja=b)}function m(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,
|
|
|
|
|
|
+THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var N in m)if(t=g.uniforms[N])if(n=m[N],p=n.type,c=n.value,p=="i")j.uniform1i(t,c);else if(p=="f")j.uniform1f(t,c);else if(p=="fv1")j.uniform1fv(t,c);else if(p=="fv")j.uniform3fv(t,c);else if(p=="v2")j.uniform2f(t,c.x,c.y);else if(p=="v3")j.uniform3f(t,c.x,c.y,c.z);else if(p=="v4")j.uniform4f(t,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(t,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(t,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}G(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 C(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,h._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,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,Z);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,h._objectMatrixArray),
|
|
|
|
+j.uniformMatrix4fv(k.viewMatrix,!1,Z);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,Z),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,k){if(h.opacity!=0){var m,b=e(b,c,f,h,k).attributes;if(!h.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=h.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k.morphTargetBase]),
|
|
|
|
+j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,o=k.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],p=-1,
|
|
|
|
+t=0,o=k.morphTargetInfluences,u,v=o.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&o[u]>p&&(t=u,p=o[t]);j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;n[t]=1;p=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(h.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=
|
|
|
|
+0&&(c=g.__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,g.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+g.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
|
|
|
|
+j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(h.wireframe?(j.lineWidth(h.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.drawElements(j.LINES,g.__webglLineCount,
|
|
|
|
+j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.drawElements(j.TRIANGLES,g.__webglFaceCount,j.UNSIGNED_SHORT,0)),V.data.vertices+=g.__webglFaceCount,V.data.faces+=g.__webglFaceCount/3,V.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(h.linewidth),j.drawArrays(k,0,g.__webglLineCount),V.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,g.__webglParticleCount),V.data.drawCalls++):k instanceof
|
|
|
|
+THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,g.__webglVertexCount),V.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,o,p,t,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],k=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],o=c[u+7],t=c[u+8],f=(f+k+m)/3,h=(h+n+o)/3,g=(g+p+t)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+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(ca!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=b.doubleSided;if(U!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),U=b.flipSided}function k(b){ja!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ja=b)}function m(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,
|
|
b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ea[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ea[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=ea[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function n(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=ea[f].x*e.n14+ea[f].y*e.n24+ea[f].z*e.n34+ea[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function p(b){var e,
|
|
b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ea[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ea[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=ea[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function n(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=ea[f].x*e.n14+ea[f].y*e.n24+ea[f].z*e.n34+ea[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function p(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 t(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 v(b,e){return e.z-b.z}function u(b){h.enable(h.POLYGON_OFFSET_FILL);
|
|
|
|
-h.polygonOffset(0.1,1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var e,c=b.lights.length,f,g=b.lights,j=[],k,m,n,o,p,t=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){j[0]=-f.position.x;j[1]=-f.position.y;j[2]=-f.position.z;for(p=0;p<t;p++)f=b.__webglShadowVolumes[p].object,
|
|
|
|
-k=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||V.initMaterial(m,g,void 0,f),m=m.program,n=m.uniforms,o=m.attributes,O!==m&&(h.useProgram(m),O=m,h.uniformMatrix4fv(n.projectionMatrix,!1,T),h.uniformMatrix4fv(n.viewMatrix,!1,Z),h.uniform3fv(n.directionalLightDirection,j)),f.matrixWorld.flattenToArray(f._objectMatrixArray),h.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,k.__webglVertexBuffer),h.vertexAttribPointer(o.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
|
|
|
|
-k.__webglNormalBuffer),h.vertexAttribPointer(o.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,k.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,k.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);S=-1;O=da.program;h.useProgram(da.program);h.uniformMatrix4fv(da.projectionLocation,
|
|
|
|
-!1,T);h.uniform1f(da.darknessLocation,da.darkness);h.bindBuffer(h.ARRAY_BUFFER,da.vertexBuffer);h.vertexAttribPointer(da.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(da.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,da.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(M)}function w(b,e){var c,f,g;c=_sprite.attributes;var j=_sprite.uniforms,
|
|
|
|
-k=ha/Y,m,n=[],o=Y*0.5,p=ha*0.5,t=!0;h.useProgram(_sprite.program);O=_sprite.program;S=-1;ta||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),ta=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.uniformMatrix4fv(j.projectionMatrix,
|
|
|
|
-!1,T);h.activeTexture(h.TEXTURE0);h.uniform1i(j.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?(h.uniform1i(j.useScreenCoordinates,1),h.uniform3f(j.screenPosition,
|
|
|
|
-(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(h.uniform1i(j.useScreenCoordinates,0),h.uniform1i(j.affectedByDistance,g.affectedByDistance?1:0),h.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.affectedByDistance?1:ha),n[0]=m*k*g.scale.x,n[1]=m*g.scale.y,h.uniform2f(j.uvScale,g.uvScale.x,g.uvScale.y),h.uniform2f(j.uvOffset,g.uvOffset.x,g.uvOffset.y),h.uniform2f(j.alignment,g.alignment.x,g.alignment.y),h.uniform1f(j.opacity,g.opacity),
|
|
|
|
-h.uniform1f(j.rotation,g.rotation),h.uniform2fv(j.scale,n),g.mergeWith3D&&!t?(h.enable(h.DEPTH_TEST),t=!0):!g.mergeWith3D&&t&&(h.disable(h.DEPTH_TEST),t=!1),I(g.blending),C(g.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(M)}function E(b,e){var c,f,g=b.__webglLensFlares.length,j,k,m,n=new THREE.Vector3,o=ha/Y,p=Y*0.5,t=ha*0.5,u=16/ha,v=[u*o,u],w=[1,1,0],B=[1,1],A=P.uniforms;c=P.attributes;h.useProgram(P.program);O=P.program;S=-1;za||
|
|
|
|
-(h.enableVertexAttribArray(P.attributes.vertex),h.enableVertexAttribArray(P.attributes.uv),za=!0);h.uniform1i(A.occlusionMap,0);h.uniform1i(A.map,1);h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,P.elementBuffer);h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.activeTexture(h.TEXTURE1);for(f=0;f<g;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),w[0]=n.x,w[1]=n.y,w[2]=n.z,B[0]=w[0]*p+p,B[1]=w[1]*t+t,P.hasVertexTexture||B[0]>0&&B[0]<Y&&B[1]>0&&B[1]<ha){h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,B[0]-8,B[1]-8,16,16,0);h.uniform1i(A.renderType,0);h.uniform2fv(A.scale,v);h.uniform3fv(A.screenPosition,w);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);
|
|
|
|
-h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,B[0]-8,B[1]-8,16,16,0);h.uniform1i(A.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.drawElements(h.TRIANGLES,6,h.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();h.uniform1i(A.renderType,2);h.enable(h.BLEND);j=0;for(k=c.lensFlares.length;j<
|
|
|
|
-k;j++)if(m=c.lensFlares[j],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/ha,v[0]=u*o,v[1]=u,h.uniform3fv(A.screenPosition,w),h.uniform2fv(A.scale,v),h.uniform1f(A.rotation,m.rotation),h.uniform1f(A.opacity,m.opacity),I(m.blending),C(m.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(M)}function H(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
|
-function B(b){var e,f,g,j,k;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];k=!1;for(j in g.__webglCustomAttributes)if(g.__webglCustomAttributes[j].needsUpdate){k=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||k){k=b;var m=h.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,o=void 0,p=void 0,t=void 0,u=p=void 0,v=void 0,w=void 0,B=void 0,A=void 0,E=void 0,H=void 0,
|
|
|
|
-J=void 0,aa=void 0,C=void 0,G=void 0,I=void 0,K=void 0,F=t=B=t=w=v=void 0,D=void 0,z=D=F=v=void 0,ma=void 0,N=z=D=F=p=p=u=B=t=z=D=F=ma=z=D=F=ma=z=D=F=void 0,M=0,ia=0,P=0,pa=0,R=0,V=0,O=0,T=0,Q=0,L=0,S=0,D=F=0,W=g.__vertexArray,da=g.__uvArray,ca=g.__uv2Array,ja=g.__normalArray,U=g.__tangentArray,$=g.__colorArray,la=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ka=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,z=void 0,ea=g.__faceArray,ga=g.__lineArray,
|
|
|
|
-na=g.__needsSmoothNormals,E=g.__vertexColorType,A=g.__uvType,H=g.__normalType,ra=k.geometry,Ba=ra.__dirtyVertices,ya=ra.__dirtyElements,ta=ra.__dirtyUvs,za=ra.__dirtyNormals,Xa=ra.__dirtyTangents,Ya=ra.__dirtyColors,Za=ra.__dirtyMorphTargets,Ga=ra.vertices,ab=g.faces,db=ra.faces,bb=ra.faceVertexUvs[0],cb=ra.faceVertexUvs[1],Ha=ra.skinVerticesA,Ia=ra.skinVerticesB,Ja=ra.skinIndices,Aa=ra.skinWeights,Ea=k instanceof THREE.ShadowVolume?ra.edgeFaces:void 0;morphTargets=ra.morphTargets;if(ha)for(N in ha)ha[N].offset=
|
|
|
|
-0,ha[N].offsetSrc=0;n=0;for(o=ab.length;n<o;n++)if(p=ab[n],t=db[p],bb&&(J=bb[p]),cb&&(aa=cb[p]),p=t.vertexNormals,u=t.normal,v=t.vertexColors,w=t.color,B=t.vertexTangents,t instanceof THREE.Face3){if(Ba)C=Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,ia+=9;if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+
|
|
|
|
|
|
+c,f=b.object,j=b.opaque,h=b.transparent;h.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(h,c):o(j,c)}function t(b){var e,c,f,j,h=b.object,g=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=g.materials.length;e<c;e++)(j=g.materials[e])&&(j.transparent?o(m,j):o(k,j))}else(j=e)&&(j.transparent?o(m,j):o(k,j))}function v(b,e){return e.z-b.z}function u(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,o,p,t=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(p=0;p<t;p++)f=b.__webglShadowVolumes[p].object,
|
|
|
|
+k=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||V.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,o=m.attributes,O!==m&&(j.useProgram(m),O=m,j.uniformMatrix4fv(n.projectionMatrix,!1,T),j.uniformMatrix4fv(n.viewMatrix,!1,Z),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(o.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+k.__webglNormalBuffer),j.vertexAttribPointer(o.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);S=-1;O=da.program;j.useProgram(da.program);j.uniformMatrix4fv(da.projectionLocation,
|
|
|
|
+!1,T);j.uniform1f(da.darknessLocation,da.darkness);j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.vertexAttribPointer(da.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(da.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(M)}function w(b,e){var c,f,h;c=_sprite.attributes;var g=_sprite.uniforms,
|
|
|
|
+k=ga/Y,m,n=[],o=Y*0.5,p=ga*0.5,t=!0;j.useProgram(_sprite.program);O=_sprite.program;S=-1;ta||(j.enableVertexAttribArray(_sprite.attributes.position),j.enableVertexAttribArray(_sprite.attributes.uv),ta=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,_sprite.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,_sprite.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,
|
|
|
|
+!1,T);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(v);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-o)/o,(p-h.position.y)/p,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.affectedByDistance?1:ga),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&&!t?(j.enable(j.DEPTH_TEST),t=!0):!h.mergeWith3D&&t&&(j.disable(j.DEPTH_TEST),t=!1),I(h.blending),C(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(M)}function E(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,n=new THREE.Vector3,o=ga/Y,p=Y*0.5,t=ga*0.5,u=16/ga,v=[u*o,u],w=[1,1,0],B=[1,1],A=P.uniforms;c=P.attributes;j.useProgram(P.program);O=P.program;S=-1;za||
|
|
|
|
+(j.enableVertexAttribArray(P.attributes.vertex),j.enableVertexAttribArray(P.attributes.uv),za=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,P.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,P.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,P.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),w[0]=n.x,w[1]=n.y,w[2]=n.z,B[0]=w[0]*p+p,B[1]=w[1]*t+t,P.hasVertexTexture||B[0]>0&&B[0]<Y&&B[1]>0&&B[1]<ga){j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,B[0]-8,B[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.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,P.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,B[0]-8,B[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,P.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(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)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/ga,v[0]=u*o,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),I(m.blending),C(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(M)}function H(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
|
+function B(b){var e,f,h,g,k;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];k=!1;for(g in h.__webglCustomAttributes)if(h.__webglCustomAttributes[g].needsUpdate){k=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||k){k=b;var m=j.DYNAMIC_DRAW;if(h.__inittedArrays){var n=void 0,o=void 0,p=void 0,t=void 0,u=p=void 0,v=void 0,w=void 0,B=void 0,A=void 0,E=void 0,H=void 0,
|
|
|
|
+J=void 0,aa=void 0,C=void 0,G=void 0,I=void 0,K=void 0,F=t=B=t=w=v=void 0,D=void 0,z=D=F=v=void 0,ma=void 0,N=z=D=F=p=p=u=B=t=z=D=F=ma=z=D=F=ma=z=D=F=void 0,M=0,ia=0,P=0,pa=0,R=0,V=0,O=0,T=0,Q=0,L=0,S=0,D=F=0,W=h.__vertexArray,da=h.__uvArray,ca=h.__uv2Array,ja=h.__normalArray,U=h.__tangentArray,$=h.__colorArray,la=h.__skinVertexAArray,X=h.__skinVertexBArray,Y=h.__skinIndexArray,Z=h.__skinWeightArray,ka=h.__morphTargetsArrays,ga=h.__webglCustomAttributes,z=void 0,ea=h.__faceArray,fa=h.__lineArray,
|
|
|
|
+na=h.__needsSmoothNormals,E=h.__vertexColorType,A=h.__uvType,H=h.__normalType,ra=k.geometry,Ba=ra.__dirtyVertices,ya=ra.__dirtyElements,ta=ra.__dirtyUvs,za=ra.__dirtyNormals,Xa=ra.__dirtyTangents,Ya=ra.__dirtyColors,Za=ra.__dirtyMorphTargets,Ga=ra.vertices,ab=h.faces,db=ra.faces,bb=ra.faceVertexUvs[0],cb=ra.faceVertexUvs[1],Ha=ra.skinVerticesA,Ia=ra.skinVerticesB,Ja=ra.skinIndices,Aa=ra.skinWeights,Ea=k instanceof THREE.ShadowVolume?ra.edgeFaces:void 0;morphTargets=ra.morphTargets;if(ga)for(N in ga)ga[N].offset=
|
|
|
|
+0,ga[N].offsetSrc=0;n=0;for(o=ab.length;n<o;n++)if(p=ab[n],t=db[p],bb&&(J=bb[p]),cb&&(aa=cb[p]),p=t.vertexNormals,u=t.normal,v=t.vertexColors,w=t.color,B=t.vertexTangents,t instanceof THREE.Face3){if(Ba)C=Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,ia+=9;if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+
|
|
0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+1]=z.value[D],z.array[F+2]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&
|
|
0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+1]=z.value[D],z.array[F+2]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&
|
|
(C=z.value[D+0],G=z.value[D+1],I=z.value[D+2],z.offsetSrc+=3),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=
|
|
(C=z.value[D+0],G=z.value[D+1],I=z.value[D+2],z.offsetSrc+=3),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=
|
|
I.y,z.array[F+8]=I.z),z.offset+=9):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.offset+=12));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,G=morphTargets[F].vertices[t.b].position,I=morphTargets[F].vertices[t.c].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+
|
|
I.y,z.array[F+8]=I.z),z.offset+=9):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.offset+=12));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,G=morphTargets[F].vertices[t.b].position,I=morphTargets[F].vertices[t.c].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+
|
|
6]=I.x,z[S+7]=I.y,z[S+8]=I.z;S+=9}if(Aa.length)F=Aa[t.a],D=Aa[t.b],z=Aa[t.c],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,
|
|
6]=I.x,z[S+7]=I.y,z[S+8]=I.z;S+=9}if(Aa.length)F=Aa[t.a],D=Aa[t.b],z=Aa[t.c],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,
|
|
la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,L+=12;if(Ya&&E)v.length==3&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2]):D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,Q+=9;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,
|
|
la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,L+=12;if(Ya&&E)v.length==3&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2]):D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,Q+=9;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,
|
|
-U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,O+=12;if(za&&H)if(p.length==3&&na)for(B=0;B<3;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<3;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<3;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<3;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+2,R+=3,ga[T]=M,ga[T+1]=M+1,ga[T+2]=M,ga[T+3]=M+2,ga[T+4]=M+1,ga[T+5]=M+2,T+=6,M+=3)}else if(t instanceof THREE.Face4){if(Ba)C=
|
|
|
|
-Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,K=Ga[t.d].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,W[ia+9]=K.x,W[ia+10]=K.y,W[ia+11]=K.z,ia+=12;if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c],z.array[F+3]=z.value[t.d]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+
|
|
|
|
|
|
+U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,O+=12;if(za&&H)if(p.length==3&&na)for(B=0;B<3;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<3;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<3;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<3;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+2,R+=3,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+2,fa[T+4]=M+1,fa[T+5]=M+2,T+=6,M+=3)}else if(t instanceof THREE.Face4){if(Ba)C=
|
|
|
|
+Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,K=Ga[t.d].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,W[ia+9]=K.x,W[ia+10]=K.y,W[ia+11]=K.z,ia+=12;if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c],z.array[F+3]=z.value[t.d]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+
|
|
1]=z.value[D],z.array[F+2]=z.value[D],z.array[F+3]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.array[F+3]=z.value[D+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c],K=z.value[t.d]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],K=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(C=z.value[D+0],G=z.value[D+1],I=z.value[D+
|
|
1]=z.value[D],z.array[F+2]=z.value[D],z.array[F+3]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.array[F+3]=z.value[D+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c],K=z.value[t.d]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],K=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(C=z.value[D+0],G=z.value[D+1],I=z.value[D+
|
|
2],K=z.value[D+3],z.offsetSrc+=4),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.array[F+6]=K.x,z.array[F+7]=K.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b,z.array[F+9]=K.r,z.array[F+10]=K.g,z.array[F+11]=K.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+
|
|
2],K=z.value[D+3],z.offsetSrc+=4),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.array[F+6]=K.x,z.array[F+7]=K.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b,z.array[F+9]=K.r,z.array[F+10]=K.g,z.array[F+11]=K.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+
|
|
4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=I.y,z.array[F+8]=I.z,z.array[F+9]=K.x,z.array[F+10]=K.y,z.array[F+11]=K.z),z.offset+=12):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.array[F+12]=K.x,z.array[F+13]=K.y,z.array[F+14]=K.z,z.array[F+15]=K.w,z.offset+=16));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,
|
|
4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=I.y,z.array[F+8]=I.z,z.array[F+9]=K.x,z.array[F+10]=K.y,z.array[F+11]=K.z),z.offset+=12):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.array[F+12]=K.x,z.array[F+13]=K.y,z.array[F+14]=K.z,z.array[F+15]=K.w,z.offset+=16));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,
|
|
@@ -273,65 +273,65 @@ G=morphTargets[F].vertices[t.b].position,I=morphTargets[F].vertices[t.c].positio
|
|
ma.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],ma=Ja[t.d],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,Y[L+12]=ma.x,Y[L+13]=ma.y,Y[L+14]=ma.z,Y[L+15]=ma.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],ma=Ha[t.d],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,la[L+12]=ma.x,la[L+13]=ma.y,la[L+14]=ma.z,la[L+15]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],t=Ia[t.d],
|
|
ma.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],ma=Ja[t.d],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,Y[L+12]=ma.x,Y[L+13]=ma.y,Y[L+14]=ma.z,Y[L+15]=ma.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],ma=Ha[t.d],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,la[L+12]=ma.x,la[L+13]=ma.y,la[L+14]=ma.z,la[L+15]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],t=Ia[t.d],
|
|
X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,X[L+12]=t.x,X[L+13]=t.y,X[L+14]=t.z,X[L+15]=1,L+=16;if(Ya&&E)v.length==4&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2],v=v[3]):v=D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,$[Q+9]=v.r,$[Q+10]=v.g,$[Q+11]=v.b,Q+=12;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],B=B[3],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,
|
|
X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,X[L+12]=t.x,X[L+13]=t.y,X[L+14]=t.z,X[L+15]=1,L+=16;if(Ya&&E)v.length==4&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2],v=v[3]):v=D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,$[Q+9]=v.r,$[Q+10]=v.g,$[Q+11]=v.b,Q+=12;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],B=B[3],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,
|
|
U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,U[O+12]=B.x,U[O+13]=B.y,U[O+14]=B.z,U[O+15]=B.w,O+=16;if(za&&H)if(p.length==4&&na)for(B=0;B<4;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<4;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<4;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<4;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+3,ea[R+3]=M+1,ea[R+4]=M+2,ea[R+5]=M+
|
|
U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,U[O+12]=B.x,U[O+13]=B.y,U[O+14]=B.z,U[O+15]=B.w,O+=16;if(za&&H)if(p.length==4&&na)for(B=0;B<4;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<4;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<4;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<4;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+3,ea[R+3]=M+1,ea[R+4]=M+2,ea[R+5]=M+
|
|
-3,R+=6,ga[T]=M,ga[T+1]=M+1,ga[T+2]=M,ga[T+3]=M+3,ga[T+4]=M+1,ga[T+5]=M+2,ga[T+6]=M+2,ga[T+7]=M+3,T+=8,M+=4)}if(Ea){n=0;for(o=Ea.length;n<o;n++)ea[R]=Ea[n].a,ea[R+1]=Ea[n].b,ea[R+2]=Ea[n].c,ea[R+3]=Ea[n].a,ea[R+4]=Ea[n].c,ea[R+5]=Ea[n].d,R+=6}Ba&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,W,m));if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)h.bindBuffer(h.ARRAY_BUFFER,z.buffer),h.bufferData(h.ARRAY_BUFFER,z.array,m),z.needsUpdate=!1;if(Za){F=0;for(D=morphTargets.length;F<
|
|
|
|
-D;F++)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[F]),h.bufferData(h.ARRAY_BUFFER,ka[F],m)}Ya&&Q>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,$,m));za&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,ja,m));Xa&&ra.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,U,m));ta&&P>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,da,m));ta&&pa>0&&(h.bindBuffer(h.ARRAY_BUFFER,
|
|
|
|
-g.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,m));ya&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,m),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ga,m));L>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,la,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,X,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,
|
|
|
|
-Y,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,Z,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}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=h.DYNAMIC_DRAW;A=b.vertices;g=b.colors;E=A.length;k=g.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,j=n*3,H[j]=o.x,H[j+1]=o.y,H[j+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,H,e)}if(J){for(n=0;n<k;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;
|
|
|
|
-h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=h.DYNAMIC_DRAW;A=b.vertices;g=b.colors;E=A.length;k=g.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,j=n*3,H[j]=o.x,H[j+1]=o.y,H[j+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,H,
|
|
|
|
-e)}if(J){for(n=0;n<k;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,h.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function K(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={},o=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:o}),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:o})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function A(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=S){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,
|
|
|
|
-h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}S=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,J(e.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,J(e.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,J(e.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,J(e.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),
|
|
|
|
-h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_MAG_FILTER,N(e.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,N(e.minFilter)))}function C(b,e){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=h.deleteTexture(b.__webglTexture);b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image);G(h.TEXTURE_2D,b,b.image);h.bindTexture(h.TEXTURE_2D,null);b.needsUpdate=!1}h.activeTexture(h.TEXTURE0+
|
|
|
|
-e);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,J(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,J(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,
|
|
|
|
-J(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,J(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,J(b.format),b.width,b.height,0,J(b.format),J(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,
|
|
|
|
-h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
|
|
-c=Y,b=ha);e!=$&&(h.bindFramebuffer(h.FRAMEBUFFER,e),h.viewport(W,ga,c,b),$=e)}function D(b,e){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,e);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(e),null;return c}function N(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;default:return h.LINEAR}}
|
|
|
|
-function J(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;
|
|
|
|
-case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}
|
|
|
|
-var V=this,h,X=[],O=null,$=null,M=!0,ca=null,U=null,S=null,ja=null,W=0,ga=0,Y=0,ha=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Matrix4,T=new Float32Array(16),Z=new Float32Array(16),ka=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},aa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ma=b.stencil!==void 0?b.stencil:
|
|
|
|
-!0,ia=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),la=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=aa;this.sortObjects=this.autoClear=!0;try{if(!(h=aa.getContext("experimental-webgl",{antialias:ia,stencil:ma})))throw"Error creating WebGL context.";}catch(Ba){console.error(Ba)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+
|
|
|
|
-" | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(pa.r,pa.g,pa.b,la);this.context=h;var ya=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ma){var da={};da.vertices=new Float32Array(12);da.faces=new Uint16Array(6);
|
|
|
|
-da.darkness=0.5;da.vertices[0]=-20;da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=h.createBuffer();da.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,da.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,da.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-da.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,da.faces,h.STATIC_DRAW);da.program=h.createProgram();h.attachShader(da.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));h.attachShader(da.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(da.program);da.vertexLocation=h.getAttribLocation(da.program,"position");da.projectionLocation=h.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=h.getUniformLocation(da.program,"darkness")}var P={};
|
|
|
|
-P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=h.createBuffer();P.elementBuffer=h.createBuffer();
|
|
|
|
-P.tempTexture=h.createTexture();P.occlusionTexture=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,P.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,P.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,P.faces,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);
|
|
|
|
-h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
|
|
|
|
-0?(P.hasVertexTexture=!1,P.program=h.createProgram(),h.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=h.createProgram(),h.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(P.program);P.attributes={};P.uniforms={};
|
|
|
|
-P.attributes.vertex=h.getAttribLocation(P.program,"position");P.attributes.uv=h.getAttribLocation(P.program,"UV");P.uniforms.renderType=h.getUniformLocation(P.program,"renderType");P.uniforms.map=h.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=h.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=h.getUniformLocation(P.program,"opacity");P.uniforms.scale=h.getUniformLocation(P.program,"scale");P.uniforms.rotation=h.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=
|
|
|
|
-h.getUniformLocation(P.program,"screenPosition");var za=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
|
|
|
|
-0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram();
|
|
|
|
-h.attachShader(_sprite.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,
|
|
|
|
-"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
|
|
|
|
-h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var ta=!1;this.setSize=function(b,e){aa.width=b;aa.height=e;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(b,e,c,f){W=b;ga=e;Y=c;ha=f;h.viewport(W,ga,Y,ha)};
|
|
|
|
-this.setScissor=function(b,e,c,f){h.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){M=b;h.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);la=e;h.clearColor(pa.r,pa.g,pa.b,la)};this.setClearColor=function(b,e){pa.copy(b);la=e;h.clearColor(pa.r,pa.g,pa.b,la)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=
|
|
|
|
-b};this.getContext=function(){return h};this.initMaterial=function(b,e,c,f){var g,j,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,o;n=o=m=0;for(t=e.length;n<t;n++)j=e[n],j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&m++;m+o<=4?e=o:(e=Math.ceil(4*o/(m+o)),m=4-e);j={directional:e,point:m};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;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:j.directional,maxPointLights:j.point,maxBones:o},u;j=[];k?j.push(k):(j.push(n),j.push(t));for(u in c)j.push(u),j.push(c[u]);k=j.join();u=0;for(j=X.length;u<j;u++)if(X[u].code==k){p=X[u].program;break a}u=h.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,
|
|
|
|
|
|
+3,R+=6,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+3,fa[T+4]=M+1,fa[T+5]=M+2,fa[T+6]=M+2,fa[T+7]=M+3,T+=8,M+=4)}if(Ea){n=0;for(o=Ea.length;n<o;n++)ea[R]=Ea[n].a,ea[R+1]=Ea[n].b,ea[R+2]=Ea[n].c,ea[R+3]=Ea[n].a,ea[R+4]=Ea[n].c,ea[R+5]=Ea[n].d,R+=6}Ba&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,W,m));if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,m),z.needsUpdate=!1;if(Za){F=0;for(D=morphTargets.length;F<
|
|
|
|
+D;F++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[F]),j.bufferData(j.ARRAY_BUFFER,ka[F],m)}Ya&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));za&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,ja,m));Xa&&ra.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,U,m));ta&&P>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));ta&&pa>0&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ca,m));ya&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ea,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m));L>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,la,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,Z,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}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;E=A.length;k=h.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,g=n*3,H[g]=o.x,H[g+1]=o.y,H[g+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,H,e)}if(J){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;
|
|
|
|
+j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;E=A.length;k=h.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,g=n*3,H[g]=o.x,H[g+1]=o.y,H[g+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,H,
|
|
|
|
+e)}if(J){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}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 K(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}
|
|
|
|
+var c,f,h,j,g,k,m,n,t={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(j=b.faces.length;h<j;h++)g=b.faces[h],k=g.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:o}),g=g instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+g>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:o})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=g}function A(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=S){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)}S=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,J(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,J(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,J(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,J(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,N(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,N(e.minFilter)))}function C(b,e){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=j.deleteTexture(b.__webglTexture);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);G(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 R(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,J(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,J(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,
|
|
|
|
+J(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,J(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,J(b.format),b.width,b.height,0,J(b.format),J(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=Y,b=ga);e!=$&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(W,fa,c,b),$=e)}function D(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 N(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
|
|
|
|
+function J(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}
|
|
|
|
+var V=this,j,X=[],O=null,$=null,M=!0,ca=null,U=null,S=null,ja=null,W=0,fa=0,Y=0,ga=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Matrix4,T=new Float32Array(16),Z=new Float32Array(16),ka=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},aa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ma=b.stencil!==void 0?b.stencil:
|
|
|
|
+!0,ia=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),la=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=aa;this.sortObjects=this.autoClear=!0;try{if(!(j=aa.getContext("experimental-webgl",{antialias:ia,stencil:ma})))throw"Error creating WebGL context.";}catch(Ba){console.error(Ba)}console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
|
|
|
|
+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION));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(pa.r,pa.g,pa.b,la);this.context=j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ma){var da={};da.vertices=new Float32Array(12);da.faces=new Uint16Array(6);
|
|
|
|
+da.darkness=0.5;da.vertices[0]=-20;da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=j.createBuffer();da.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,da.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+da.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,da.faces,j.STATIC_DRAW);da.program=j.createProgram();j.attachShader(da.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(da.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(da.program);da.vertexLocation=j.getAttribLocation(da.program,"position");da.projectionLocation=j.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=j.getUniformLocation(da.program,"darkness")}var P={};
|
|
|
|
+P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();
|
|
|
|
+P.tempTexture=j.createTexture();P.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,P.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,P.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?(P.hasVertexTexture=!1,P.program=j.createProgram(),j.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=j.createProgram(),j.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(P.program);P.attributes={};P.uniforms={};
|
|
|
|
+P.attributes.vertex=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"UV");P.uniforms.renderType=j.getUniformLocation(P.program,"renderType");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=j.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=j.getUniformLocation(P.program,"opacity");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=
|
|
|
|
+j.getUniformLocation(P.program,"screenPosition");var za=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
|
|
|
|
+0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=j.createBuffer();_sprite.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,_sprite.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,_sprite.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,_sprite.faces,j.STATIC_DRAW);_sprite.program=j.createProgram();
|
|
|
|
+j.attachShader(_sprite.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(_sprite.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=j.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=j.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=j.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=j.getUniformLocation(_sprite.program,
|
|
|
|
+"uvScale");_sprite.uniforms.rotation=j.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=j.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=j.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=j.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=j.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=j.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
|
|
|
|
+j.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=j.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=j.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=j.getUniformLocation(_sprite.program,"projectionMatrix");var ta=!1;this.setSize=function(b,e){aa.width=b;aa.height=e;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(b,e,c,f){W=b;fa=e;Y=c;ga=f;j.viewport(W,fa,Y,ga)};
|
|
|
|
+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){M=b;j.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);la=e;j.clearColor(pa.r,pa.g,pa.b,la)};this.setClearColor=function(b,e){pa.copy(b);la=e;j.clearColor(pa.r,pa.g,pa.b,la)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=
|
|
|
|
+b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,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,o;n=o=m=0;for(t=e.length;n<t;n++)g=e[n],g instanceof THREE.DirectionalLight&&o++,g instanceof THREE.PointLight&&m++;m+o<=4?e=o:(e=Math.ceil(4*o/(m+o)),m=4-e);g={directional:e,point:m};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;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:g.directional,maxPointLights:g.point,maxBones:o},u;g=[];k?g.push(k):(g.push(n),g.push(t));for(u in c)g.push(u),g.push(c[u]);k=g.join();u=0;for(g=X.length;u<g;u++)if(X[u].code==k){p=X[u].program;break a}u=j.createProgram();prefix_fragment=["#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");prefix_vertex=[ya?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?
|
|
"#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");prefix_vertex=[ya?"#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");
|
|
"#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");
|
|
-h.attachShader(u,D("fragment",prefix_fragment+n));h.attachShader(u,D("vertex",prefix_vertex+t));h.linkProgram(u);h.getProgramParameter(u,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(u,h.VALIDATE_STATUS)+", gl error ["+h.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]=h.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(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=h.getAttribLocation(u,c);X.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&h.enableVertexAttribArray(p.position);p.color>=0&&h.enableVertexAttribArray(p.color);
|
|
|
|
-p.normal>=0&&h.enableVertexAttribArray(p.normal);p.tangent>=0&&h.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(h.enableVertexAttribArray(p.skinVertexA),h.enableVertexAttribArray(p.skinVertexB),h.enableVertexAttribArray(p.skinIndex),h.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&h.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=
|
|
|
|
-0&&(h.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(h.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(h.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(h.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(h.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(h.enableVertexAttribArray(p.morphTarget5),
|
|
|
|
-b.numSupportedMorphTargets++);p.morphTarget6>=0&&(h.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(h.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,B){var A,D,C,G,J,K,aa,M,ia=b.lights,N=b.fog;V.data.vertices=0;V.data.faces=0;V.data.drawCalls=0;c.matrixAutoUpdate&&
|
|
|
|
|
|
+j.attachShader(u,D("fragment",prefix_fragment+n));j.attachShader(u,D("vertex",prefix_vertex+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(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=j.getAttribLocation(u,c);X.push({program:u,code:k});p=u}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(h in b.attributes)p[h]!==void 0&&p[h]>=0&&j.enableVertexAttribArray(p[h]);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(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,B){var A,D,C,G,J,K,aa,M,ia=b.lights,N=b.fog;V.data.vertices=0;V.data.faces=0;V.data.drawCalls=0;c.matrixAutoUpdate&&
|
|
c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);c.projectionMatrix.flattenToArray(T);Q.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Q);this.initWebGLObjects(b);R(o);(this.autoClear||B)&&this.clear();J=b.__webglObjects.length;for(B=0;B<J;B++)if(A=b.__webglObjects[B],aa=A.object,aa.visible)if(!(aa instanceof THREE.Mesh)||n(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),t(A),A.render=!0,this.sortObjects)ka.copy(aa.position),Q.multiplyVector3(ka),
|
|
c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);c.projectionMatrix.flattenToArray(T);Q.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Q);this.initWebGLObjects(b);R(o);(this.autoClear||B)&&this.clear();J=b.__webglObjects.length;for(B=0;B<J;B++)if(A=b.__webglObjects[B],aa=A.object,aa.visible)if(!(aa instanceof THREE.Mesh)||n(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),t(A),A.render=!0,this.sortObjects)ka.copy(aa.position),Q.multiplyVector3(ka),
|
|
-A.z=ka.z}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(v);K=b.__webglObjectsImmediate.length;for(B=0;B<K;B++)A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),p(A));I(THREE.NormalBlending);for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.opaque;j(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],
|
|
|
|
-aa=A.object,aa.visible){C=A.opaque;j(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,D,G.shading)})}for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.transparent;j(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible){C=A.transparent;j(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,
|
|
|
|
-D,G.shading)})}b.__webglSprites.length&&w(b,c);ma&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&E(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(h.bindTexture(h.TEXTURE_2D,o.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.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 c=
|
|
|
|
-b.__objectsAdded[0],e=b,f=void 0,g=void 0,j=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(f in g=c.geometry,g.geometryGroups==void 0&&K(g),g.geometryGroups){j=g.geometryGroups[f];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=h.createBuffer();k.__webglNormalBuffer=
|
|
|
|
-h.createBuffer();k.__webglTangentBuffer=h.createBuffer();k.__webglColorBuffer=h.createBuffer();k.__webglUVBuffer=h.createBuffer();k.__webglUV2Buffer=h.createBuffer();k.__webglSkinVertexABuffer=h.createBuffer();k.__webglSkinVertexBBuffer=h.createBuffer();k.__webglSkinIndicesBuffer=h.createBuffer();k.__webglSkinWeightsBuffer=h.createBuffer();k.__webglFaceBuffer=h.createBuffer();k.__webglLineBuffer=h.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(h.createBuffer())}for(var k=j,m=c,t=void 0,p=void 0,o=void 0,u=o=void 0,v=void 0,w=void 0,G=w=n=0,C=o=p=void 0,p=t=void 0,u=m.geometry,C=u.faces,v=k.faces,t=0,p=v.length;t<p;t++)o=v[t],o=C[o],o instanceof THREE.Face3?(n+=3,w+=1,G+=3):o instanceof THREE.Face4&&(n+=4,w+=2,G+=4);for(var t=k,p=m,D=v=C=void 0,E=void 0,D=void 0,o=[],C=0,v=p.materials.length;C<v;C++)if(D=p.materials[C],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<
|
|
|
|
|
|
+A.z=ka.z}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(v);K=b.__webglObjectsImmediate.length;for(B=0;B<K;B++)A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),p(A));I(THREE.NormalBlending);for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.opaque;h(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],
|
|
|
|
+aa=A.object,aa.visible){C=A.opaque;h(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,D,G.shading)})}for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.transparent;h(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible){C=A.transparent;h(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,
|
|
|
|
+D,G.shading)})}b.__webglSprites.length&&w(b,c);ma&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&E(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 c=
|
|
|
|
+b.__objectsAdded[0],e=b,f=void 0,h=void 0,g=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(f in h=c.geometry,h.geometryGroups==void 0&&K(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var k=g;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=g,m=c,t=void 0,p=void 0,o=void 0,u=o=void 0,v=void 0,w=void 0,G=w=n=0,C=o=p=void 0,p=t=void 0,u=m.geometry,C=u.faces,v=k.faces,t=0,p=v.length;t<p;t++)o=v[t],o=C[o],o instanceof THREE.Face3?(n+=3,w+=1,G+=3):o instanceof THREE.Face4&&(n+=4,w+=2,G+=4);for(var t=k,p=m,D=v=C=void 0,E=void 0,D=void 0,o=[],C=0,v=p.materials.length;C<v;C++)if(D=p.materials[C],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<
|
|
l;D++)(E=t.materials[D])&&o.push(E)}else(E=D)&&o.push(E);t=o;a:{C=p=void 0;v=t.length;for(p=0;p<v;p++)if(C=t[p],C.map||C.lightMap||C instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{C=t;o=v=void 0;D=C.length;for(v=0;v<D;v++)if(o=C[v],!(o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial)){C=o&&o.shading!=void 0&&o.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{o=v=void 0;D=t.length;for(v=0;v<D;v++)if(o=t[v],o.vertexColors){o=
|
|
l;D++)(E=t.materials[D])&&o.push(E)}else(E=D)&&o.push(E);t=o;a:{C=p=void 0;v=t.length;for(p=0;p<v;p++)if(C=t[p],C.map||C.lightMap||C instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{C=t;o=v=void 0;D=C.length;for(v=0;v<D;v++)if(o=C[v],!(o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial)){C=o&&o.shading!=void 0&&o.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{o=v=void 0;D=t.length;for(v=0;v<D;v++)if(o=t[v],o.vertexColors){o=
|
|
o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(n*3);if(C)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(o)k.__colorArray=new Float32Array(n*3);if(p){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=
|
|
o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(n*3);if(C)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(o)k.__colorArray=new Float32Array(n*3);if(p){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(G*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=o;k.__normalType=C;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?
|
|
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(G*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=o;k.__normalType=C;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?
|
|
-m.geometry.edgeFaces.length*6:0);k.__webglLineCount=G*2;u=0;for(v=t.length;u<v;u++)if(t[u].attributes)for(a in k.__webglCustomAttributes={},t[u].attributes){p={};for(prop in t[u].attributes[a])p[prop]=t[u].attributes[a][prop];if(!p.__webglInitialized||p.createUniqueBuffers)p.__webglInitialized=!0,w=1,p.type==="v2"?w=2:p.type==="v3"?w=3:p.type==="v4"?w=4:p.type==="c"&&(w=3),p.size=w,p.needsUpdate=!0,p.array=new Float32Array(n*w),p.buffer=h.createBuffer(),p.buffer.belongsToAttribute=a;k.__webglCustomAttributes[a]=
|
|
|
|
-p}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?A(e.__webglShadowVolumes,j,c):A(e.__webglObjects,j,c)}else if(c instanceof THREE.LensFlare)A(e.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=
|
|
|
|
-new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else if(c instanceof
|
|
|
|
-THREE.ParticleSystem){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__sortArray=[],f.__webglParticleCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
|
-count:0}}):c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;f=g=void 0;if(c instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,c==f){e.__webglObjects.splice(g,1);break}}else if(c instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],c==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<
|
|
|
|
-e;c++)B(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)B(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)B(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?h.frontFace(h.CCW):h.frontFace(h.CW),b=="back"?h.cullFace(h.BACK):b=="front"?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK),h.enable(h.CULL_FACE)):h.disable(h.CULL_FACE)};this.supportsVertexTextures=function(){return ya}};
|
|
|
|
|
|
+m.geometry.edgeFaces.length*6:0);k.__webglLineCount=G*2;u=0;for(v=t.length;u<v;u++)if(t[u].attributes)for(a in k.__webglCustomAttributes={},t[u].attributes){p={};for(prop in t[u].attributes[a])p[prop]=t[u].attributes[a][prop];if(!p.__webglInitialized||p.createUniqueBuffers)p.__webglInitialized=!0,w=1,p.type==="v2"?w=2:p.type==="v3"?w=3:p.type==="v4"?w=4:p.type==="c"&&(w=3),p.size=w,p.needsUpdate=!0,p.array=new Float32Array(n*w),p.buffer=j.createBuffer(),p.buffer.belongsToAttribute=a;k.__webglCustomAttributes[a]=
|
|
|
|
+p}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}c instanceof THREE.ShadowVolume?A(e.__webglShadowVolumes,g,c):A(e.__webglObjects,g,c)}else if(c instanceof THREE.LensFlare)A(e.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=
|
|
|
|
+new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else if(c instanceof THREE.Line){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else if(c instanceof
|
|
|
|
+THREE.ParticleSystem){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__sortArray=[],f.__webglParticleCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
|
+count:0}}):c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;f=h=void 0;if(c instanceof THREE.Mesh)for(h=e.__webglObjects.length-1;h>=0;h--){if(f=e.__webglObjects[h].object,c==f){e.__webglObjects.splice(h,1);break}}else if(c instanceof THREE.Sprite)for(h=e.__webglSprites.length-1;h>=0;h--)if(f=e.__webglSprites[h],c==f){e.__webglSprites.splice(h,1);break}b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<
|
|
|
|
+e;c++)B(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)B(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)B(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="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 ya}};
|
|
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.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,e){e&&b.update(void 0,!1,c);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,e){e&&b.update(void 0,!1,c);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
|
|
@@ -339,15 +339,15 @@ THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.posi
|
|
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,j=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==j)k=e=0;else{var m=j-k,k=m/j,e=e==j?(f-g)/m:f==j?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=j;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,j=b.vertices,k=g.vertices,m=b.faces,n=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=k.length;p<t;p++){var v=new THREE.Vertex(k[p].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}p=0;for(t=n.length;p<t;p++){var k=n[p],u,w,E=k.vertexNormals,v=k.vertexColors;k instanceof THREE.Face3?u=new THREE.Face3(k.a+f,k.b+f,k.c+f):
|
|
|
|
-k instanceof THREE.Face4&&(u=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));u.normal.copy(k.normal);e=0;for(j=E.length;e<j;e++)w=E[e],u.vertexNormals.push(w.clone());u.color.copy(k.color);e=0;for(j=v.length;e<j;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=k.materials.slice();u.centroid.copy(k.centroid);m.push(u)}p=0;for(t=g.length;p<t;p++){f=g[p];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.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.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=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)j.needsUpdate=!0;e&&e(this)},g[c].src=b[c];return j}};
|
|
|
|
-THREE.SceneUtils={addMesh:function(b,c,e,f,g,j,k,m,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=j;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),e);b.addObject(c);
|
|
|
|
|
|
+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,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=k.length;p<t;p++){var v=new THREE.Vertex(k[p].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}p=0;for(t=n.length;p<t;p++){var k=n[p],u,w,E=k.vertexNormals,v=k.vertexColors;k instanceof THREE.Face3?u=new THREE.Face3(k.a+f,k.b+f,k.c+f):
|
|
|
|
+k instanceof THREE.Face4&&(u=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));u.normal.copy(k.normal);e=0;for(h=E.length;e<h;e++)w=E[e],u.vertexNormals.push(w.clone());u.color.copy(k.color);e=0;for(h=v.length;e<h;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=k.materials.slice();u.centroid.copy(k.centroid);m.push(u)}p=0;for(t=g.length;p<t;p++){f=g[p];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.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.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].src=b[c];return h}};
|
|
|
|
+THREE.SceneUtils={addMesh:function(b,c,e,f,g,h,k,m,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),e);b.addObject(c);
|
|
return c},addPanoramaCube:function(b,c,e){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,f,!0),
|
|
return c},addPanoramaCube:function(b,c,e){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,f,!0),
|
|
-new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,j=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,j,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-j,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,j,0,g,
|
|
|
|
-new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-j,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},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)}};
|
|
|
|
|
|
+new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,
|
|
|
|
+new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},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.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}",
|
|
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}"},
|
|
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:{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.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
|
|
normal:{uniforms:{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.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
|
|
@@ -357,23 +357,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,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++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(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,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(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,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 n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var o=b.hierarchy[e].keys[f].morphTargets[n];m[o]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
|
|
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 o=b.hierarchy[e].keys[f].morphTargets[n];m[o]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
|
|
{};for(o in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===o){p[o]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(p[o]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}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*
|
|
{};for(o in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===o){p[o]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(p[o]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}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 c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};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 c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};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 j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.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,j,k,m,n,o,p=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&p[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,k,m,n,o,p=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&p[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
!1):(b.matrix=p[u][o],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 E=0;E<3;E++){e=c[E];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){k=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)k=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
|
|
!1):(b.matrix=p[u][o],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 E=0;E<3;E++){e=c[E];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){k=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)k=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
|
|
-t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(m.time-k.time);g=k[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",u,k.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",u,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,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,k,m,n,o;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];n=b[e[2]];o=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(j[0],m[0],n[0],o[0],g,e,k);f[1]=this.interpolate(j[1],m[1],n[1],o[1],g,e,k);f[2]=this.interpolate(j[2],m[2],n[2],o[2],g,e,k);return f};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*j+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]};
|
|
|
|
|
|
+t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-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 "+u),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",u,k.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,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&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,k,m,n,o;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]];o=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(h[0],m[0],n[0],o[0],g,e,k);f[1]=this.interpolate(h[1],m[1],n[1],o[1],g,e,k);f[2]=this.interpolate(h[2],m[2],n[2],o[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.QuakeCamera=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.QuakeCamera=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!==
|
|
@@ -385,12 +385,12 @@ 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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.QuakeCamera.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.QuakeCamera.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,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},j,k=c.getControlPointsArray(),m=c.getLength(),n=k.length,K=0;j=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[j]={time:f,pos:k[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<n-1;j++)K=f*m.chunks[j]/m.total,c.keys[j]={time:K,pos:k[j]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
|
-f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),j=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,j);particleObj=new THREE.ParticleSystem(g,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);g=new THREE.Sphere(1,
|
|
|
|
-16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),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=
|
|
|
|
|
|
+THREE.PathCamera=function(b){function c(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},g,k=c.getControlPointsArray(),m=c.getLength(),n=k.length,K=0;g=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:f,pos:k[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<n-1;g++)K=f*m.chunks[g]/m.total,c.keys[g]={time:K,pos:k[g]};h.hierarchy[0]=c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
|
+f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=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.Sphere(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=
|
|
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,j=Math.PI/180;this.update=function(b,c,e){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)*j;this.theta=this.lon*j;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=
|
|
|
|
|
|
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(b,c,e){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,c,e)};this.onMouseMove=function(b){this.mouseX=
|
|
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,c,e)};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.Cube(10,10,20),n=new THREE.Cube(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,
|
|
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.Cube(10,10,20),n=new THREE.Cube(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,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),!1)};
|
|
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,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),!1)};
|
|
@@ -399,71 +399,71 @@ THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,argument
|
|
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,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
|
|
|
|
-c.offset[1]-j)/j;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,j=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,o=1,p=0,t=0,v=0,u=0,w=0,E=window.innerWidth/2,H=window.innerHeight/2;this.update=
|
|
|
|
|
|
+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,o=1,p=0,t=0,v=0,u=0,w=0,E=window.innerWidth/2,H=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*u),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
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*u),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*o);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);j.set(0,1,0);g.cross(j,k).normalize();j.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=j.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);
|
|
|
|
|
|
+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){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
|
|
|
+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){u=(b.clientX-E)/window.innerWidth;w=(b.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
|
|
function(b){u=(b.clientX-E)/window.innerWidth;w=(b.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
|
|
case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:n=!0;o=1;break;case 69:n=!0;o=-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:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=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;
|
|
case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:n=!0;o=1;break;case 69:n=!0;o=-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:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=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||
|
|
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,j=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,p=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-
|
|
|
|
|
|
+!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,o=new THREE.Vector2,p=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.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(j.dot(k)/j.length()/k.length());if(b){var c=(new THREE.Vector3).cross(j,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?j=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};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.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var c=(new THREE.Vector3).cross(h,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?h=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.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=p.clone().subSelf(o);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?o=p:o.addSelf(b.sub(p,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
this.panCamera=function(){var b=p.clone().subSelf(o);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?o=p:o.addSelf(b.sub(p,o).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",
|
|
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&&(j=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),o=p=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&&(p=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?j=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=p=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=
|
|
|
|
|
|
+c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),o=p=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&&(p=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||(o=p=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.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
-THREE.Cube=function(b,c,e,f,g,j,k,m,n){function o(b,c,e,k,m,n,o,t){var u,v,w=f||1,E=g||1,h=m/2,X=n/2,O=p.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",E=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var $=w+1,M=E+1;m/=w;var ca=n/E;for(v=0;v<M;v++)for(n=0;n<$;n++){var U=new THREE.Vector3;U[b]=(n*m-h)*e;U[c]=(v*ca-X)*k;U[u]=o;p.vertices.push(new THREE.Vertex(U))}for(v=0;v<E;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+$*v+O,n+$*
|
|
|
|
|
|
+THREE.Cube=function(b,c,e,f,g,h,k,m,n){function o(b,c,e,k,m,n,o,t){var u,v,w=f||1,E=g||1,j=m/2,X=n/2,O=p.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",E=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=h||1;var $=w+1,M=E+1;m/=w;var ca=n/E;for(v=0;v<M;v++)for(n=0;n<$;n++){var U=new THREE.Vector3;U[b]=(n*m-j)*e;U[c]=(v*ca-X)*k;U[u]=o;p.vertices.push(new THREE.Vertex(U))}for(v=0;v<E;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+$*v+O,n+$*
|
|
(v+1)+O,n+1+$*(v+1)+O,n+1+$*v+O,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/E),new THREE.UV(n/w,(v+1)/E),new THREE.UV((n+1)/w,(v+1)/E),new THREE.UV((n+1)/w,v/E)])}THREE.Geometry.call(this);var p=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)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 E in n)this.sides[E]!=void 0&&(this.sides[E]=n[E]);
|
|
(v+1)+O,n+1+$*(v+1)+O,n+1+$*v+O,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/E),new THREE.UV(n/w,(v+1)/E),new THREE.UV((n+1)/w,(v+1)/E),new THREE.UV((n+1)/w,v/E)])}THREE.Geometry.call(this);var p=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)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 E in n)this.sides[E]!=void 0&&(this.sides[E]=n[E]);
|
|
-this.sides.px&&o("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],j=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
|
|
|
|
-g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;j=!0;break}}if(!j)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
|
|
-THREE.Cylinder=function(b,c,e,f,g,j){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,o=Math.PI*2,p=f/2;for(n=0;n<b;n++)k(Math.sin(o*n/b)*c,Math.cos(o*n/b)*c,-p);for(n=0;n<b;n++)k(Math.sin(o*n/b)*e,Math.cos(o*n/b)*e,p);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,-p-(j||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,p+(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],j=this.vertices[e.b],p=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/o,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
|
|
|
|
|
|
+this.sides.px&&o("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var h=p.vertices[e],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){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)h=p.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
|
|
+THREE.Cylinder=function(b,c,e,f,g,h){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,o=Math.PI*2,p=f/2;for(n=0;n<b;n++)k(Math.sin(o*n/b)*c,Math.cos(o*n/b)*c,-p);for(n=0;n<b;n++)k(Math.sin(o*n/b)*e,Math.cos(o*n/b)*e,p);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,-p-(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,p+(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],p=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
|
|
-THREE.Icosahedron=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,j=g.vertices[e].position;return c((f.x+j.x)/2,(f.y+j.y)/2,(f.z+j.z)/2)}var g=this,j=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,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in j.faces){var n=f(j.faces[m].a,j.faces[m].b),o=f(j.faces[m].b,j.faces[m].c),p=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,n,p,k);e(j.faces[m].b,o,n,k);e(j.faces[m].c,
|
|
|
|
-p,o,k);e(n,o,p,k)}j.faces=k.faces}g.faces=j.faces;delete j;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
|
|
-THREE.Lathe=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=[],j=[],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=j;n==0&&(j=f);for(m=0;m<
|
|
|
|
|
|
+THREE.Icosahedron=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,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),o=f(h.faces[m].b,h.faces[m].c),p=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,p,k);e(h.faces[m].b,o,n,k);e(h.faces[m].c,
|
|
|
|
+p,o,k);e(n,o,p,k)}h.faces=k.faces}g.faces=h.faces;delete h;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
|
|
+THREE.Lathe=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.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
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.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
-THREE.Plane=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var o=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-j,-(g*o-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.Plane=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 o=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*o-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.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
-THREE.Sphere=function(b,c,e){THREE.Geometry.call(this);for(var f,g=Math.PI,j=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),o=[],p=0;for(f=0;f<j;f++){var t=2*f/j,v=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);o.push(p)}c.push(o)}for(var u,w,E,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){o=f==j-1;k=c[e][o?0:f+1];m=c[e][o?j-1:f];n=c[e-1][o?j-1:f];o=c[e-
|
|
|
|
-1][o?0:f+1];v=e/(g-1);u=(e-1)/(g-1);w=(f+1)/j;var t=f/j,p=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),H=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),E=this.vertices[n].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,v,t]));e>1&&(u=this.vertices[k].position.clone(),
|
|
|
|
|
|
+THREE.Sphere=function(b,c,e){THREE.Geometry.call(this);for(var 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),o=[],p=0;for(f=0;f<h;f++){var t=2*f/h,v=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);o.push(p)}c.push(o)}for(var u,w,E,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){o=f==h-1;k=c[e][o?0:f+1];m=c[e][o?h-1:f];n=c[e-1][o?h-1:f];o=c[e-
|
|
|
|
+1][o?0:f+1];v=e/(g-1);u=(e-1)/(g-1);w=(f+1)/h;var t=f/h,p=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),H=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),E=this.vertices[n].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,v,t]));e>1&&(u=this.vertices[k].position.clone(),
|
|
w=this.vertices[n].position.clone(),E=this.vertices[o].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,n,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,t,H]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
|
|
w=this.vertices[n].position.clone(),E=this.vertices[o].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,n,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,t,H]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
|
|
THREE.Torus=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.Torus=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,j=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,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[j][0],b[j][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
|
|
|
|
-THREE.TorusKnot=function(b,c,e,f,g,j,k){function m(b,c,e,f,g,j){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,j*g*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=j||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=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;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*j.x;g.y+=n*f.y+k*j.y;g.z+=n*f.z+k*j.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,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([k,n,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
|
-THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;
|
|
|
|
-THREE.Text=function(b,c){THREE.Geometry.call(this);var c=c||{},e=c.height!==void 0?c.height:50,f=c.curveSegments!==void 0?c.curveSegments:4;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=f;f=THREE.FontUtils.drawText(b);vertices=f.points;faces=f.faces;contour=f.contour;var f=0,g;for(g in vertices){var j=vertices[g];this.vertices.push(new THREE.Vertex(new THREE.Vector3(j.x,j.y,0)));f++}for(g in vertices)j=vertices[g],this.vertices.push(new THREE.Vertex(new THREE.Vector3(j.x,
|
|
|
|
-j.y,e)));for(g in faces)e=faces[g],this.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(g in faces)e=faces[g],this.faces.push(new THREE.Face3(e[0]+f,e[1]+f,e[2]+f));g=contour.length;for(var k;--g>0;){if(k){if(k.equals(contour[g])){k=null;continue}}else k=contour[g];for(e=0;e<vertices.length;e++)if(vertices[e].equals(contour[g]))break;for(j=0;j<vertices.length;j++)if(vertices[j].equals(contour[g-1]))break;this.faces.push(new THREE.Face4(e,j,j+f,e+f))}this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
-THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
|
|
|
|
-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){if(b.length<3)console.log("not valid polygon");
|
|
|
|
-else{var c=[],e,f,g=[],j;for(j in b)e=b[j],c.push(e.x+","+e.y);e=c[0];e=c.slice(1).indexOf(e);e<c.length&&(e++,f=b.slice(0,e));for(holes=[];e<c.length;){firstIndex=e+1;e=c[firstIndex];e=c.slice(firstIndex+1).indexOf(e)+firstIndex;if(e<=firstIndex)break;var k=b.slice(firstIndex,e+1);this.Triangulate.area(k)<0?(g.push({shape:f,holes:holes}),f=k,holes=[]):holes.push(k);e++}g.push({shape:f,holes:holes});var c=[],m;for(m in g){e=g[m];f=e.shape;holes=e.holes;for(var n in holes){var b=holes[n],k=Number.POSITIVE_INFINITY,
|
|
|
|
-o,p,t;for(t in b){var v=b[t];for(j in f)d=v.distanceTo(f[j]),d<k&&(k=d,o=t,p=j)}prevShapeVert=p-1>=0?p-1:f.length-1;nextShapeVert=p+1<f.length?p+1:0;prevHoleVert=o-1>=0?o-1:b.length-1;nextHoleVert=o+1<b.length?o+1:0;var k=f.slice(0,p),v=f.slice(p),u=b.slice(o),w=b.slice(0,o);c.push(b[o]);c.push(f[p]);c.push(f[prevShapeVert]);c.push(b[o]);c.push(b[prevHoleVert]);c.push(f[p]);e.shape=k.concat(u).concat(w).concat(v)}}b=[];j=[];o=0;for(m in g){e=g[m];f=e.shape;b=b.concat(f);p=THREE.FontUtils.Triangulate(f,
|
|
|
|
-!0);for(var E in p)n=p[E],n[0]+=o,n[1]+=o,n[2]+=o;j=j.concat(p);o+=f.length}for(E=0;E<c.length/3;E++){n=[];for(g=0;g<3;g++)for(f=0;f<b.length;f++)if(b[f].equals(c[E*3+g])){n.push(f);break}j.push(n)}return{points:b,faces:j}}},drawText:function(b){pts=[];for(var c=this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,b=0;b<j;b++)f+=this.extractGlyphPoints(g[b],c,e,f);width=f/2;for(var k in pts)pts[k].x-=width;c=this.extractPoints(pts);c.contour=pts;return c},b2p0:function(b,c){return(1-
|
|
|
|
-b)*(1-b)*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,j,k,m=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];
|
|
|
|
-if(m){if(m.o){c=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=c.length;for(b=0;b<k;)switch(g=c[b++],g){case "m":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "l":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "q":g=c[b++]*e+f;j=c[b++]*e;cpx1=c[b++]*e+f;cpy1=c[b++]*e;var n=pts[pts.length-1];if(n){cpx0=n.x;cpy0=n.y;for(var n=1,o=this.divisions;n<=o;n++){var p=n/o,t=THREE.FontUtils.b2(p,cpx0,cpx1,g),p=THREE.FontUtils.b2(p,cpy0,cpy1,j);pts.push(new THREE.Vector2(t,
|
|
|
|
-p))}}break;case "b":if(g=c[b++]*e+f,j=c[b++]*e,cpx1=c[b++]*e+f,cpy1=c[b++]*-e,cpx2=c[b++]*e+f,cpy2=c[b++]*-e,n=pts[pts.length-1]){cpx0=n.x;cpy0=n.y;n=1;for(o=this.divisions;n<=o;n++)p=n/o,t=THREE.FontUtils.b3(p,cpx0,cpx1,cpx2,g),p=THREE.FontUtils.b3(p,cpy0,cpy1,cpy2,j),pts.push(new THREE.Vector2(t,p))}}}return m.ha*e}}};
|
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,k=0;k<c;j=k++)g+=b[j].x*b[k].y-b[k].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=[],j=b.length;if(j<3)return null;var k=[],m=[],n;if(0<c(b))for(n=0;n<j;n++)k[n]=n;else for(n=0;n<j;n++)k[n]=j-1-n;var o=2*j,p;p=0;for(n=j-1;j>2;){if(0>=o--)return console.log("Warning, unable to triangulate polygon!"),null;var t=n;j<=t&&(t=0);n=t+1;j<=n&&(n=0);var v=n+1;j<=v&&(v=0);var u;a:{u=b;var w=t,E=n,H=v,B=j,K=k,A=void 0,I=void 0,G=void 0,C=
|
|
|
|
-void 0,R=void 0,D=void 0,N=void 0,J=void 0,V=void 0,I=u[K[w]].x,G=u[K[w]].y,C=u[K[E]].x,R=u[K[E]].y,D=u[K[H]].x,N=u[K[H]].y;if(1.0E-10>(C-I)*(N-G)-(R-G)*(D-I))u=!1;else{for(A=0;A<B;A++)if(!(A==w||A==E||A==H)){var J=u[K[A]].x,V=u[K[A]].y,h=void 0,X=void 0,O=void 0,$=void 0,M=void 0,ca=void 0,U=void 0,S=void 0,ja=void 0,W=void 0,ga=void 0,Y=void 0,h=O=M=void 0,h=D-C,X=N-R,O=I-D,$=G-N,M=C-I,ca=R-G,U=J-I,S=V-G,ja=J-C,W=V-R,ga=J-D,Y=V-N,h=h*W-X*ja,M=M*S-ca*U,O=O*Y-$*ga;if(h>=0&&O>=0&&M>=0){u=!1;break a}}u=
|
|
|
|
-!0}}if(u){o=k[t];u=k[n];w=k[v];g.push(b[o]);g.push(b[u]);g.push(b[w]);m.push([k[t],k[n],k[v]]);p++;t=n;for(v=n+1;v<j;t++,v++)k[t]=k[v];j--;o=2*j}}if(f)return m;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
|
|
|
+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.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
|
|
|
|
+THREE.TorusKnot=function(b,c,e,f,g,h,k){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=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),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=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,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
|
+THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Text=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
|
|
|
|
+THREE.Text.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.height!==void 0?c.height:50,f=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=f;THREE.FontUtils.face=g;f=THREE.FontUtils.drawText(b);vertices=f.points;faces=f.faces;contour=f.contour;this.vertices=[];this.faces=[];var f=0,h;for(h in vertices)g=vertices[h],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,
|
|
|
|
+g.y,0))),f++;for(h in vertices)g=vertices[h],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,e)));for(h in faces)e=faces[h],this.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(h in faces)e=faces[h],this.faces.push(new THREE.Face3(e[0]+f,e[1]+f,e[2]+f));h=contour.length;for(var k;--h>0;){if(k){if(k.equals(contour[h])){k=null;continue}}else k=contour[h];for(e=0;e<vertices.length;e++)if(vertices[e].equals(contour[h]))break;for(g=0;g<vertices.length;g++)if(vertices[g].equals(contour[h-
|
|
|
|
+1]))break;this.faces.push(new THREE.Face4(e,g,g+f,e+f))}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){if(b.length<3)throw"not valid polygon";var c=[],
|
|
|
|
+e,f,g=[],h;for(h in b)e=b[h],c.push(e.x+","+e.y);e=c[0];e=c.slice(1).indexOf(e);e<c.length&&(e++,f=b.slice(0,e));for(holes=[];e<c.length;){firstIndex=e+1;e=c[firstIndex];e=c.slice(firstIndex+1).indexOf(e)+firstIndex;if(e<=firstIndex)break;var k=b.slice(firstIndex,e+1);this.Triangulate.area(k)<0?(g.push({shape:f,holes:holes}),f=k,holes=[]):holes.push(k);e++}g.push({shape:f,holes:holes});var c=[],m;for(m in g){e=g[m];f=e.shape;holes=e.holes;for(var n in holes){var b=holes[n],k=Number.POSITIVE_INFINITY,
|
|
|
|
+o,p,t;for(t in b){var v=b[t];for(h in f)d=v.distanceTo(f[h]),d<k&&(k=d,o=t,p=h)}prevShapeVert=p-1>=0?p-1:f.length-1;nextShapeVert=p+1<f.length?p+1:0;prevHoleVert=o-1>=0?o-1:b.length-1;nextHoleVert=o+1<b.length?o+1:0;var k=f.slice(0,p),v=f.slice(p),u=b.slice(o),w=b.slice(0,o);c.push(b[o]);c.push(f[p]);c.push(f[prevShapeVert]);c.push(b[o]);c.push(b[prevHoleVert]);c.push(f[p]);f=k.concat(u).concat(w).concat(v)}e.shape=f}b=[];h=[];o=0;for(m in g){e=g[m];f=e.shape;b=b.concat(f);p=THREE.FontUtils.Triangulate(f,
|
|
|
|
+!0);for(var E in p)n=p[E],n[0]+=o,n[1]+=o,n[2]+=o;h=h.concat(p);o+=f.length}for(E=0;E<c.length/3;E++){n=[];for(g=0;g<3;g++){m=!1;for(f=0;f<b.length&&!m;f++){var H=E*3+g;b[f].equals(c[H])&&(n.push(f),m=!0)}m||(b.push(c[H]),n.push(b.length-1))}h.push(n)}return{points:b,faces:h}},drawText:function(b){pts=[];for(var c=this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),h=g.length,b=0;b<h;b++)f+=this.extractGlyphPoints(g[b],c,e,f);width=f/2;for(var k in pts)pts[k].x-=width;c=this.extractPoints(pts);
|
|
|
|
+c.contour=pts;return c},b2p0:function(b,c){return(1-b)*(1-b)*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,h,k,m=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(m){if(m.o){c=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=c.length;for(b=0;b<k;)switch(g=c[b++],g){case "m":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "l":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "q":g=c[b++]*e+f;h=c[b++]*e;cpx1=c[b++]*e+f;cpy1=c[b++]*e;var n=pts[pts.length-1];if(n){cpx0=n.x;cpy0=n.y;for(var n=1,o=this.divisions;n<=o;n++){var p=n/o,t=THREE.FontUtils.b2(p,
|
|
|
|
+cpx0,cpx1,g),p=THREE.FontUtils.b2(p,cpy0,cpy1,h);pts.push(new THREE.Vector2(t,p))}}break;case "b":if(g=c[b++]*e+f,h=c[b++]*e,cpx1=c[b++]*e+f,cpy1=c[b++]*-e,cpx2=c[b++]*e+f,cpy2=c[b++]*-e,n=pts[pts.length-1]){cpx0=n.x;cpy0=n.y;n=1;for(o=this.divisions;n<=o;n++)p=n/o,t=THREE.FontUtils.b3(p,cpx0,cpx1,cpx2,g),p=THREE.FontUtils.b3(p,cpy0,cpy1,cpy2,h),pts.push(new THREE.Vector2(t,p))}}}return m.ha*e}}};
|
|
|
|
+(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=[],h=b.length;if(h<3)return null;var k=[],m=[],n;if(0<c(b))for(n=0;n<h;n++)k[n]=n;else for(n=0;n<h;n++)k[n]=h-1-n;var o=2*h,p;p=0;for(n=h-1;h>2;){if(0>=o--)throw"Warning, unable to triangulate polygon!";var t=n;h<=t&&(t=0);n=t+1;h<=n&&(n=0);var v=n+1;h<=v&&(v=0);var u;a:{u=b;var w=t,E=n,H=v,B=h,K=k,A=void 0,I=void 0,G=void 0,C=void 0,R=void 0,D=void 0,
|
|
|
|
+N=void 0,J=void 0,V=void 0,I=u[K[w]].x,G=u[K[w]].y,C=u[K[E]].x,R=u[K[E]].y,D=u[K[H]].x,N=u[K[H]].y;if(1.0E-10>(C-I)*(N-G)-(R-G)*(D-I))u=!1;else{for(A=0;A<B;A++)if(!(A==w||A==E||A==H)){var J=u[K[A]].x,V=u[K[A]].y,j=void 0,X=void 0,O=void 0,$=void 0,M=void 0,ca=void 0,U=void 0,S=void 0,ja=void 0,W=void 0,fa=void 0,Y=void 0,j=O=M=void 0,j=D-C,X=N-R,O=I-D,$=G-N,M=C-I,ca=R-G,U=J-I,S=V-G,ja=J-C,W=V-R,fa=J-D,Y=V-N,j=j*W-X*ja,M=M*S-ca*U,O=O*Y-$*fa;if(j>=0&&O>=0&&M>=0){u=!1;break a}}u=!0}}if(u){o=k[t];u=k[n];
|
|
|
|
+w=k[v];g.push(b[o]);g.push(b[u]);g.push(b[w]);m.push([k[t],k[n],k[v]]);p++;t=n;for(v=n+1;v<h;t++,v++)k[t]=k[v];h--;o=2*h}}if(f)return m;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};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)]},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)/
|
|
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)]},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}var g,j,k;g="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?g="MeshPhongMaterial":b.shading=="Basic"&&(g="MeshBasicMaterial"));if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending==
|
|
|
|
-"Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c)k=document.createElement("canvas"),j.map=new THREE.Texture(k),j.map.sourceFile=b.mapDiffuse,f(j.map,c+"/"+b.mapDiffuse);else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
|
|
|
|
-255<<8)+b.colorDiffuse[2]*255,j.color=k,j.opacity=b.transparency;else if(b.DbgColor)j.color=b.DbgColor;if(b.mapLightmap&&c)k=document.createElement("canvas"),j.lightMap=new THREE.Texture(k),j.lightMap.sourceFile=b.mapLightmap,f(j.lightMap,c+"/"+b.mapLightmap);return new THREE[g](j)}};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;
|
|
|
|
|
|
+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}var g,h,k;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?g="MeshPhongMaterial":b.shading=="Basic"&&(g="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.mapDiffuse&&c)k=document.createElement("canvas"),h.map=new THREE.Texture(k),h.map.sourceFile=b.mapDiffuse,f(h.map,c+"/"+b.mapDiffuse);else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
|
|
|
|
+255<<8)+b.colorDiffuse[2]*255,h.color=k,h.opacity=b.transparency;else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c)k=document.createElement("canvas"),h.lightMap=new THREE.Texture(k),h.lightMap.sourceFile=b.mapLightmap,f(h.lightMap,c+"/"+b.mapLightmap);return new THREE[g](h)}};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.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,n,o,p,t,v,u,w,E,H,B,K,A,I=b.faces;t=b.vertices;var G=b.normals,C=b.colors,R=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&R++;for(e=0;e<R;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=t.length;o<p;)v=new THREE.Vertex,v.position.x=t[o++]*c,v.position.y=
|
|
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,n,o,p,t,v,u,w,E,H,B,K,A,I=b.faces;t=b.vertices;var G=b.normals,C=b.colors,R=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&R++;for(e=0;e<R;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=t.length;o<p;)v=new THREE.Vertex,v.position.x=t[o++]*c,v.position.y=
|
|
t[o++]*c,v.position.z=t[o++]*c,f.vertices.push(v);o=0;for(p=I.length;o<p;){c=I[o++];t=c&1;n=c&2;e=c&4;g=c&8;u=c&16;v=c&32;E=c&64;c&=128;t?(H=new THREE.Face4,H.a=I[o++],H.b=I[o++],H.c=I[o++],H.d=I[o++],t=4):(H=new THREE.Face3,H.a=I[o++],H.b=I[o++],H.c=I[o++],t=3);if(n)n=I[o++],H.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<R;e++)B=b.uvs[e],w=I[o++],A=B[w*2],w=B[w*2+1],f.faceUvs[e][n]=new THREE.UV(A,w);if(g)for(e=0;e<R;e++){B=b.uvs[e];K=[];for(g=0;g<t;g++)w=I[o++],A=B[w*2],w=B[w*2+1],K[g]=
|
|
t[o++]*c,v.position.z=t[o++]*c,f.vertices.push(v);o=0;for(p=I.length;o<p;){c=I[o++];t=c&1;n=c&2;e=c&4;g=c&8;u=c&16;v=c&32;E=c&64;c&=128;t?(H=new THREE.Face4,H.a=I[o++],H.b=I[o++],H.c=I[o++],H.d=I[o++],t=4):(H=new THREE.Face3,H.a=I[o++],H.b=I[o++],H.c=I[o++],t=3);if(n)n=I[o++],H.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<R;e++)B=b.uvs[e],w=I[o++],A=B[w*2],w=B[w*2+1],f.faceUvs[e][n]=new THREE.UV(A,w);if(g)for(e=0;e<R;e++){B=b.uvs[e];K=[];for(g=0;g<t;g++)w=I[o++],A=B[w*2],w=B[w*2+1],K[g]=
|
|
@@ -471,47 +471,47 @@ new THREE.UV(A,w);f.faceVertexUvs[e][n]=K}if(u)u=I[o++]*3,g=new THREE.Vector3,g.
|
|
n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,o,p,t,v,u,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=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(o=w.length;n<o;n+=3)p=w[n]*c,t=w[n+1]*
|
|
n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,o,p,t,v,u,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=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(o=w.length;n<o;n+=3)p=w[n]*c,t=w[n+1]*
|
|
c,v=w[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(p,t,v)))}}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=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(n=p.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.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],
|
|
c,v=w[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(p,t,v)))}}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=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(n=p.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.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();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;
|
|
f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();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),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
|
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){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?j&&(n==0&&(n=k.getResponseHeader("Content-Length")),j({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");
|
|
|
|
|
|
+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(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(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=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(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=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
|
|
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+R);c=n(b,c+D);THREE.BinaryLoader.prototype.f3(B,e,f,h,c)}function v(c){var e,f,h,j,k,p;e=g(b,c);f=g(b,c+C);h=g(b,c+R);j=n(b,c+D);k=g(b,c+N);p=g(b,c+J);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(B,I,e,f,h,j,k,p,c)}function u(c){var e,f,j,k;e=g(b,c);f=g(b,c+h);j=g(b,c+X);k=g(b,c+O);c=n(b,c+$);THREE.BinaryLoader.prototype.f4(B,e,f,j,k,c)}function w(c){var e,f,j,k,p,o,t,u;e=g(b,c);f=g(b,c+h);j=g(b,c+X);k=g(b,c+O);p=n(b,
|
|
|
|
-c+$);o=g(b,c+M);t=g(b,c+ca);u=g(b,c+U);c=g(b,c+S);THREE.BinaryLoader.prototype.f4n(B,I,e,f,j,k,p,o,t,u,c)}function E(c){var e,f;e=g(b,c);f=g(b,c+ja);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function H(c){var e,f,h;e=g(b,c);f=g(b,c+ga);h=g(b,c+Y);c=g(b,c+ha);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var B=this,K=0,A,I=[],G=[],C,R,D,N,J,V,h,X,O,$,M,ca,U,S,
|
|
|
|
-ja,W,ga,Y,ha,ea,Q,T,Z,ka,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,c);A={signature:b.substr(K,8),header_bytes:p(b,K+8),vertex_coordinate_bytes:p(b,K+9),normal_coordinate_bytes:p(b,K+10),uv_coordinate_bytes:p(b,K+11),vertex_index_bytes:p(b,K+12),normal_index_bytes:p(b,K+13),uv_index_bytes:p(b,K+14),material_index_bytes:p(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+=A.header_bytes;C=A.vertex_index_bytes;R=A.vertex_index_bytes*2;D=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;J=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;h=A.vertex_index_bytes;X=A.vertex_index_bytes*2;O=A.vertex_index_bytes*3;$=A.vertex_index_bytes*4;M=A.vertex_index_bytes*
|
|
|
|
-4+A.material_index_bytes;ca=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ja=A.uv_index_bytes;W=A.uv_index_bytes*2;ga=A.uv_index_bytes;Y=A.uv_index_bytes*2;ha=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;na=A.vertex_index_bytes*4+A.material_index_bytes;ea=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes*3);T=A.ntri_flat_uv*
|
|
|
|
-(c+A.uv_index_bytes*3);Z=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ka=A.nquad_flat*na;c=A.nquad_smooth*(na+A.normal_index_bytes*4);na=A.nquad_flat_uv*(na+A.uv_index_bytes*4);K+=function(c){for(var f,g,h,j=A.vertex_coordinate_bytes*3,m=c+A.nvertices*j;c<m;c+=j)f=e(b,c),g=e(b,c+A.vertex_coordinate_bytes),h=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,f,g,h);return A.nvertices*j}(K);K+=function(c){for(var e,f,g,h=A.normal_coordinate_bytes*3,j=c+A.nnormals*
|
|
|
|
-h;c<j;c+=h)e=o(b,c),f=o(b,c+A.normal_coordinate_bytes),g=o(b,c+A.normal_coordinate_bytes*2),I.push(e/127,f/127,g/127);return A.nnormals*h}(K);K+=function(c){for(var f,g,h=A.uv_coordinate_bytes*2,j=c+A.nuvs*h;c<j;c+=h)f=e(b,c),g=e(b,c+A.uv_coordinate_bytes),G.push(f,g);return A.nuvs*h}(K);ea=K+ea;Q=ea+Q;T=Q+T;Z=T+Z;ka=Z+ka;c=ka+c;na=c+na;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,g=b+A.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),E(c+e);return g-b})(Q);(function(b){var c,
|
|
|
|
-e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,g=b+A.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),E(c+e);return g-b})(T);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,g=b+A.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),H(c+e);return g-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,g=b+A.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),H(c+e);return g-b})(na);
|
|
|
|
|
|
+c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+R);c=n(b,c+D);THREE.BinaryLoader.prototype.f3(B,e,f,h,c)}function v(c){var e,f,h,j,k,p;e=g(b,c);f=g(b,c+C);h=g(b,c+R);j=n(b,c+D);k=g(b,c+N);p=g(b,c+J);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(B,I,e,f,h,j,k,p,c)}function u(c){var e,f,h,k;e=g(b,c);f=g(b,c+j);h=g(b,c+X);k=g(b,c+O);c=n(b,c+$);THREE.BinaryLoader.prototype.f4(B,e,f,h,k,c)}function w(c){var e,f,h,k,p,o,t,u;e=g(b,c);f=g(b,c+j);h=g(b,c+X);k=g(b,c+O);p=n(b,
|
|
|
|
+c+$);o=g(b,c+M);t=g(b,c+ca);u=g(b,c+U);c=g(b,c+S);THREE.BinaryLoader.prototype.f4n(B,I,e,f,h,k,p,o,t,u,c)}function E(c){var e,f;e=g(b,c);f=g(b,c+ja);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function H(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+Y);c=g(b,c+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var B=this,K=0,A,I=[],G=[],C,R,D,N,J,V,j,X,O,$,M,ca,U,S,
|
|
|
|
+ja,W,fa,Y,ga,ea,Q,T,Z,ka,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,c);A={signature:b.substr(K,8),header_bytes:p(b,K+8),vertex_coordinate_bytes:p(b,K+9),normal_coordinate_bytes:p(b,K+10),uv_coordinate_bytes:p(b,K+11),vertex_index_bytes:p(b,K+12),normal_index_bytes:p(b,K+13),uv_index_bytes:p(b,K+14),material_index_bytes:p(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+=A.header_bytes;C=A.vertex_index_bytes;R=A.vertex_index_bytes*2;D=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;J=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;j=A.vertex_index_bytes;X=A.vertex_index_bytes*2;O=A.vertex_index_bytes*3;$=A.vertex_index_bytes*4;M=A.vertex_index_bytes*
|
|
|
|
+4+A.material_index_bytes;ca=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ja=A.uv_index_bytes;W=A.uv_index_bytes*2;fa=A.uv_index_bytes;Y=A.uv_index_bytes*2;ga=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;na=A.vertex_index_bytes*4+A.material_index_bytes;ea=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes*3);T=A.ntri_flat_uv*
|
|
|
|
+(c+A.uv_index_bytes*3);Z=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ka=A.nquad_flat*na;c=A.nquad_smooth*(na+A.normal_index_bytes*4);na=A.nquad_flat_uv*(na+A.uv_index_bytes*4);K+=function(c){for(var f,h,g,j=A.vertex_coordinate_bytes*3,m=c+A.nvertices*j;c<m;c+=j)f=e(b,c),h=e(b,c+A.vertex_coordinate_bytes),g=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,f,h,g);return A.nvertices*j}(K);K+=function(c){for(var e,f,h,g=A.normal_coordinate_bytes*3,j=c+A.nnormals*
|
|
|
|
+g;c<j;c+=g)e=o(b,c),f=o(b,c+A.normal_coordinate_bytes),h=o(b,c+A.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return A.nnormals*g}(K);K+=function(c){for(var f,h,g=A.uv_coordinate_bytes*2,j=c+A.nuvs*g;c<j;c+=g)f=e(b,c),h=e(b,c+A.uv_coordinate_bytes),G.push(f,h);return A.nuvs*g}(K);ea=K+ea;Q=ea+Q;T=Q+T;Z=T+Z;ka=Z+ka;c=ka+c;na=c+na;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,h=b+A.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),E(c+e);return h-b})(Q);(function(b){var c,
|
|
|
|
+e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,h=b+A.ntri_smooth_uv*f;for(c=b;c<h;c+=f)v(c),E(c+e);return h-b})(T);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,h=b+A.nquad_flat_uv*f;for(c=b;c<h;c+=f)u(c),H(c+e);return h-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,h=b+A.nquad_smooth_uv*f;for(c=b;c<h;c+=f)w(c),H(c+e);return h-b})(na);
|
|
(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(K);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ea);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(Z);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=b+A.nquad_smooth*
|
|
(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(K);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ea);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(Z);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=b+A.nquad_smooth*
|
|
-e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals()};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,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,f,g,j,k,m,n){var j=b.materials[j],o=c[m*3],p=c[m*3+1],m=c[m*3+2],
|
|
|
|
-t=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(o,p,m),new THREE.Vector3(t,v,n)],null,j))},f4n:function(b,c,e,f,g,j,k,m,n,o,p){var k=b.materials[k],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[o*3],w=c[o*3+1],o=c[o*3+2],E=c[p*3],H=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,n),new THREE.Vector3(u,w,o),new THREE.Vector3(E,H,p)],null,k))},uv3:function(b,
|
|
|
|
-c,e,f,g,j,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,k));b.push(m)},uv4:function(b,c,e,f,g,j,k,m,n){var o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(j,k));o.push(new THREE.UV(m,n));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
|
|
|
+e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals()};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],o=c[m*3],p=c[m*3+1],m=c[m*3+2],
|
|
|
|
+t=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(o,p,m),new THREE.Vector3(t,v,n)],null,h))},f4n:function(b,c,e,f,g,h,k,m,n,o,p){var k=b.materials[k],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[o*3],w=c[o*3+1],o=c[o*3+2],E=c[p*3],H=c[p*3+1],p=c[p*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(t,v,n),new THREE.Vector3(u,w,o),new THREE.Vector3(E,H,p)],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 o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,k));o.push(new THREE.UV(m,n));b.push(o)}};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(u in J.objects)if(!M.objects[u])if(K=J.objects[u],K.geometry!==void 0){if(C=M.geometries[K.geometry]){N=[];for(S=0;S<K.materials.length;S++)N[S]=M.materials[K.materials[S]];A=K.position;r=K.rotation;q=K.quaternion;s=K.scale;q=0;N.length==0&&(N[0]=new THREE.MeshFaceMaterial);
|
|
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(u in J.objects)if(!M.objects[u])if(K=J.objects[u],K.geometry!==void 0){if(C=M.geometries[K.geometry]){N=[];for(S=0;S<K.materials.length;S++)N[S]=M.materials[K.materials[S]];A=K.position;r=K.rotation;q=K.quaternion;s=K.scale;q=0;N.length==0&&(N[0]=new THREE.MeshFaceMaterial);
|
|
N.length>1&&(N=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,N);object.name=u;object.position.set(A[0],A[1],A[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;M.scene.addObject(object);M.objects[u]=object;if(K.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);M.scene.collisions.colliders.push(b)}if(K.castsShadow)b=new THREE.ShadowVolume(C),M.scene.addChild(b),
|
|
N.length>1&&(N=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,N);object.name=u;object.position.set(A[0],A[1],A[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;M.scene.addObject(object);M.objects[u]=object;if(K.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);M.scene.collisions.colliders.push(b)}if(K.castsShadow)b=new THREE.ShadowVolume(C),M.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},M.triggers[object.name]=b)}}else A=K.position,r=K.rotation,q=K.quaternion,s=K.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[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,M.scene.addObject(object),
|
|
b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},M.triggers[object.name]=b)}}else A=K.position,r=K.rotation,q=K.quaternion,s=K.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[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,M.scene.addObject(object),
|
|
-M.objects[u]=object,M.empties[u]=object,K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},M.triggers[object.name]=b)}function n(b){return function(c){M.geometries[b]=c;m();h-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:O,totalTextures:$,loadedModels:O-h,loadedTextures:$-X},M);e.onLoadProgress();h==0&&X==0&&c(M)}var t,v,u,w,E,H,B,K,A,I,G,C,R,D,N,J,V,h,X,O,$,M;J=b.data;b=new THREE.BinaryLoader;V=new THREE.JSONLoader;
|
|
|
|
-X=h=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ca=!1;for(u in J.objects)if(K=J.objects[u],K.meshCollider){ca=!0;break}if(ca)M.scene.collisions=new THREE.CollisionSystem;if(J.transform){ca=J.transform.position;I=J.transform.rotation;var U=J.transform.scale;ca&&M.scene.position.set(ca[0],ca[1],ca[2]);I&&M.scene.rotation.set(I[0],I[1],I[2]);U&&M.scene.scale.set(U[0],U[1],U[2]);(ca||I||U)&&M.scene.updateMatrix()}ca=
|
|
|
|
|
|
+M.objects[u]=object,M.empties[u]=object,K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},M.triggers[object.name]=b)}function n(b){return function(c){M.geometries[b]=c;m();j-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:O,totalTextures:$,loadedModels:O-j,loadedTextures:$-X},M);e.onLoadProgress();j==0&&X==0&&c(M)}var t,v,u,w,E,H,B,K,A,I,G,C,R,D,N,J,V,j,X,O,$,M;J=b.data;b=new THREE.BinaryLoader;V=new THREE.JSONLoader;
|
|
|
|
+X=j=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ca=!1;for(u in J.objects)if(K=J.objects[u],K.meshCollider){ca=!0;break}if(ca)M.scene.collisions=new THREE.CollisionSystem;if(J.transform){ca=J.transform.position;I=J.transform.rotation;var U=J.transform.scale;ca&&M.scene.position.set(ca[0],ca[1],ca[2]);I&&M.scene.rotation.set(I[0],I[1],I[2]);U&&M.scene.scale.set(U[0],U[1],U[2]);(ca||I||U)&&M.scene.updateMatrix()}ca=
|
|
function(){X-=1;p();e.onLoadComplete()};for(E in J.cameras){I=J.cameras[E];if(I.type=="perspective")R=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")R=new THREE.Camera,R.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);A=I.position;I=I.target;R.position.set(A[0],A[1],A[2]);R.target.position.set(I[0],I[1],I[2]);M.cameras[E]=R}for(w in J.lights){E=J.lights[w];R=E.color!==void 0?E.color:16777215;I=E.intensity!==void 0?E.intensity:1;if(E.type==
|
|
function(){X-=1;p();e.onLoadComplete()};for(E in J.cameras){I=J.cameras[E];if(I.type=="perspective")R=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")R=new THREE.Camera,R.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);A=I.position;I=I.target;R.position.set(A[0],A[1],A[2]);R.target.position.set(I[0],I[1],I[2]);M.cameras[E]=R}for(w in J.lights){E=J.lights[w];R=E.color!==void 0?E.color:16777215;I=E.intensity!==void 0?E.intensity:1;if(E.type==
|
|
"directional")A=E.direction,light=new THREE.DirectionalLight(R,I),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(E.type=="point")A=E.position,light=new THREE.PointLight(R,I),light.position.set(A[0],A[1],A[2]);M.scene.addLight(light);M.lights[w]=light}for(H in J.fogs)w=J.fogs[H],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,w.density)),I=w.color,D.color.setRGB(I[0],I[1],I[2]),M.fogs[H]=D;if(M.cameras&&J.defaults.camera)M.currentCamera=
|
|
"directional")A=E.direction,light=new THREE.DirectionalLight(R,I),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(E.type=="point")A=E.position,light=new THREE.PointLight(R,I),light.position.set(A[0],A[1],A[2]);M.scene.addLight(light);M.lights[w]=light}for(H in J.fogs)w=J.fogs[H],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,w.density)),I=w.color,D.color.setRGB(I[0],I[1],I[2]),M.fogs[H]=D;if(M.cameras&&J.defaults.camera)M.currentCamera=
|
|
-M.cameras[J.defaults.camera];if(M.fogs&&J.defaults.fog)M.scene.fog=M.fogs[J.defaults.fog];I=J.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(I[0],I[1],I[2]);M.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(H=J.geometries[t],H.type=="bin_mesh"||H.type=="ascii_mesh")h+=1,e.onLoadStart();O=h;for(t in J.geometries)H=J.geometries[t],H.type=="cube"?(C=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides),M.geometries[t]=C):
|
|
|
|
|
|
+M.cameras[J.defaults.camera];if(M.fogs&&J.defaults.fog)M.scene.fog=M.fogs[J.defaults.fog];I=J.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(I[0],I[1],I[2]);M.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(H=J.geometries[t],H.type=="bin_mesh"||H.type=="ascii_mesh")j+=1,e.onLoadStart();O=j;for(t in J.geometries)H=J.geometries[t],H.type=="cube"?(C=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides),M.geometries[t]=C):
|
|
H.type=="plane"?(C=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="sphere"?(C=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="cylinder"?(C=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset),M.geometries[t]=C):H.type=="torus"?(C=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT),M.geometries[t]=C):H.type=="icosahedron"?(C=new THREE.Icosahedron(H.subdivisions),M.geometries[t]=C):
|
|
H.type=="plane"?(C=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="sphere"?(C=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="cylinder"?(C=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset),M.geometries[t]=C):H.type=="torus"?(C=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT),M.geometries[t]=C):H.type=="icosahedron"?(C=new THREE.Icosahedron(H.subdivisions),M.geometries[t]=C):
|
|
H.type=="bin_mesh"?b.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="ascii_mesh"?V.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="embedded_mesh"&&(H=J.embeds[H.id])&&V.createModel(H,o(t),"");for(B in J.textures)if(t=J.textures[B],t.url instanceof Array){X+=t.url.length;for(b=0;b<t.url.length;b++)e.onLoadStart()}else X+=1,e.onLoadStart();$=X;for(B in J.textures){t=J.textures[B];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof
|
|
H.type=="bin_mesh"?b.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="ascii_mesh"?V.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="embedded_mesh"&&(H=J.embeds[H.id])&&V.createModel(H,o(t),"");for(B in J.textures)if(t=J.textures[B],t.url instanceof Array){X+=t.url.length;for(b=0;b<t.url.length;b++)e.onLoadStart()}else X+=1,e.onLoadStart();$=X;for(B in J.textures){t=J.textures[B];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof
|
|
Array){for(var b=[],S=0;S<t.url.length;S++)b[S]=f(t.url[S],J.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,ca)}else{b=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,ca);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter]}M.textures[B]=b}for(v in J.materials){B=J.materials[v];for(G in B.parameters)if(G=="envMap"||G=="map"||G=="lightMap")B.parameters[G]=M.textures[B.parameters[G]];else if(G=="shading")B.parameters[G]=
|
|
Array){for(var b=[],S=0;S<t.url.length;S++)b[S]=f(t.url[S],J.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,ca)}else{b=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,ca);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter]}M.textures[B]=b}for(v in J.materials){B=J.materials[v];for(G in B.parameters)if(G=="envMap"||G=="map"||G=="lightMap")B.parameters[G]=M.textures[B.parameters[G]];else if(G=="shading")B.parameters[G]=
|
|
B.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")B.parameters[G]=THREE[B.parameters[G]]?THREE[B.parameters[G]]:THREE.NormalBlending;else if(G=="combine")B.parameters[G]=B.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(B.parameters[G]=="face")B.parameters[G]=THREE.FaceColors;else if(B.parameters[G])B.parameters[G]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=
|
|
B.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")B.parameters[G]=THREE[B.parameters[G]]?THREE[B.parameters[G]]:THREE.NormalBlending;else if(G=="combine")B.parameters[G]=B.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(B.parameters[G]=="face")B.parameters[G]=THREE.FaceColors;else if(B.parameters[G])B.parameters[G]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=
|
|
!0;B=new THREE[B.type](B.parameters);M.materials[v]=B}m();e.callbackSync(M)}}};
|
|
!0;B=new THREE[B.type](B.parameters);M.materials[v]=B}m();e.callbackSync(M)}}};
|
|
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,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m+k*this.delta;c[j+1]=n;c[j+2]=o;g[j]=this.lerp(p[b],p[b+3],k);g[j+1]=this.lerp(p[b+1],p[b+4],k);g[j+2]=this.lerp(p[b+2],p[b+5],k)};this.VIntY=function(b,c,g,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m;c[j+1]=n+k*this.delta;c[j+
|
|
|
|
-2]=o;c=b+this.yd*3;g[j]=this.lerp(p[b],p[c],k);g[j+1]=this.lerp(p[b+1],p[c+1],k);g[j+2]=this.lerp(p[b+2],p[c+2],k)};this.VIntZ=function(b,c,g,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=o+k*this.delta;c=b+this.zd*3;g[j]=this.lerp(p[b],p[c],k);g[j+1]=this.lerp(p[b+1],p[c+1],k);g[j+2]=this.lerp(p[b+2],p[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,j,k,m){var n=j+1,o=j+this.yd,p=j+this.zd,t=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,w=n+this.yd+this.zd,E=0,H=this.field[j],B=this.field[n],K=this.field[o],A=this.field[t],I=this.field[p],G=this.field[v],C=this.field[u],R=this.field[w];H<k&&(E|=1);B<k&&(E|=2);K<k&&(E|=8);A<k&&(E|=4);I<k&&(E|=16);G<k&&(E|=32);C<k&&(E|=128);R<k&&(E|=64);var D=THREE.edgeTable[E];if(D==0)return 0;var N=this.delta,
|
|
|
|
-J=b+N,V=c+N,N=g+N;D&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,k,b,c,g,H,B));D&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,J,c,g,B,A));D&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,k,b,V,g,K,A));D&8&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,9,k,b,c,g,H,K));D&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,k,b,c,N,I,G));D&32&&(this.compNorm(v),
|
|
|
|
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,k,J,c,N,G,R));D&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,k,b,V,N,C,R));D&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,k,b,c,N,I,C));D&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,k,b,c,g,H,I));D&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,J,c,g,B,G));D&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
|
|
|
|
-3,this.vlist,this.nlist,30,k,J,V,g,A,R));D&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,k,b,V,g,K,C));E<<=4;for(k=j=0;THREE.triTable[E+k]!=-1;)b=E+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,j++;return j};this.posnormtriv=function(b,c,g,j,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[j];this.positionArray[n+
|
|
|
|
-4]=b[j+1];this.positionArray[n+5]=b[j+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[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+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,j,k){var m=this.size*Math.sqrt(j/k),n=g*this.size,o=c*this.size,p=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size-
|
|
|
|
-1);for(var w,E,H,B,K,A;t<n;t++){p=this.size2*t;E=t/this.size-g;K=E*E;for(E=v;E<o;E++){H=p+this.size*E;w=E/this.size-c;A=w*w;for(w=u;w<m;w++)B=w/this.size-b,B=j/(1.0E-6+B*B+A+K)-k,B>0&&(this.field[H+w]+=B)}}};this.addPlaneX=function(b,c){var g,j,k,m,n,o=this.size,p=this.yd,t=this.zd,v=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(g=0;g<u;g++)if(j=g/o,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<o;j++){n=g+j*p;for(k=0;k<o;k++)v[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,j,k,m,n,o,p=this.size,t=this.yd,v=
|
|
|
|
-this.zd,u=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(j=0;j<w;j++)if(g=j/p,g*=g,m=b/(1.0E-4+g)-c,m>0){n=j*t;for(g=0;g<p;g++){o=n+g;for(k=0;k<p;k++)u[v*k+o]+=m}}};this.addPlaneZ=function(b,c){var g,j,k,m,n,o;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(j=0;j<size;j++){o=n+j*yd;for(g=0;g<size;g++)field[o+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,j,k,m,n,o,p,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;o=(k-this.halfsize)/this.halfsize;for(j=1;j<v;j++){p=t+this.size*j;n=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(m,n,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var k,m,n,o,p,t,v,u;for(k=0;k<j.count;k++)v=k*3,p=v+1,u=v+2,m=j.positionArray[v],
|
|
|
|
-n=j.positionArray[p],o=j.positionArray[u],t=new THREE.Vector3(m,n,o),m=j.normalArray[v],n=j.normalArray[p],o=j.normalArray[u],v=new THREE.Vector3(m,n,o),v.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),g.push(v);nfaces=j.count/3;for(k=0;k<nfaces;k++)v=(b+k)*3,p=v+1,u=v+2,t=g[v],m=g[p],n=g[u],v=new THREE.Face3(v,p,u,[t,m,n]),c.faces.push(v);b+=nfaces;j.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,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m+k*this.delta;c[h+1]=n;c[h+2]=o;g[h]=this.lerp(p[b],p[b+3],k);g[h+1]=this.lerp(p[b+1],p[b+4],k);g[h+2]=this.lerp(p[b+2],p[b+5],k)};this.VIntY=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n+k*this.delta;c[h+
|
|
|
|
+2]=o;c=b+this.yd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[c+2],k)};this.VIntZ=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=o+k*this.delta;c=b+this.zd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[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,o=h+this.yd,p=h+this.zd,t=n+this.yd,v=n+this.zd,u=h+this.yd+this.zd,w=n+this.yd+this.zd,E=0,H=this.field[h],B=this.field[n],K=this.field[o],A=this.field[t],I=this.field[p],G=this.field[v],C=this.field[u],R=this.field[w];H<k&&(E|=1);B<k&&(E|=2);K<k&&(E|=8);A<k&&(E|=4);I<k&&(E|=16);G<k&&(E|=32);C<k&&(E|=128);R<k&&(E|=64);var D=THREE.edgeTable[E];if(D==0)return 0;var N=this.delta,
|
|
|
|
+J=b+N,V=c+N,N=g+N;D&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,g,H,B));D&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,J,c,g,B,A));D&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,k,b,V,g,K,A));D&8&&(this.compNorm(h),this.compNorm(o),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,g,H,K));D&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,k,b,c,N,I,G));D&32&&(this.compNorm(v),
|
|
|
|
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,k,J,c,N,G,R));D&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,k,b,V,N,C,R));D&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,k,b,c,N,I,C));D&256&&(this.compNorm(h),this.compNorm(p),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,g,H,I));D&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,J,c,g,B,G));D&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
|
|
|
|
+3,this.vlist,this.nlist,30,k,J,V,g,A,R));D&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,k,b,V,g,K,C));E<<=4;for(k=h=0;THREE.triTable[E+k]!=-1;)b=E+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,o=c*this.size,p=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size-
|
|
|
|
+1);for(var w,E,H,B,K,A;t<n;t++){p=this.size2*t;E=t/this.size-g;K=E*E;for(E=v;E<o;E++){H=p+this.size*E;w=E/this.size-c;A=w*w;for(w=u;w<m;w++)B=w/this.size-b,B=h/(1.0E-6+B*B+A+K)-k,B>0&&(this.field[H+w]+=B)}}};this.addPlaneX=function(b,c){var g,h,k,m,n,o=this.size,p=this.yd,t=this.zd,v=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(g=0;g<u;g++)if(h=g/o,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<o;h++){n=g+h*p;for(k=0;k<o;k++)v[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,h,k,m,n,o,p=this.size,t=this.yd,v=
|
|
|
|
+this.zd,u=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(g=h/p,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*t;for(g=0;g<p;g++){o=n+g;for(k=0;k<p;k++)u[v*k+o]+=m}}};this.addPlaneZ=function(b,c){var g,h,k,m,n,o;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++){o=n+h*yd;for(g=0;g<size;g++)field[o+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,o,p,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;o=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){p=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(m,n,o,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,o,p,t,v,u;for(k=0;k<h.count;k++)v=k*3,p=v+1,u=v+2,m=h.positionArray[v],
|
|
|
|
+n=h.positionArray[p],o=h.positionArray[u],t=new THREE.Vector3(m,n,o),m=h.normalArray[v],n=h.normalArray[p],o=h.normalArray[u],v=new THREE.Vector3(m,n,o),v.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),g.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(b+k)*3,p=v+1,u=v+2,t=g[v],m=g[p],n=g[u],v=new THREE.Face3(v,p,u,[t,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]);
|
|
@@ -540,20 +540,20 @@ 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,j=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>j?this.hits.push(g):this.hits.unshift(g),j=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,j=0;j<c.numFaces;j++){var k=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,o=c.mesh.geometry.vertices[k.c].position,p=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
-k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,o,p,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;j.set(0,0,0);k.sub(e,c);m.sub(f,e);j.cross(k,m);m=j.dot(b.direction);if(!(m<0))return Number.MAX_VALUE;k=j.dot(c)-j.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(j.x)>Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=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,j=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(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=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,j=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=j*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*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
|
|
|
|
|
|
+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,o=c.mesh.geometry.vertices[k.c].position,p=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
+k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,o,p,f,this.collisionNormal),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){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(e,c);m.sub(f,e);h.cross(k,m);m=h.dot(b.direction);if(!(m<0))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,j=0,k=0,m=0,n=0,o=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,o=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,o=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
|
-o=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,o=!1,n=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);j>f&&(o=2,f=j);switch(o){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*
|
|
|
|
|
|
+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,o=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,o=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,o=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
|
+o=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,o=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);h>f&&(o=2,f=h);switch(o){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};
|
|
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))};
|
|
-THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
|
|
|
+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,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,texture:m}},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 o=new THREE.Scene;o.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);k.width=b;k.height=f;m.width=b;m.height=f};this.render=
|
|
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 o=new THREE.Scene;o.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);k.width=b;k.height=f;m.width=b;m.height=f};this.render=
|
|
-function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);j.projectionMatrix=e.projectionMatrix;j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,j,m,!0);f.call(c,o,n)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
|
|
|
|
|
|
+function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);h.projectionMatrix=e.projectionMatrix;h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,h,m,!0);f.call(c,o,n)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
|