mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-27 05:45:57 +10:00
Work in progress, caveats: - sort happens just inside one ParticleSystems, so everything gets messed up when more ParticleSystems are in the same screen space - not yet solved proper order of operations, if you change object transform, you need to update ParticleSystem object matrix manually before rendering (so that sort works, otherwise it will use transform from previous frame) Also fixed transparency in fog and did small optimizations in WebGLRenderer.
213 lines
99 KiB
JavaScript
213 lines
99 KiB
JavaScript
// ThreeDebug.js r32 - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
|
|
THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,i,b,n,o,k;if(d==0)e=i=b=0;else{n=Math.floor(a*6);o=a*6-n;a=d*(1-c);k=d*(1-c*o);c=d*(1-c*(1-o));switch(n){case 1:e=k;i=d;b=a;break;case 2:e=a;i=d;b=c;break;case 3:e=a;i=k;b=d;break;case 4:e=c;i=a;b=d;break;case 5:e=d;i=a;b=k;break;case 6:case 0:e=d;i=c;b=a}}this.r=e;this.g=i;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
|
|
setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
|
|
THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
|
|
-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
|
|
THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,i=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(b,n){return b.distance-n.distance});return i},intersectObject:function(a){function c(K,s,T,F){F=F.clone().subSelf(s);T=T.clone().subSelf(s);var f=K.clone().subSelf(s);K=F.dot(F);s=F.dot(T);F=F.dot(f);var j=T.dot(T);T=T.dot(f);f=1/(K*j-s*s);j=(j*F-s*T)*f;K=(K*T-s*F)*f;return j>0&&K>0&&j+K<1}var d,e,i,b,n,o,k,l,z,y,
|
|
w,x=a.geometry,I=x.vertices,J=[];d=0;for(e=x.faces.length;d<e;d++){i=x.faces[d];y=this.origin.clone();w=this.direction.clone();b=a.matrix.multiplyVector3(I[i.a].position.clone());n=a.matrix.multiplyVector3(I[i.b].position.clone());o=a.matrix.multiplyVector3(I[i.c].position.clone());k=i instanceof THREE.Face4?a.matrix.multiplyVector3(I[i.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(i.normal.clone());z=w.dot(l);if(z<0){l=l.dot((new THREE.Vector3).sub(b,y))/z;y=y.addSelf(w.multiplyScalar(l));
|
|
if(i instanceof THREE.Face3){if(c(y,b,n,o)){i={distance:this.origin.distanceTo(y),point:y,face:i,object:a};J.push(i)}}else if(i instanceof THREE.Face4)if(c(y,b,n,k)||c(y,n,o,k)){i={distance:this.origin.distanceTo(y),point:y,face:i,object:a};J.push(i)}}}return J}};
|
|
THREE.Rectangle=function(){function a(){b=e-c;n=i-d}var c,d,e,i,b,n,o=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return i};this.set=function(k,l,z,y){o=false;c=k;d=l;e=z;i=y;a()};this.addPoint=function(k,l){if(o){o=false;c=k;d=l;e=k;i=l}else{c=c<k?c:k;d=d<l?d:l;e=e>k?e:k;i=i>l?
|
|
i:l}a()};this.add3Points=function(k,l,z,y,w,x){if(o){o=false;c=k<z?k<w?k:w:z<w?z:w;d=l<y?l<x?l:x:y<x?y:x;e=k>z?k>w?k:w:z>w?z:w;i=l>y?l>x?l:x:y>x?y:x}else{c=k<z?k<w?k<c?k:c:w<c?w:c:z<w?z<c?z:c:w<c?w:c;d=l<y?l<x?l<d?l:d:x<d?x:d:y<x?y<d?y:d:x<d?x:d;e=k>z?k>w?k>e?k:e:w>e?w:e:z>w?z>e?z:e:w>e?w:e;i=l>y?l>x?l>i?l:i:x>i?x:i:y>x?y>i?y:i:x>i?x:i}a()};this.addRectangle=function(k){if(o){o=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();d=d<k.getTop()?d:k.getTop();
|
|
e=e>k.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();i=i<k.getBottom()?i:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString=
|
|
function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
|
|
THREE.Matrix4=function(a,c,d,e,i,b,n,o,k,l,z,y,w,x,I,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=k||0;this.n32=l||0;this.n33=z||1;this.n34=y||0;this.n41=w||0;this.n42=x||0;this.n43=I||0;this.n44=J||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,i,b,n,o,k,l,z,y,w,x,I,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=k;this.n32=l;this.n33=z;this.n34=y;this.n41=w;this.n42=x;this.n43=I;this.n44=J;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
|
|
this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
|
|
e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,k=a.n23,l=a.n24,z=a.n31,
|
|
y=a.n32,w=a.n33,x=a.n34,I=a.n41,J=a.n42,K=a.n43,s=a.n44,T=c.n11,F=c.n12,f=c.n13,j=c.n14,g=c.n21,h=c.n22,m=c.n23,u=c.n24,p=c.n31,q=c.n32,r=c.n33,v=c.n34,t=c.n41,L=c.n42,D=c.n43,R=c.n44;this.n11=d*T+e*g+i*p+b*t;this.n12=d*F+e*h+i*q+b*L;this.n13=d*f+e*m+i*r+b*D;this.n14=d*j+e*u+i*v+b*R;this.n21=n*T+o*g+k*p+l*t;this.n22=n*F+o*h+k*q+l*L;this.n23=n*f+o*m+k*r+l*D;this.n24=n*j+o*u+k*v+l*R;this.n31=z*T+y*g+w*p+x*t;this.n32=z*F+y*h+w*q+x*L;this.n33=z*f+y*m+w*r+x*D;this.n34=z*j+y*u+w*v+x*R;this.n41=I*T+J*g+
|
|
K*p+s*t;this.n42=I*F+J*h+K*q+s*L;this.n43=I*f+J*m+K*r+s*D;this.n44=I*j+J*u+K*v+s*R;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,k=this.n24,l=this.n31,z=this.n32,y=this.n33,w=this.n34,x=this.n41,I=this.n42,J=this.n43,K=this.n44,s=a.n11,T=a.n21,F=a.n31,f=a.n41,j=a.n12,g=a.n22,h=a.n32,m=a.n42,u=a.n13,p=a.n23,q=a.n33,r=a.n43,v=a.n14,t=a.n24,L=a.n34;a=a.n44;this.n11=c*s+d*T+e*F+i*f;this.n12=c*j+d*g+e*h+i*m;this.n13=c*u+d*p+e*q+i*
|
|
r;this.n14=c*v+d*t+e*L+i*a;this.n21=b*s+n*T+o*F+k*f;this.n22=b*j+n*g+o*h+k*m;this.n23=b*u+n*p+o*q+k*r;this.n24=b*v+n*t+o*L+k*a;this.n31=l*s+z*T+y*F+w*f;this.n32=l*j+z*g+y*h+w*m;this.n33=l*u+z*p+y*q+w*r;this.n34=l*v+z*t+y*L+w*a;this.n41=x*s+I*T+J*F+K*f;this.n42=x*j+I*g+J*h+K*m;this.n43=x*u+I*p+J*q+K*r;this.n44=x*v+I*t+J*L+K*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=
|
|
a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,k=this.n31,l=this.n32,z=this.n33,y=this.n34,w=this.n41,x=this.n42,I=this.n43,J=this.n44;return e*n*l*w-d*o*l*w-e*b*z*w+c*o*z*w+d*b*y*w-c*n*y*w-e*n*k*x+d*o*k*x+e*i*z*x-a*o*z*x-d*i*y*x+a*n*y*x+e*b*k*I-c*o*k*I-e*i*l*I+a*o*l*I+c*i*y*I-a*b*y*I-d*b*k*J+c*n*k*J+d*i*l*J-a*n*l*J-c*i*z*J+a*b*z*J},transpose:function(){function a(c,d,
|
|
e){var i=c[d];c[d]=c[e];c[e]=i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;
|
|
a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
|
|
Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,k=i*b,l=i*n;this.set(k*b+d,k*n-e*o,k*o+e*n,0,k*n+e*o,l*n+d,l*o-e*b,0,k*o-e*n,l*o+e*b,i*o*o+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
|
|
this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
|
|
THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
|
|
THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,k=a.n24,l=a.n31,z=a.n32,y=a.n33,w=a.n34,x=a.n41,I=a.n42,J=a.n43,K=a.n44,s=new THREE.Matrix4;s.n11=o*w*I-k*y*I+k*z*J-n*w*J-o*z*K+n*y*K;s.n12=i*y*I-e*w*I-i*z*J+d*w*J+e*z*K-d*y*K;s.n13=e*k*I-i*o*I+i*n*J-d*k*J-e*n*K+d*o*K;s.n14=i*o*z-e*k*z-i*n*y+d*k*y+e*n*w-d*o*w;s.n21=k*y*x-o*w*x-k*l*J+b*w*J+o*l*K-b*y*K;s.n22=e*w*x-i*y*x+i*l*J-c*w*J-e*l*K+c*y*K;s.n23=i*o*x-e*k*x-i*b*J+c*k*J+e*b*K-c*o*K;s.n24=e*k*l-i*o*l+
|
|
i*b*y-c*k*y-e*b*w+c*o*w;s.n31=n*w*x-k*z*x+k*l*I-b*w*I-n*l*K+b*z*K;s.n32=i*z*x-d*w*x-i*l*I+c*w*I+d*l*K-c*z*K;s.n33=e*k*x-i*n*x+i*b*I-c*k*I-d*b*K+c*n*K;s.n34=i*n*l-d*k*l-i*b*z+c*k*z+d*b*w-c*n*w;s.n41=o*z*x-n*y*x-o*l*I+b*y*I+n*l*J-b*z*J;s.n42=d*y*x-e*z*x+e*l*I-c*y*I-d*l*J+c*z*J;s.n43=e*n*x-d*o*x-e*b*I+c*o*I+d*b*J-c*n*J;s.n44=d*o*l-e*n*l+e*b*z-c*o*z-d*b*y+c*n*y;s.multiplyScalar(1/a.determinant());return s};
|
|
THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],l=c[9]*c[4]-c[5]*c[8],z=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*k;d[6]=c*l;d[7]=c*z;d[8]=c*y;return a};
|
|
THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,k;n=new THREE.Matrix4;o=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=k;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)};
|
|
THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,k,l;n=new THREE.Matrix4;o=c-a;k=d-e;l=b-i;a=(c+a)/o;d=(d+e)/k;i=(b+i)/l;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/k;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/l;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
THREE.Face3=function(a,c,d,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,i,b,n,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(i=this.vertices.length;e<i;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];if(a&&b.vertexNormals.length){o.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)o.addSelf(b.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];n=this.vertices[b.c];o.sub(n.position,
|
|
d.position);k.sub(c.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();b.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
|
|
c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,t,L,D,R,O,H){b=v.vertices[t].position;n=v.vertices[L].position;o=v.vertices[D].position;k=i[R];l=i[O];z=i[H];y=n.x-b.x;w=o.x-b.x;x=n.y-b.y;I=o.y-b.y;
|
|
J=n.z-b.z;K=o.z-b.z;s=l.u-k.u;T=z.u-k.u;F=l.v-k.v;f=z.v-k.v;j=1/(s*f-T*F);m.set((f*y-F*w)*j,(f*x-F*I)*j,(f*J-F*K)*j);u.set((s*w-T*y)*j,(s*I-T*x)*j,(s*K-T*J)*j);g[t].addSelf(m);g[L].addSelf(m);g[D].addSelf(m);h[t].addSelf(u);h[L].addSelf(u);h[D].addSelf(u)}var c,d,e,i,b,n,o,k,l,z,y,w,x,I,J,K,s,T,F,f,j,g=[],h=[],m=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){g[c]=new THREE.Vector3;h[c]=new THREE.Vector3}c=0;
|
|
for(d=this.faces.length;c<d;c++){e=this.faces[c];i=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){r.copy(this.vertices[c].normal);e=g[c];p.copy(e);p.subSelf(r.multiplyScalar(r.dot(e))).normalize();q.cross(this.vertices[c].normal,e);e=q.dot(h[c]);e=e<0?-1:1;this.vertices[c].tangent.set(p.x,p.y,p.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(z){var y=[];c=0;for(d=z.length;c<d;c++)z[c]==undefined?y.push("undefined"):y.push(z[c].toString());return y.join("_")}var c,d,e,i,b,n,o,k,l={};e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];
|
|
n=b.materials;o=a(n);if(l[o]==undefined)l[o]={hash:o,counter:0};k=l[o].hash+"_"+l[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+b>65535){l[o].counter+=1;k=l[o].hash+"_"+l[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
|
|
THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
|
|
this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
|
|
THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
|
|
THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
|
|
THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0};
|
|
THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
|
|
THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;
|
|
THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
|
|
THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
|
|
THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==
|
|
undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==
|
|
undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
|
|
this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);
|
|
if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;
|
|
if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
|
|
this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.light_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=
|
|
1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
|
|
this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
|
|
THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
|
|
undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}};
|
|
THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter};
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
var Uniforms={clone:function(a){var c,d,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)i[d]=e[d]}return i}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
|
|
THREE.Projector=function(){function a(h,m){return m.z-h.z}function c(h,m){var u=0,p=1,q=h.z+h.w,r=m.z+m.w,v=-h.z+h.w,t=-m.z+m.w;if(q>=0&&r>=0&&v>=0&&t>=0)return true;else if(q<0&&r<0||v<0&&t<0)return false;else{if(q<0)u=Math.max(u,q/(q-r));else if(r<0)p=Math.min(p,q/(q-r));if(v<0)u=Math.max(u,v/(v-t));else if(t<0)p=Math.min(p,v/(v-t));if(p<u)return false;else{h.lerpSelf(m,u);m.lerpSelf(h,1-p);return true}}}var d,e,i=[],b,n,o,k=[],l,z,y=[],w,x,I=[],J=new THREE.Vector4,K=new THREE.Vector4,s=new THREE.Matrix4,
|
|
T=new THREE.Matrix4,F=[],f=new THREE.Vector4,j=new THREE.Vector4,g;this.projectObjects=function(h,m,u){var p=[],q,r;e=0;s.multiply(m.projectionMatrix,m.matrix);F[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);F[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);F[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);F[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);F[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
|
|
s.n33,s.n44-s.n34);F[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);m=0;for(q=F.length;m<q;m++){r=F[m];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}q=h.objects;h=0;for(m=q.length;h<m;h++){r=q[h];var v;if(!(v=!r.visible)){if(v=r instanceof THREE.Mesh){a:{v=void 0;for(var t=r.position,L=-r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)),D=0;D<6;D++){v=F[D].x*t.x+F[D].y*t.y+F[D].z*t.z+F[D].w;if(v<=L){v=false;break a}}v=true}v=!v}v=v}if(!v){d=
|
|
i[e]=i[e]||new THREE.RenderableObject;J.copy(r.position);s.multiplyVector3(J);d.object=r;d.z=J.z;p.push(d);e++}}u&&p.sort(a);return p};this.projectScene=function(h,m,u){var p=[],q=m.near,r=m.far,v,t,L,D,R,O,H,Q,X,G,C,V,U,B,M,N;o=z=x=0;m.autoUpdateMatrix&&m.updateMatrix();s.multiply(m.projectionMatrix,m.matrix);O=this.projectObjects(h,m,true);h=0;for(v=O.length;h<v;h++){H=O[h].object;if(H.visible){H.autoUpdateMatrix&&H.updateMatrix();Q=H.matrix;X=H.rotationMatrix;G=H.materials;C=H.overdraw;if(H instanceof
|
|
THREE.Mesh){V=H.geometry;U=V.vertices;t=0;for(L=U.length;t<L;t++){B=U[t];B.positionWorld.copy(B.position);Q.multiplyVector3(B.positionWorld);D=B.positionScreen;D.copy(B.positionWorld);s.multiplyVector4(D);D.x/=D.w;D.y/=D.w;B.__visible=D.z>q&&D.z<r}V=V.faces;t=0;for(L=V.length;t<L;t++){B=V[t];if(B instanceof THREE.Face3){D=U[B.a];R=U[B.b];M=U[B.c];if(D.__visible&&R.__visible&&M.__visible)if(H.doubleSided||H.flipSided!=(M.positionScreen.x-D.positionScreen.x)*(R.positionScreen.y-D.positionScreen.y)-
|
|
(M.positionScreen.y-D.positionScreen.y)*(R.positionScreen.x-D.positionScreen.x)<0){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(D.positionWorld);b.v2.positionWorld.copy(R.positionWorld);b.v3.positionWorld.copy(M.positionWorld);b.v1.positionScreen.copy(D.positionScreen);b.v2.positionScreen.copy(R.positionScreen);b.v3.positionScreen.copy(M.positionScreen);b.normalWorld.copy(B.normal);X.multiplyVector3(b.normalWorld);b.centroidWorld.copy(B.centroid);Q.multiplyVector3(b.centroidWorld);
|
|
b.centroidScreen.copy(b.centroidWorld);s.multiplyVector3(b.centroidScreen);M=B.vertexNormals;g=b.vertexNormalsWorld;D=0;for(R=M.length;D<R;D++){N=g[D]=g[D]||new THREE.Vector3;N.copy(M[D]);X.multiplyVector3(N)}b.z=b.centroidScreen.z;b.meshMaterials=G;b.faceMaterials=B.materials;b.overdraw=C;if(H.geometry.uvs[t]){b.uvs[0]=H.geometry.uvs[t][0];b.uvs[1]=H.geometry.uvs[t][1];b.uvs[2]=H.geometry.uvs[t][2]}p.push(b);o++}}else if(B instanceof THREE.Face4){D=U[B.a];R=U[B.b];M=U[B.c];N=U[B.d];if(D.__visible&&
|
|
R.__visible&&M.__visible&&N.__visible)if(H.doubleSided||H.flipSided!=((N.positionScreen.x-D.positionScreen.x)*(R.positionScreen.y-D.positionScreen.y)-(N.positionScreen.y-D.positionScreen.y)*(R.positionScreen.x-D.positionScreen.x)<0||(R.positionScreen.x-M.positionScreen.x)*(N.positionScreen.y-M.positionScreen.y)-(R.positionScreen.y-M.positionScreen.y)*(N.positionScreen.x-M.positionScreen.x)<0)){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(D.positionWorld);b.v2.positionWorld.copy(R.positionWorld);
|
|
b.v3.positionWorld.copy(N.positionWorld);b.v1.positionScreen.copy(D.positionScreen);b.v2.positionScreen.copy(R.positionScreen);b.v3.positionScreen.copy(N.positionScreen);b.normalWorld.copy(B.normal);X.multiplyVector3(b.normalWorld);b.centroidWorld.copy(B.centroid);Q.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);s.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=G;b.faceMaterials=B.materials;b.overdraw=C;if(H.geometry.uvs[t]){b.uvs[0]=H.geometry.uvs[t][0];
|
|
b.uvs[1]=H.geometry.uvs[t][1];b.uvs[2]=H.geometry.uvs[t][3]}p.push(b);o++;n=k[o]=k[o]||new THREE.RenderableFace3;n.v1.positionWorld.copy(R.positionWorld);n.v2.positionWorld.copy(M.positionWorld);n.v3.positionWorld.copy(N.positionWorld);n.v1.positionScreen.copy(R.positionScreen);n.v2.positionScreen.copy(M.positionScreen);n.v3.positionScreen.copy(N.positionScreen);n.normalWorld.copy(b.normalWorld);n.centroidWorld.copy(b.centroidWorld);n.centroidScreen.copy(b.centroidScreen);n.z=n.centroidScreen.z;n.meshMaterials=
|
|
G;n.faceMaterials=B.materials;n.overdraw=C;if(H.geometry.uvs[t]){n.uvs[0]=H.geometry.uvs[t][1];n.uvs[1]=H.geometry.uvs[t][2];n.uvs[2]=H.geometry.uvs[t][3]}p.push(n);o++}}}}else if(H instanceof THREE.Line){T.multiply(s,Q);U=H.geometry.vertices;B=U[0];B.positionScreen.copy(B.position);T.multiplyVector4(B.positionScreen);t=1;for(L=U.length;t<L;t++){D=U[t];D.positionScreen.copy(D.position);T.multiplyVector4(D.positionScreen);R=U[t-1];f.copy(D.positionScreen);j.copy(R.positionScreen);if(c(f,j)){f.multiplyScalar(1/
|
|
f.w);j.multiplyScalar(1/j.w);l=y[z]=y[z]||new THREE.RenderableLine;l.v1.positionScreen.copy(f);l.v2.positionScreen.copy(j);l.z=Math.max(f.z,j.z);l.materials=H.materials;p.push(l);z++}}}else if(H instanceof THREE.Particle){K.set(H.position.x,H.position.y,H.position.z,1);s.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){w=I[x]=I[x]||new THREE.RenderableParticle;w.x=K.x/K.w;w.y=K.y/K.w;w.z=K.z;w.rotation=H.rotation.z;w.scale.x=H.scale.x*Math.abs(w.x-(K.x+m.projectionMatrix.n11)/(K.w+m.projectionMatrix.n14));
|
|
w.scale.y=H.scale.y*Math.abs(w.y-(K.y+m.projectionMatrix.n22)/(K.w+m.projectionMatrix.n24));w.materials=H.materials;p.push(w);x++}}}}u&&p.sort(a);return p};this.unprojectVector=function(h,m){var u=THREE.Matrix4.makeInvert(m.matrix);u.multiplySelf(THREE.Matrix4.makeInvert(m.projectionMatrix));u.multiplyVector3(h);return h}};
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var k,l,z,y,w,x,I,J;a=c.projectScene(n,o);k=0;for(l=a.length;k<l;k++){w=a[k];if(w instanceof THREE.RenderableParticle){I=w.x*i+i;J=w.y*b+b;z=0;for(y=w.material.length;z<y;z++){x=w.material[z];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=I+"px";x.style.top=J+"px"}}}}}};
|
|
THREE.CanvasRenderer=function(){function a(da){if(w!=da)l.globalAlpha=w=da}function c(da){if(x!=da){switch(da){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}x=da}}var d=null,e=new THREE.Projector,i=document.createElement("canvas"),b,n,o,k,l=i.getContext("2d"),z=new THREE.Color(0),y=0,w=1,x=0,I=null,J=null,K=1,s,T,F,f,j,g,h,m,u,p=new THREE.Color,
|
|
q=new THREE.Color,r=new THREE.Color,v=new THREE.Color,t=new THREE.Color,L,D,R,O,H,Q,X,G,C,V=new THREE.Rectangle,U=new THREE.Rectangle,B=new THREE.Rectangle,M=false,N=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,la=new THREE.Color,ua=Math.PI*2,Y=new THREE.Vector3,Z,ia,fa,ja,ma,ga,qa=16;Z=document.createElement("canvas");Z.width=Z.height=2;ia=Z.getContext("2d");ia.fillStyle="rgba(0,0,0,1)";ia.fillRect(0,0,2,2);fa=ia.getImageData(0,0,2,2);ja=fa.data;ma=document.createElement("canvas");ma.width=
|
|
ma.height=qa;ga=ma.getContext("2d");ga.translate(-qa/2,-qa/2);ga.scale(qa,qa);qa--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,oa){b=da;n=oa;o=b/2;k=n/2;i.width=b;i.height=n;V.set(-o,-k,o,k);w=1;x=0;J=I=null;K=1};this.setClearColor=function(da,oa){z.setHex(da);y=oa;U.set(-o,-k,o,k);l.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){l.setTransform(1,0,0,-1,o,k);if(!U.isEmpty()){U.inflate(1);U.minSelf(V);if(z.hex==0&&y==0)l.clearRect(U.getX(),
|
|
U.getY(),U.getWidth(),U.getHeight());else{c(THREE.NormalBlending);a(1);l.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+y+")";l.fillRect(U.getX(),U.getY(),U.getWidth(),U.getHeight())}U.empty()}};this.render=function(da,oa){function Ea(A){var W,S,E,P=A.lights;aa.setRGB(0,0,0);ba.setRGB(0,0,0);la.setRGB(0,0,0);A=0;for(W=P.length;A<W;A++){S=P[A];E=S.color;if(S instanceof THREE.AmbientLight){aa.r+=E.r;aa.g+=E.g;aa.b+=E.b}else if(S instanceof THREE.DirectionalLight){ba.r+=
|
|
E.r;ba.g+=E.g;ba.b+=E.b}else if(S instanceof THREE.PointLight){la.r+=E.r;la.g+=E.g;la.b+=E.b}}}function Aa(A,W,S,E){var P,$,ea,ha,ka=A.lights;A=0;for(P=ka.length;A<P;A++){$=ka[A];ea=$.color;ha=$.intensity;if($ instanceof THREE.DirectionalLight){$=S.dot($.position)*ha;if($>0){E.r+=ea.r*$;E.g+=ea.g*$;E.b+=ea.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,W);Y.normalize();$=S.dot(Y)*ha;if($>0){E.r+=ea.r*$;E.g+=ea.g*$;E.b+=ea.b*$}}}}function Na(A,W,S){if(S.opacity!=0){a(S.opacity);c(S.blending);
|
|
var E,P,$,ea,ha,ka;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){ea=S.map.image;ha=ea.width>>1;ka=ea.height>>1;P=W.scale.x*o;$=W.scale.y*k;S=P*ha;E=$*ka;B.set(A.x-S,A.y-E,A.x+S,A.y+E);if(!V.instersects(B))return;l.save();l.translate(A.x,A.y);l.rotate(-W.rotation);l.scale(P,-$);l.translate(-ha,-ka);l.drawImage(ea,0,0);l.restore()}l.beginPath();l.moveTo(A.x-10,A.y);l.lineTo(A.x+10,A.y);l.moveTo(A.x,A.y-10);l.lineTo(A.x,A.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";
|
|
l.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(M){N.r=aa.r+ba.r+la.r;N.g=aa.g+ba.g+la.g;N.b=aa.b+ba.b+la.b;p.r=S.color.r*N.r;p.g=S.color.g*N.g;p.b=S.color.b*N.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;S=W.scale.x*o;E=W.scale.y*k;B.set(A.x-S,A.y-E,A.x+S,A.y+E);if(V.instersects(B)){P=p.__styleString;if(J!=P)l.fillStyle=J=P;l.save();l.translate(A.x,A.y);l.rotate(-W.rotation);l.scale(S,E);l.beginPath();l.arc(0,0,1,0,ua,true);l.closePath();l.fill();l.restore()}}}}
|
|
function Oa(A,W,S,E){if(E.opacity!=0){a(E.opacity);c(E.blending);l.beginPath();l.moveTo(A.positionScreen.x,A.positionScreen.y);l.lineTo(W.positionScreen.x,W.positionScreen.y);l.closePath();if(E instanceof THREE.LineBasicMaterial){p.__styleString=E.color.__styleString;A=E.linewidth;if(K!=A)l.lineWidth=K=A;A=p.__styleString;if(I!=A)l.strokeStyle=I=A;l.stroke();B.inflate(E.linewidth*2)}}}function Ja(A,W,S,E,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;j=A.positionScreen.y;g=
|
|
W.positionScreen.x;h=W.positionScreen.y;m=S.positionScreen.x;u=S.positionScreen.y;l.beginPath();l.moveTo(f,j);l.lineTo(g,h);l.lineTo(m,u);l.lineTo(f,j);l.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&xa(f,j,g,h,m,u,P.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=oa.matrix;Y.copy(E.vertexNormalsWorld[0]);
|
|
O=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;H=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(E.vertexNormalsWorld[1]);Q=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;X=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(E.vertexNormalsWorld[2]);G=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;C=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;xa(f,j,g,h,m,u,P.env_map.image,O,H,Q,X,G,C)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&
|
|
!P.wireframe){P.map.mapping instanceof THREE.UVMapping&&xa(f,j,g,h,m,u,P.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);c(THREE.SubtractiveBlending)}if(M)if(!P.wireframe&&P.shading==THREE.SmoothShading&&E.vertexNormalsWorld.length==3){q.r=r.r=v.r=aa.r;q.g=r.g=v.g=aa.g;q.b=r.b=v.b=aa.b;Aa($,E.v1.positionWorld,E.vertexNormalsWorld[0],q);Aa($,E.v2.positionWorld,E.vertexNormalsWorld[1],r);Aa($,E.v3.positionWorld,E.vertexNormalsWorld[2],v);t.r=(r.r+v.r)*0.5;t.g=(r.g+v.g)*
|
|
0.5;t.b=(r.b+v.b)*0.5;R=Ka(q,r,v,t);xa(f,j,g,h,m,u,R,0,0,1,0,0,1)}else{N.r=aa.r;N.g=aa.g;N.b=aa.b;Aa($,E.centroidWorld,E.normalWorld,N);p.r=P.color.r*N.r;p.g=P.color.g*N.g;p.b=P.color.b*N.b;p.updateStyleString();P.wireframe?Ba(p.__styleString,P.wireframe_linewidth):Ca(p.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){L=oa.near;D=oa.far;q.r=q.g=q.b=1-Fa(A.positionScreen.z,L,D);r.r=r.g=r.b=1-Fa(W.positionScreen.z,
|
|
L,D);v.r=v.g=v.b=1-Fa(S.positionScreen.z,L,D);t.r=(r.r+v.r)*0.5;t.g=(r.g+v.g)*0.5;t.b=(r.b+v.b)*0.5;R=Ka(q,r,v,t);xa(f,j,g,h,m,u,R,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){p.r=Ga(E.normalWorld.x);p.g=Ga(E.normalWorld.y);p.b=Ga(E.normalWorld.z);p.updateStyleString();P.wireframe?Ba(p.__styleString,P.wireframe_linewidth):Ca(p.__styleString)}}}function Ba(A,W){if(I!=A)l.strokeStyle=I=A;if(K!=W)l.lineWidth=K=W;l.stroke();B.inflate(W*2)}function Ca(A){if(J!=A)l.fillStyle=J=A;l.fill()}
|
|
function xa(A,W,S,E,P,$,ea,ha,ka,ra,na,sa,ya){var va,ta;va=ea.width-1;ta=ea.height-1;ha*=va;ka*=ta;ra*=va;na*=ta;sa*=va;ya*=ta;S-=A;E-=W;P-=A;$-=W;ra-=ha;na-=ka;sa-=ha;ya-=ka;ta=1/(ra*ya-sa*na);va=(ya*S-na*P)*ta;na=(ya*E-na*$)*ta;S=(ra*P-sa*S)*ta;E=(ra*$-sa*E)*ta;A=A-va*ha-S*ka;W=W-na*ha-E*ka;l.save();l.transform(va,na,S,E,A,W);l.clip();l.drawImage(ea,0,0);l.restore()}function Ka(A,W,S,E){var P=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var ea=~~(W.r*255),ha=~~(W.g*255);W=~~(W.b*255);var ka=~~(S.r*255),
|
|
ra=~~(S.g*255);S=~~(S.b*255);var na=~~(E.r*255),sa=~~(E.g*255);E=~~(E.b*255);ja[0]=P<0?0:P>255?255:P;ja[1]=$<0?0:$>255?255:$;ja[2]=A<0?0:A>255?255:A;ja[4]=ea<0?0:ea>255?255:ea;ja[5]=ha<0?0:ha>255?255:ha;ja[6]=W<0?0:W>255?255:W;ja[8]=ka<0?0:ka>255?255:ka;ja[9]=ra<0?0:ra>255?255:ra;ja[10]=S<0?0:S>255?255:S;ja[12]=na<0?0:na>255?255:na;ja[13]=sa<0?0:sa>255?255:sa;ja[14]=E<0?0:E>255?255:E;ia.putImageData(fa,0,0);ga.drawImage(Z,0,0);return ma}function Fa(A,W,S){A=(A-W)/(S-W);return A*A*(3-2*A)}function Ga(A){A=
|
|
(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,W){var S=W.x-A.x,E=W.y-A.y,P=1/Math.sqrt(S*S+E*E);S*=P;E*=P;W.x+=S;W.y+=E;A.x-=S;A.y-=E}var Da,La,ca,pa,wa,Ia,Ma,za;this.autoClear?this.clear():l.setTransform(1,0,0,-1,o,k);d=e.projectScene(da,oa,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(V.getX(),V.getY(),V.getWidth(),V.getHeight());(M=da.lights.length>0)&&Ea(da);Da=0;for(La=d.length;Da<La;Da++){ca=d[Da];B.empty();if(ca instanceof THREE.RenderableParticle){s=ca;s.x*=o;s.y*=k;
|
|
pa=0;for(wa=ca.materials.length;pa<wa;pa++)Na(s,ca,ca.materials[pa],da)}else if(ca instanceof THREE.RenderableLine){s=ca.v1;T=ca.v2;s.positionScreen.x*=o;s.positionScreen.y*=k;T.positionScreen.x*=o;T.positionScreen.y*=k;B.addPoint(s.positionScreen.x,s.positionScreen.y);B.addPoint(T.positionScreen.x,T.positionScreen.y);if(V.instersects(B)){pa=0;for(wa=ca.materials.length;pa<wa;)Oa(s,T,ca,ca.materials[pa++],da)}}else if(ca instanceof THREE.RenderableFace3){s=ca.v1;T=ca.v2;F=ca.v3;s.positionScreen.x*=
|
|
o;s.positionScreen.y*=k;T.positionScreen.x*=o;T.positionScreen.y*=k;F.positionScreen.x*=o;F.positionScreen.y*=k;if(ca.overdraw){Ha(s.positionScreen,T.positionScreen);Ha(T.positionScreen,F.positionScreen);Ha(F.positionScreen,s.positionScreen)}B.add3Points(s.positionScreen.x,s.positionScreen.y,T.positionScreen.x,T.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if(V.instersects(B)){pa=0;for(wa=ca.meshMaterials.length;pa<wa;){za=ca.meshMaterials[pa++];if(za instanceof THREE.MeshFaceMaterial){Ia=
|
|
0;for(Ma=ca.faceMaterials.length;Ia<Ma;)(za=ca.faceMaterials[Ia++])&&Ja(s,T,F,ca,za,da)}else Ja(s,T,F,ca,za,da)}}}U.addRectangle(B)}l.lineWidth=1;l.strokeStyle="rgba( 255, 0, 0, 0.5 )";l.strokeRect(U.getX(),U.getY(),U.getWidth(),U.getHeight());l.setTransform(1,0,0,1,0,0)}};
|
|
THREE.SVGRenderer=function(){function a(O,H,Q){var X,G,C,V;X=0;for(G=O.lights.length;X<G;X++){C=O.lights[X];if(C instanceof THREE.DirectionalLight){V=H.normalWorld.dot(C.position)*C.intensity;if(V>0){Q.r+=C.color.r*V;Q.g+=C.color.g*V;Q.b+=C.color.b*V}}else if(C instanceof THREE.PointLight){u.sub(C.position,H.centroidWorld);u.normalize();V=H.normalWorld.dot(u)*C.intensity;if(V>0){Q.r+=C.color.r*V;Q.g+=C.color.g*V;Q.b+=C.color.b*V}}}}function c(O,H,Q,X,G,C){v=e(t++);v.setAttribute("d","M "+O.positionScreen.x+
|
|
" "+O.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)F.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(C,X,f);F.r=G.color.r*f.r;F.g=G.color.g*f.g;F.b=G.color.b*f.b;F.updateStyleString()}else F.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){m=1-G.__2near/(G.__farPlusNear-X.z*G.__farMinusNear);
|
|
F.setRGB(m,m,m)}else G instanceof THREE.MeshNormalMaterial&&F.setRGB(i(X.normalWorld.x),i(X.normalWorld.y),i(X.normalWorld.z));G.wireframe?v.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.wireframe_linecap+"; stroke-linejoin: "+G.wireframe_linejoin):v.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+G.opacity);o.appendChild(v)}function d(O,H,Q,X,G,C,V){v=e(t++);v.setAttribute("d",
|
|
"M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)F.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(V,G,f);F.r=C.color.r*f.r;F.g=C.color.g*f.g;F.b=C.color.b*f.b;F.updateStyleString()}else F.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){m=
|
|
1-C.__2near/(C.__farPlusNear-G.z*C.__farMinusNear);F.setRGB(m,m,m)}else C instanceof THREE.MeshNormalMaterial&&F.setRGB(i(G.normalWorld.x),i(G.normalWorld.y),i(G.normalWorld.z));C.wireframe?v.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):v.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+C.opacity);o.appendChild(v)}
|
|
function e(O){if(p[O]==null){p[O]=document.createElementNS("http://www.w3.org/2000/svg","path");R==0&&p[O].setAttribute("shape-rendering","crispEdges");return p[O]}return p[O]}function i(O){return O<0?Math.min((1+O)*0.5,0.5):0.5+Math.min(O*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,z,y,w,x,I,J,K=new THREE.Rectangle,s=new THREE.Rectangle,T=false,F=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),g=new THREE.Color(0),
|
|
h=new THREE.Color(0),m,u=new THREE.Vector3,p=[],q=[],r=[],v,t,L,D,R=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(O){switch(O){case "high":R=1;break;case "low":R=0}};this.setSize=function(O,H){k=O;l=H;z=k/2;y=l/2;o.setAttribute("viewBox",-z+" "+-y+" "+k+" "+l);o.setAttribute("width",k);o.setAttribute("height",l);K.set(-z,-y,z,y)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(O,H){var Q,X,
|
|
G,C,V,U,B,M;this.autoClear&&this.clear();b=n.projectScene(O,H,this.sortElements);D=L=t=0;if(T=O.lights.length>0){B=O.lights;j.setRGB(0,0,0);g.setRGB(0,0,0);h.setRGB(0,0,0);Q=0;for(X=B.length;Q<X;Q++){G=B[Q];C=G.color;if(G instanceof THREE.AmbientLight){j.r+=C.r;j.g+=C.g;j.b+=C.b}else if(G instanceof THREE.DirectionalLight){g.r+=C.r;g.g+=C.g;g.b+=C.b}else if(G instanceof THREE.PointLight){h.r+=C.r;h.g+=C.g;h.b+=C.b}}}Q=0;for(X=b.length;Q<X;Q++){B=b[Q];s.empty();if(B instanceof THREE.RenderableParticle){w=
|
|
B;w.x*=z;w.y*=-y;G=0;for(C=B.materials.length;G<C;G++)if(M=B.materials[G]){V=w;U=B;M=M;var N=L++;if(q[N]==null){q[N]=document.createElementNS("http://www.w3.org/2000/svg","circle");R==0&&q[N].setAttribute("shape-rendering","crispEdges")}v=q[N];v.setAttribute("cx",V.x);v.setAttribute("cy",V.y);v.setAttribute("r",U.scale.x*z);if(M instanceof THREE.ParticleCircleMaterial){if(T){f.r=j.r+g.r+h.r;f.g=j.g+g.g+h.g;f.b=j.b+g.b+h.b;F.r=M.color.r*f.r;F.g=M.color.g*f.g;F.b=M.color.b*f.b;F.updateStyleString()}else F=
|
|
M.color;v.setAttribute("style","fill: "+F.__styleString)}o.appendChild(v)}}else if(B instanceof THREE.RenderableLine){w=B.v1;x=B.v2;w.positionScreen.x*=z;w.positionScreen.y*=-y;x.positionScreen.x*=z;x.positionScreen.y*=-y;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(x.positionScreen.x,x.positionScreen.y);if(K.instersects(s)){G=0;for(C=B.materials.length;G<C;)if(M=B.materials[G++]){V=w;U=x;M=M;N=D++;if(r[N]==null){r[N]=document.createElementNS("http://www.w3.org/2000/svg","line");R==
|
|
0&&r[N].setAttribute("shape-rendering","crispEdges")}v=r[N];v.setAttribute("x1",V.positionScreen.x);v.setAttribute("y1",V.positionScreen.y);v.setAttribute("x2",U.positionScreen.x);v.setAttribute("y2",U.positionScreen.y);if(M instanceof THREE.LineBasicMaterial){F.__styleString=M.color.__styleString;v.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin);o.appendChild(v)}}}}else if(B instanceof
|
|
THREE.RenderableFace3){w=B.v1;x=B.v2;I=B.v3;w.positionScreen.x*=z;w.positionScreen.y*=-y;x.positionScreen.x*=z;x.positionScreen.y*=-y;I.positionScreen.x*=z;I.positionScreen.y*=-y;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(x.positionScreen.x,x.positionScreen.y);s.addPoint(I.positionScreen.x,I.positionScreen.y);if(K.instersects(s)){G=0;for(C=B.meshMaterials.length;G<C;){M=B.meshMaterials[G++];if(M instanceof THREE.MeshFaceMaterial){V=0;for(U=B.faceMaterials.length;V<U;)(M=B.faceMaterials[V++])&&
|
|
c(w,x,I,B,M,O)}else M&&c(w,x,I,B,M,O)}}}else if(B instanceof THREE.RenderableFace4){w=B.v1;x=B.v2;I=B.v3;J=B.v4;w.positionScreen.x*=z;w.positionScreen.y*=-y;x.positionScreen.x*=z;x.positionScreen.y*=-y;I.positionScreen.x*=z;I.positionScreen.y*=-y;J.positionScreen.x*=z;J.positionScreen.y*=-y;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(x.positionScreen.x,x.positionScreen.y);s.addPoint(I.positionScreen.x,I.positionScreen.y);s.addPoint(J.positionScreen.x,J.positionScreen.y);if(K.instersects(s)){G=
|
|
0;for(C=B.meshMaterials.length;G<C;){M=B.meshMaterials[G++];if(M instanceof THREE.MeshFaceMaterial){V=0;for(U=B.faceMaterials.length;V<U;)(M=B.faceMaterials[V++])&&d(w,x,I,J,B,M,O)}else M&&d(w,x,I,J,B,M,O)}}}}}};
|
|
THREE.WebGLRenderer=function(a){function c(f,j){f.fragment_shader=j.fragment_shader;f.vertex_shader=j.vertex_shader;f.uniforms=Uniforms.clone(j.uniforms)}function d(f,j){var g;if(f=="fragment")g=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")g=b.createShader(b.VERTEX_SHADER);b.shaderSource(g,j);b.compileShader(g);if(!b.getShaderParameter(g,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(g));return null}return g}function e(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;
|
|
case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;
|
|
case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var i=document.createElement("canvas"),b,n=null,o=null,k=new THREE.Matrix4,l,z=new Float32Array(16),y=new Float32Array(16),
|
|
w=new Float32Array(16),x=new Float32Array(9),I=new Float32Array(16),J=new THREE.Matrix4,K=new THREE.Vector4,s=true,T=new THREE.Color(0),F=0;if(a){if(a.antialias!==undefined)s=a.antialias;a.clearColor!==undefined&&T.setHex(a.clearColor);if(a.clearAlpha!==undefined)F=a.clearAlpha}this.domElement=i;this.autoClear=true;(function(f,j,g){try{b=i.getContext("experimental-webgl",{antialias:f})}catch(h){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);
|
|
b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,g)})(s,T,F);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){i.width=f;i.height=j;b.viewport(0,0,i.width,i.height)};this.setClearColor=function(f,j){var g=new THREE.Color(f);b.clearColor(g.r,g.g,g.b,j)};
|
|
this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(f,j){var g,h,m,u=0,p=0,q=0,r,v,t,L=this.lights,D=L.directional.colors,R=L.directional.positions,O=L.point.colors,H=L.point.positions,Q=0,X=0;g=0;for(h=j.length;g<h;g++){m=j[g];r=m.color;v=m.position;t=m.intensity;if(m instanceof THREE.AmbientLight){u+=r.r;p+=r.g;q+=r.b}else if(m instanceof THREE.DirectionalLight){D[Q*3]=r.r*t;D[Q*3+1]=r.g*t;D[Q*3+2]=r.b*t;R[Q*3]=v.x;R[Q*3+1]=v.y;R[Q*3+2]=v.z;Q+=1}else if(m instanceof
|
|
THREE.PointLight){O[X*3]=r.r*t;O[X*3+1]=r.g*t;O[X*3+2]=r.b*t;H[X*3]=v.x;H[X*3+1]=v.y;H[X*3+2]=v.z;X+=1}}L.point.length=X;L.directional.length=Q;L.ambient[0]=u;L.ambient[1]=p;L.ambient[2]=q};this.createParticleBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLParticleBuffer=b.createBuffer()};this.createLineBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLNormalBuffer=
|
|
b.createBuffer();f.__webGLTangentBuffer=b.createBuffer();f.__webGLUVBuffer=b.createBuffer();f.__webGLUV2Buffer=b.createBuffer();f.__webGLFaceBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(f){var j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__lineArray=new Uint16Array(j);f.__webGLLineCount=j};this.initParticleBuffers=function(f){var j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__particleArray=new Uint16Array(j);f.__sortArray=
|
|
[];f.__webGLParticleCount=j};this.initMeshBuffers=function(f,j){var g,h,m=0,u=0,p=0,q=j.geometry.faces,r=f.faces;g=0;for(h=r.length;g<h;g++){fi=r[g];face=q[fi];if(face instanceof THREE.Face3){m+=3;u+=1;p+=3}else if(face instanceof THREE.Face4){m+=4;u+=2;p+=4}}f.__vertexArray=new Float32Array(m*3);f.__normalArray=new Float32Array(m*3);f.__tangentArray=new Float32Array(m*4);f.__uvArray=new Float32Array(m*2);f.__uv2Array=new Float32Array(m*2);f.__faceArray=new Uint16Array(u*3);f.__lineArray=new Uint16Array(p*
|
|
2);m=false;g=0;for(h=j.materials.length;g<h;g++){q=j.materials[g];if(q instanceof THREE.MeshFaceMaterial){q=0;for(r=f.materials.length;q<r;q++)if(f.materials[q]&&f.materials[q].shading!=undefined&&f.materials[q].shading==THREE.SmoothShading){m=true;break}}else if(q&&q.shading!=undefined&&q.shading==THREE.SmoothShading){m=true;break}if(m)break}f.__needsSmoothNormals=m;f.__webGLFaceCount=u*3;f.__webGLLineCount=p*2};this.setMeshBuffers=function(f,j,g,h,m,u,p,q){var r,v,t,L,D,R,O,H,Q,X,G=0,C=0,V=0,U=
|
|
0,B=0,M=0,N=0,aa=0,ba=f.__vertexArray,la=f.__uvArray,ua=f.__uv2Array,Y=f.__normalArray,Z=f.__tangentArray,ia=f.__faceArray,fa=f.__lineArray,ja=f.__needsSmoothNormals,ma=j.geometry,ga=ma.vertices,qa=f.faces,da=ma.faces,oa=ma.uvs,Ea=ma.uvs2;j=0;for(r=qa.length;j<r;j++){v=qa[j];t=da[v];R=oa[v];v=Ea[v];L=t.vertexNormals;D=t.normal;if(t instanceof THREE.Face3){if(h){O=ga[t.a].position;H=ga[t.b].position;Q=ga[t.c].position;ba[C]=O.x;ba[C+1]=O.y;ba[C+2]=O.z;ba[C+3]=H.x;ba[C+4]=H.y;ba[C+5]=H.z;ba[C+6]=Q.x;
|
|
ba[C+7]=Q.y;ba[C+8]=Q.z;C+=9}if(q&&ma.hasTangents){O=ga[t.a].tangent;H=ga[t.b].tangent;Q=ga[t.c].tangent;Z[N]=O.x;Z[N+1]=O.y;Z[N+2]=O.z;Z[N+3]=O.w;Z[N+4]=H.x;Z[N+5]=H.y;Z[N+6]=H.z;Z[N+7]=H.w;Z[N+8]=Q.x;Z[N+9]=Q.y;Z[N+10]=Q.z;Z[N+11]=Q.w;N+=12}if(p)if(L.length==3&&ja)for(t=0;t<3;t++){D=L[t];Y[M]=D.x;Y[M+1]=D.y;Y[M+2]=D.z;M+=3}else for(t=0;t<3;t++){Y[M]=D.x;Y[M+1]=D.y;Y[M+2]=D.z;M+=3}if(u&&R)for(t=0;t<3;t++){L=R[t];la[V]=L.u;la[V+1]=L.v;V+=2}if(u&&v)for(t=0;t<3;t++){R=v[t];ua[U]=R.u;ua[U+1]=R.v;U+=
|
|
2}if(m){ia[B]=G;ia[B+1]=G+1;ia[B+2]=G+2;B+=3;fa[aa]=G;fa[aa+1]=G+1;fa[aa+2]=G;fa[aa+3]=G+2;fa[aa+4]=G+1;fa[aa+5]=G+2;aa+=6;G+=3}}else if(t instanceof THREE.Face4){if(h){O=ga[t.a].position;H=ga[t.b].position;Q=ga[t.c].position;X=ga[t.d].position;ba[C]=O.x;ba[C+1]=O.y;ba[C+2]=O.z;ba[C+3]=H.x;ba[C+4]=H.y;ba[C+5]=H.z;ba[C+6]=Q.x;ba[C+7]=Q.y;ba[C+8]=Q.z;ba[C+9]=X.x;ba[C+10]=X.y;ba[C+11]=X.z;C+=12}if(q&&ma.hasTangents){O=ga[t.a].tangent;H=ga[t.b].tangent;Q=ga[t.c].tangent;t=ga[t.d].tangent;Z[N]=O.x;Z[N+
|
|
1]=O.y;Z[N+2]=O.z;Z[N+3]=O.w;Z[N+4]=H.x;Z[N+5]=H.y;Z[N+6]=H.z;Z[N+7]=H.w;Z[N+8]=Q.x;Z[N+9]=Q.y;Z[N+10]=Q.z;Z[N+11]=Q.w;Z[N+12]=t.x;Z[N+13]=t.y;Z[N+14]=t.z;Z[N+15]=t.w;N+=16}if(p)if(L.length==4&&ja)for(t=0;t<4;t++){D=L[t];Y[M]=D.x;Y[M+1]=D.y;Y[M+2]=D.z;M+=3}else for(t=0;t<4;t++){Y[M]=D.x;Y[M+1]=D.y;Y[M+2]=D.z;M+=3}if(u&&R)for(t=0;t<4;t++){L=R[t];la[V]=L.u;la[V+1]=L.v;V+=2}if(u&&v)for(t=0;t<4;t++){R=v[t];ua[U]=R.u;ua[U+1]=R.v;U+=2}if(m){ia[B]=G;ia[B+1]=G+1;ia[B+2]=G+2;ia[B+3]=G;ia[B+4]=G+2;ia[B+5]=
|
|
G+3;B+=6;fa[aa]=G;fa[aa+1]=G+1;fa[aa+2]=G;fa[aa+3]=G+3;fa[aa+4]=G+1;fa[aa+5]=G+2;fa[aa+6]=G+2;fa[aa+7]=G+3;aa+=8;G+=4}}}if(h){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ba,g)}if(p){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,Y,g)}if(q&&ma.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,g)}if(u&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,la,g)}if(u&&
|
|
U>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,ua,g)}if(m){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ia,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,g)}};this.setLineBuffers=function(f,j,g,h){var m,u,p=f.vertices,q=p.length,r=f.__vertexArray,v=f.__lineArray;if(g)for(g=0;g<q;g++){m=p[g].position;u=g*3;r[u]=m.x;r[u+1]=m.y;r[u+2]=m.z}if(h)for(g=0;g<q;g++)v[g]=g;b.bindBuffer(b.ARRAY_BUFFER,
|
|
f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,r,j);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,v,j)};this.setParticleBuffers=function(f,j,g,h,m,u){var p=f.vertices,q=p.length,r=f.__vertexArray,v=f.__particleArray,t=f.__sortArray;if(m.sortParticles){J.multiply(u.projectionMatrix,u.matrix);J.multiplySelf(m.matrix);for(g=0;g<q;g++){m=p[g].position;K.copy(m);J.multiplyVector3(K);t[g]=[K.z,g]}t.sort(function(L,D){return D[0]-L[0]});for(g=0;g<q;g++){m=
|
|
p[t[g][1]].position;u=g*3;r[u]=m.x;r[u+1]=m.y;r[u+2]=m.z}}else if(g)for(g=0;g<q;g++){m=p[g].position;u=g*3;r[u]=m.x;r[u+1]=m.y;r[u+2]=m.z}if(h)for(g=0;g<q;g++)v[g]=g;b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,r,j);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLParticleBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,v,j)};this.initMaterial=function(f,j,g){if(!f.program){var h,m;if(f instanceof THREE.MeshDepthMaterial)c(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)c(f,
|
|
THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)c(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)c(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)c(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)c(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&c(f,THREE.ShaderLib.particle_basic);var u,p,q,r;m=q=r=0;for(u=j.length;m<u;m++){p=j[m];p instanceof THREE.DirectionalLight&&q++;p instanceof
|
|
THREE.PointLight&&r++}if(r+q<=4){j=q;r=r}else{j=Math.ceil(4*q/(r+q));r=4-j}m={directional:j,point:r};r=f.fragment_shader;j=f.vertex_shader;u={fog:g,map:f.map,env_map:f.env_map,light_map:f.light_map,maxDirLights:m.directional,maxPointLights:m.point};g=b.createProgram();m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":
|
|
"",u.env_map?"#define USE_ENVMAP":"",u.light_map?"#define USE_LIGHTMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"",u.light_map?"#define USE_LIGHTMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");
|
|
b.attachShader(g,d("fragment",m+r));b.attachShader(g,d("vertex",u+j));b.linkProgram(g);b.getProgramParameter(g,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(g,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");g.uniforms={};g.attributes={};f.program=g;g=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(h in f.uniforms)g.push(h);h=f.program;r=0;for(j=g.length;r<j;r++){m=g[r];h.uniforms[m]=b.getUniformLocation(h,
|
|
m)}f=f.program;h=["position","normal","uv","uv2","tangent"];g=0;for(r=h.length;g<r;g++){j=h[g];f.attributes[j]=b.getAttribLocation(f,j)}}};this.renderBuffer=function(f,j,g,h,m,u){var p;this.initMaterial(h,j,g);p=h.program;if(p!=n){b.useProgram(p);n=p}this.loadCamera(p,f);this.loadMatrices(p);if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){this.setupLights(p,j);j=this.lights;h.uniforms.enableLighting.value=j.directional.length+j.point.length;h.uniforms.ambientLightColor.value=
|
|
j.ambient;h.uniforms.directionalLightColor.value=j.directional.colors;h.uniforms.directionalLightDirection.value=j.directional.positions;h.uniforms.pointLightColor.value=j.point.colors;h.uniforms.pointLightPosition.value=j.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){h.uniforms.color.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);h.uniforms.opacity.value=h.opacity;h.uniforms.map.texture=
|
|
h.map;h.uniforms.light_map.texture=h.light_map;h.uniforms.env_map.texture=h.env_map;h.uniforms.reflectivity.value=h.reflectivity;h.uniforms.refraction_ratio.value=h.refraction_ratio;h.uniforms.combine.value=h.combine;h.uniforms.useRefract.value=h.env_map&&h.env_map.mapping instanceof THREE.CubeRefractionMapping;if(g){h.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){h.uniforms.fogNear.value=g.near;h.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)h.uniforms.fogDensity.value=
|
|
g.density}}if(h instanceof THREE.LineBasicMaterial){h.uniforms.color.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);h.uniforms.opacity.value=h.opacity;if(g){h.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){h.uniforms.fogNear.value=g.near;h.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)h.uniforms.fogDensity.value=g.density}}if(h instanceof THREE.ParticleBasicMaterial){h.uniforms.color.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,
|
|
h.color.b*h.opacity);h.uniforms.opacity.value=h.opacity;h.uniforms.size.value=h.size;h.uniforms.map.texture=h.map;if(g){h.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){h.uniforms.fogNear.value=g.near;h.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)h.uniforms.fogDensity.value=g.density}}if(h instanceof THREE.MeshPhongMaterial){h.uniforms.ambient.value.setRGB(h.ambient.r,h.ambient.g,h.ambient.b);h.uniforms.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);
|
|
h.uniforms.shininess.value=h.shininess}if(h instanceof THREE.MeshDepthMaterial){h.uniforms.mNear.value=f.near;h.uniforms.mFar.value=f.far}f=h.uniforms;var q,r,v;for(q in f)if(v=p.uniforms[q]){j=f[q];r=j.type;g=j.value;if(r=="i")b.uniform1i(v,g);else if(r=="f")b.uniform1f(v,g);else if(r=="fv1")b.uniform1fv(v,g);else if(r=="fv")b.uniform3fv(v,g);else if(r=="v2")b.uniform2f(v,g.x,g.y);else if(r=="v3")b.uniform3f(v,g.x,g.y,g.z);else if(r=="c")b.uniform3f(v,g.r,g.g,g.b);else if(r=="t"){b.uniform1i(v,g);
|
|
if(j=j.texture)if(j.image instanceof Array&&j.image.length==6){j=j;g=g;if(j.image.length==6){if(!j.image.__webGLTextureCube&&!j.image.__cubeMapInitialized&&j.image.loadCount==6){j.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,j.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
|
|
b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,j.image[r]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);j.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_CUBE_MAP,j.image.__webGLTextureCube)}}else{j=j;g=g;if(!j.__webGLTexture&&j.image.loaded){j.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,j.__webGLTexture);b.texImage2D(b.TEXTURE_2D,
|
|
0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,j.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(j.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(j.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(j.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(j.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_2D,j.__webGLTexture)}}}p=p.attributes;b.bindBuffer(b.ARRAY_BUFFER,m.__webGLVertexBuffer);b.vertexAttribPointer(p.position,
|
|
3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.position);if(p.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLNormalBuffer);b.vertexAttribPointer(p.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.normal)}if(p.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLTangentBuffer);b.vertexAttribPointer(p.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(m.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLUVBuffer);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,0,0);
|
|
b.enableVertexAttribArray(p.uv)}else b.disableVertexAttribArray(p.uv);if(p.uv2>=0)if(m.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLUV2Buffer);b.vertexAttribPointer(p.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv2)}else b.disableVertexAttribArray(p.uv2);if(h.wireframe||h instanceof THREE.LineBasicMaterial){p=h.wireframe_linewidth!==undefined?h.wireframe_linewidth:h.linewidth!==undefined?h.linewidth:1;h=h instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:
|
|
b.LINES;b.lineWidth(p);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLLineBuffer);b.drawElements(h,m.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(h instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLParticleBuffer);b.drawElements(b.POINTS,m.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,m.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,j,g,h,m,u,p){var q,r,v,t,L;v=0;
|
|
for(t=h.materials.length;v<t;v++){q=h.materials[v];if(q instanceof THREE.MeshFaceMaterial){q=0;for(r=m.materials.length;q<r;q++)if((L=m.materials[q])&&L.blending==u&&L.opacity<1==p){this.setBlending(L.blending);this.renderBuffer(f,j,g,L,m,h)}}else if((L=q)&&L.blending==u&&L.opacity<1==p){this.setBlending(L.blending);this.renderBuffer(f,j,g,L,m,h)}}};this.render=function(f,j,g,h){var m,u,p,q=f.lights,r=f.fog;j.autoUpdateMatrix&&j.updateMatrix();z.set(j.matrix.flatten());w.set(j.projectionMatrix.flatten());
|
|
this.initWebGLObjects(f,j);h=h!==undefined?h:true;if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=b.createFramebuffer();g.__webGLRenderbuffer=b.createRenderbuffer();g.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,g.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,g.width,g.height);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(g.wrap_t));b.texParameteri(b.TEXTURE_2D,
|
|
b.TEXTURE_MAG_FILTER,e(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(g.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(g.format),g.width,g.height,0,e(g.format),e(g.type),null);b.bindFramebuffer(b.FRAMEBUFFER,g.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,g.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,g.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);
|
|
b.bindFramebuffer(b.FRAMEBUFFER,null)}if(g){m=g.__webGLFramebuffer;p=g.width;u=g.height}else{m=null;p=i.width;u=i.height}if(m!=o){b.bindFramebuffer(b.FRAMEBUFFER,m);b.viewport(0,0,p,u);h&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);o=m}this.autoClear&&this.clear();m=f.__webGLObjects.length;for(h=0;h<m;h++){u=f.__webGLObjects[h];p=u.object;if(p.visible){p.autoUpdateMatrix&&p.updateMatrix();if(p.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);p.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}}}for(h=
|
|
0;h<m;h++){u=f.__webGLObjects[h];p=u.object;u=u.buffer;if(p.visible){this.setupMatrices(p,j);this.renderPass(j,q,r,p,u,THREE.NormalBlending,false)}}for(h=0;h<m;h++){u=f.__webGLObjects[h];p=u.object;u=u.buffer;if(p.visible){this.setupMatrices(p,j);this.renderPass(j,q,r,p,u,THREE.AdditiveBlending,false);this.renderPass(j,q,r,p,u,THREE.SubtractiveBlending,false);this.renderPass(j,q,r,p,u,THREE.AdditiveBlending,true);this.renderPass(j,q,r,p,u,THREE.SubtractiveBlending,true);this.renderPass(j,q,r,p,u,
|
|
THREE.NormalBlending,true);this.renderPass(j,q,r,p,u,THREE.BillboardBlending,false)}}if(g&&g.min_filter!==THREE.NearestFilter&&g.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,g.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(f,j){function g(t,L,D,R){if(t[L]==undefined){f.__webGLObjects.push({buffer:D,object:R});t[L]=1}}var h,m,u,p,q,r,v;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={}}h=0;for(m=f.objects.length;h<
|
|
m;h++){u=f.objects[h];q=u.geometry;if(f.__webGLObjectsMap[u.id]==undefined)f.__webGLObjectsMap[u.id]={};v=f.__webGLObjectsMap[u.id];if(u instanceof THREE.Mesh){for(p in q.geometryChunks){r=q.geometryChunks[p];if(!r.__webGLVertexBuffer){this.createMeshBuffers(r);this.initMeshBuffers(r,u);q.__dirtyVertices=true;q.__dirtyElements=true;q.__dirtyUvs=true;q.__dirtyNormals=true;q.__dirtyTangents=true}if(q.__dirtyVertices||q.__dirtyElements||q.__dirtyUvs)this.setMeshBuffers(r,u,b.DYNAMIC_DRAW,q.__dirtyVertices,
|
|
q.__dirtyElements,q.__dirtyUvs,q.__dirtyNormals,q.__dirtyTangents);g(v,p,r,u)}q.__dirtyVertices=false;q.__dirtyElements=false;q.__dirtyUvs=false;q.__dirtyNormals=false;q.__dirtyTangents=false}else if(u instanceof THREE.Line){if(!q.__webGLVertexBuffer){this.createLineBuffers(q);this.initLineBuffers(q);q.__dirtyVertices=true;q.__dirtyElements=true}q.__dirtyVertices&&this.setLineBuffers(q,b.DYNAMIC_DRAW,q.__dirtyVertices,q.__dirtyElements);g(v,0,q,u);q.__dirtyVertices=false;q.__dirtyElements=false}else if(u instanceof
|
|
THREE.ParticleSystem){if(!q.__webGLVertexBuffer){this.createParticleBuffers(q);this.initParticleBuffers(q);q.__dirtyVertices=true;q.__dirtyElements=true}if(q.__dirtyVertices||u.sortParticles)this.setParticleBuffers(q,b.DYNAMIC_DRAW,q.__dirtyVertices,q.__dirtyElements,u,j);g(v,0,q,u);q.__dirtyVertices=false;q.__dirtyElements=false}}};this.removeObject=function(f,j){var g,h;for(g=f.__webGLObjects.length-1;g>=0;g--){h=f.__webGLObjects[g].object;j==h&&f.__webGLObjects.splice(g,1)}};this.setupMatrices=
|
|
function(f,j){k.multiply(j.matrix,f.matrix);y.set(k.flatten());l=THREE.Matrix4.makeInvert3x3(k).transpose();x.set(l.m);I.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,z);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,w);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,x);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,I)};this.loadCamera=function(f,j){b.uniform3f(f.uniforms.cameraPosition,
|
|
j.position.x,j.position.y,j.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);
|
|
if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\nlightmapColor = texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
|
|
THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
|
|
vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
|
|
THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},
|
|
lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,
|
|
"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,
|
|
"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );",
|
|
THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_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.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"}};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,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.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|