|
@@ -1,6 +1,6 @@
|
|
|
// Three.js r46dev - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
|
|
|
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
|
|
|
+THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
|
|
|
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var e,k,h;if(b===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),k=a*6-e,a=b*(1-c),h=b*(1-
|
|
|
c*k),c=b*(1-c*(1-k)),e){case 1:this.r=h;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=h;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=h;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
|
|
|
Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
@@ -28,8 +28,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=
|
|
|
THREE.Matrix4=function(a,c,b,e,k,h,f,l,n,u,t,p,w,v,z,x){this.set(a!==void 0?a:1,c||0,b||0,e||0,k||0,h!==void 0?h:1,f||0,l||0,n||0,u||0,t!==void 0?t:1,p||0,w||0,v||0,z||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,k,h,f,l,n,u,t,p,w,v,z,x){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=k;this.n22=h;this.n23=f;this.n24=l;this.n31=n;this.n32=u;this.n33=t;this.n34=p;this.n41=w;this.n42=v;this.n43=z;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());k.cross(h,e).normalize();this.n11=e.x;this.n12=k.x;this.n13=h.x;this.n21=e.y;this.n22=k.y;this.n23=h.y;this.n31=e.z;this.n32=k.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,k=a.n13,h=a.n14,f=a.n21,l=a.n22,n=a.n23,u=a.n24,t=a.n31,p=a.n32,w=a.n33,v=a.n34,z=a.n41,x=a.n42,y=a.n43,
|
|
|
-C=a.n44,A=c.n11,B=c.n12,D=c.n13,K=c.n14,H=c.n21,M=c.n22,V=c.n23,L=c.n24,W=c.n31,N=c.n32,O=c.n33,$=c.n34,Y=c.n41,P=c.n42,o=c.n43,U=c.n44;this.n11=b*A+e*H+k*W+h*Y;this.n12=b*B+e*M+k*N+h*P;this.n13=b*D+e*V+k*O+h*o;this.n14=b*K+e*L+k*$+h*U;this.n21=f*A+l*H+n*W+u*Y;this.n22=f*B+l*M+n*N+u*P;this.n23=f*D+l*V+n*O+u*o;this.n24=f*K+l*L+n*$+u*U;this.n31=t*A+p*H+w*W+v*Y;this.n32=t*B+p*M+w*N+v*P;this.n33=t*D+p*V+w*O+v*o;this.n34=t*K+p*L+w*$+v*U;this.n41=z*A+x*H+y*W+C*Y;this.n42=z*B+x*M+y*N+C*P;this.n43=z*D+x*
|
|
|
-V+y*O+C*o;this.n44=z*K+x*L+y*$+C*U;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
+C=a.n44,A=c.n11,B=c.n12,D=c.n13,K=c.n14,H=c.n21,M=c.n22,V=c.n23,L=c.n24,W=c.n31,N=c.n32,O=c.n33,Z=c.n34,Y=c.n41,P=c.n42,o=c.n43,U=c.n44;this.n11=b*A+e*H+k*W+h*Y;this.n12=b*B+e*M+k*N+h*P;this.n13=b*D+e*V+k*O+h*o;this.n14=b*K+e*L+k*Z+h*U;this.n21=f*A+l*H+n*W+u*Y;this.n22=f*B+l*M+n*N+u*P;this.n23=f*D+l*V+n*O+u*o;this.n24=f*K+l*L+n*Z+u*U;this.n31=t*A+p*H+w*W+v*Y;this.n32=t*B+p*M+w*N+v*P;this.n33=t*D+p*V+w*O+v*o;this.n34=t*K+p*L+w*Z+v*U;this.n41=z*A+x*H+y*W+C*Y;this.n42=z*B+x*M+y*N+C*P;this.n43=z*D+x*
|
|
|
+V+y*O+C*o;this.n44=z*K+x*L+y*Z+C*U;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return 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},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,k=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*k;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*k;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,k=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*k;a.y=this.n21*c+this.n22*
|
|
|
b+this.n23*e+this.n24*k;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*k;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*k;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,k=this.n21,h=this.n22,f=this.n23,l=this.n24,n=this.n31,u=this.n32,t=this.n33,p=this.n34,w=this.n41,v=this.n42,z=this.n43,x=this.n44;return e*f*u*w-b*l*u*w-e*h*t*w+c*l*t*w+b*h*p*w-c*f*p*w-e*f*n*v+b*l*n*v+e*k*t*v-a*l*t*v-b*k*p*v+a*f*p*v+e*h*n*z-c*l*n*z-e*k*u*z+a*l*u*z+c*k*p*z-a*h*p*z-b*h*n*x+c*f*n*x+b*k*u*x-a*f*u*x-c*k*t*x+a*h*t*x},transpose:function(){var a;
|
|
@@ -52,27 +52,27 @@ THREE.Matrix4.makeOrtho=function(a,c,b,e,k,h){var f,l,n,u;f=new THREE.Matrix4;l=
|
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
|
--1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var c=this.children.indexOf(a);if(c!==-1)a.parent=void 0,this.children.splice(c,1)},getChildByName:function(a,c){var b,e,k;b=0;for(e=this.children.length;b<e;b++){k=this.children[b];if(k.name===a)return k;if(c&&(k=k.getChildByName(a,c),k!==void 0))return k}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
|
|
|
-this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<
|
|
|
-b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
+-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,k;b=0;for(e=this.children.length;b<e;b++){k=this.children[b];if(k.name===a)return k;
|
|
|
+if(c&&(k=k.getChildByName(a,c),k!==void 0))return k}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
|
+this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){var a=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function b(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,k,h=[],f,l,n=[],u,t=[],p,w,v=[],z,x,y=[],C={objects:[],sprites:[],lights:[],elements:[]};
|
|
|
new THREE.Vector3;var A=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-
|
|
|
a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=K[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.multiplyVector3(a);
|
|
|
return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){C.objects.length=0;C.sprites.length=0;C.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),k=0;k<6;k++)if(c=
|
|
|
-K[k].x*e.n14+K[k].y*e.n24+K[k].z*e.n34+K[k].w,c<=f){c=!1;break a}c=!0}c?C.objects.push(a):a instanceof THREE.Line?C.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?C.sprites.push(a):a instanceof THREE.Light&&C.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return C};this.projectScene=function(K,L,W){var N=L.near,O=L.far,$,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea;x=w=u=l=0;C.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
-K.add(L));K.updateMatrixWorld();L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);this.computeFrustum(B);C=this.projectGraph(K);K=0;for($=C.objects.length;K<$;K++)if(J=C.objects[K],ra=J.matrixWorld,na=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;la=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
|
|
|
+K[k].x*e.n14+K[k].y*e.n24+K[k].z*e.n34+K[k].w,c<=f){c=!1;break a}c=!0}c?C.objects.push(a):a instanceof THREE.Line?C.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?C.sprites.push(a):a instanceof THREE.Light&&C.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return C};this.projectScene=function(K,L,W){var N=L.near,O=L.far,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea;x=w=u=l=0;C.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
+K.add(L));K.updateMatrixWorld();L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);this.computeFrustum(B);C=this.projectGraph(K);K=0;for(Z=C.objects.length;K<Z;K++)if(J=C.objects[K],ra=J.matrixWorld,na=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;la=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
|
|
|
e.positionScreen.copy(e.positionWorld),B.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>N&&e.positionScreen.z<O;o=0;for(Y=ja.length;o<Y;o++){P=ja[o];if(P instanceof THREE.Face3)if(U=h[P.a],Q=h[P.b],aa=h[P.c],U.visible&&Q.visible&&aa.visible&&(J.doubleSided||J.flipSided!=(aa.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(aa.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-
|
|
|
U.positionScreen.x)<0))T=n[l]=n[l]||new THREE.RenderableFace3,l++,f=T,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa);else continue;else if(P instanceof THREE.Face4)if(U=h[P.a],Q=h[P.b],aa=h[P.c],T=h[P.d],U.visible&&Q.visible&&aa.visible&&T.visible&&(J.doubleSided||J.flipSided!=((T.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(T.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-U.positionScreen.x)<0||(Q.positionScreen.x-aa.positionScreen.x)*(T.positionScreen.y-aa.positionScreen.y)-
|
|
|
(Q.positionScreen.y-aa.positionScreen.y)*(T.positionScreen.x-aa.positionScreen.x)<0)))ea=t[u]=t[u]||new THREE.RenderableFace4,u++,f=ea,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa),f.v4.copy(T);else continue;f.normalWorld.copy(P.normal);pa.multiplyVector3(f.normalWorld);f.centroidWorld.copy(P.centroid);ra.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);B.multiplyVector3(f.centroidScreen);aa=P.vertexNormals;U=0;for(Q=aa.length;U<Q;U++)T=f.vertexNormalsWorld[U],T.copy(aa[U]),pa.multiplyVector3(T);
|
|
|
U=0;for(Q=la.length;U<Q;U++)if(ea=la[U][o]){aa=0;for(T=ea.length;aa<T;aa++)f.uvs[U][aa]=ea[aa]}f.material=na;f.faceMaterial=P.materialIndex!==null?qa[P.materialIndex]:null;f.z=f.centroidScreen.z;C.elements.push(f)}}else if(J instanceof THREE.Line){D.multiply(B,ra);o=J.geometry.vertices;U=a();U.positionScreen.copy(o[0].position);D.multiplyVector4(U.positionScreen);Y=1;for(P=o.length;Y<P;Y++)if(U=a(),U.positionScreen.copy(o[Y].position),D.multiplyVector4(U.positionScreen),Q=h[k-2],H.copy(U.positionScreen),
|
|
|
-M.copy(Q.positionScreen),b(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),J=v[w]=v[w]||new THREE.RenderableLine,w++,p=J,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(M),p.z=Math.max(H.z,M.z),p.material=na,C.elements.push(p)}K=0;for($=C.sprites.length;K<$;K++)if(J=C.sprites[K],ra=J.matrixWorld,J instanceof THREE.Particle&&(A.set(ra.n14,ra.n24,ra.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,x++,z=N,z.x=A.x/A.w,z.y=A.y/A.w,z.z=A.z,z.rotation=
|
|
|
+M.copy(Q.positionScreen),b(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),J=v[w]=v[w]||new THREE.RenderableLine,w++,p=J,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(M),p.z=Math.max(H.z,M.z),p.material=na,C.elements.push(p)}K=0;for(Z=C.sprites.length;K<Z;K++)if(J=C.sprites[K],ra=J.matrixWorld,J instanceof THREE.Particle&&(A.set(ra.n14,ra.n24,ra.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,x++,z=N,z.x=A.x/A.w,z.y=A.y/A.w,z.z=A.z,z.rotation=
|
|
|
J.rotation.z,z.scale.x=J.scale.x*Math.abs(z.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)),z.scale.y=J.scale.y*Math.abs(z.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24)),z.material=J.material,C.elements.push(z);W&&C.elements.sort(c);return C}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,k=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-k),k=Math.sin(-k),h=Math.cos(b),b=Math.sin(b),f=a*c,l=e*k;this.w=f*h-l*b;this.x=f*b+l*h;this.y=e*c*h+a*k*b;this.z=a*k*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
|
this.x,b=this.y,e=this.z,k=this.w,h=a.x,f=a.y,l=a.z,a=a.w;this.x=c*a+k*h+b*l-e*f;this.y=b*a+k*f+e*h-c*l;this.z=e*a+k*l+c*f-b*h;this.w=k*a-c*h-b*f-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,k=a.z,h=this.x,f=this.y,l=this.z,n=this.w,u=n*b+f*k-l*e,t=n*e+l*b-h*k,p=n*k+h*e-f*b,b=-h*
|
|
|
b-f*e-l*k;c.x=u*n+b*-h+t*-l-p*-f;c.y=t*n+b*-f+p*-h-u*-l;c.z=p*n+b*-l+u*-f-t*-h;return c}};
|
|
|
-THREE.Quaternion.slerp=function(a,c,b,e){var k=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;k<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,k=-k):b.copy(c);if(Math.abs(k)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var h=Math.acos(k),k=Math.sqrt(1-k*k);if(Math.abs(k)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(a,c,b,e){var k=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;k<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,k=-k):b.copy(c);if(Math.abs(k)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var h=Math.acos(k),k=Math.sqrt(1-k*k);if(Math.abs(k)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Face3=function(a,c,b,e,k,h){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(a,c,b,e,k,h,f){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
@@ -83,8 +83,8 @@ b,e,k,h,f,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(k=this.faces.length;e<
|
|
|
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++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.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++)b=this.faces[a],b instanceof
|
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
|
b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,k,h,o){l=a.vertices[b].position;n=a.vertices[c].position;u=a.vertices[e].position;t=f[k];p=f[h];w=f[o];v=n.x-l.x;z=u.x-l.x;x=n.y-l.y;y=u.y-l.y;C=n.z-l.z;A=u.z-l.z;B=p.u-t.u;D=w.u-t.u;K=p.v-t.v;H=w.v-t.v;M=1/(B*H-D*K);N.set((H*v-K*z)*M,(H*x-K*y)*M,(H*C-K*A)*M);O.set((B*z-D*v)*M,(B*y-D*x)*M,(B*A-D*C)*M);L[b].addSelf(N);L[c].addSelf(N);L[e].addSelf(N);W[b].addSelf(O);
|
|
|
-W[c].addSelf(O);W[e].addSelf(O)}var c,b,e,k,h,f,l,n,u,t,p,w,v,z,x,y,C,A,B,D,K,H,M,V,L=[],W=[],N=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3,Y=new THREE.Vector3,P=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)L[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var o=["a","b",
|
|
|
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)P.copy(h.vertexNormals[e]),k=h[o[e]],V=L[k],$.copy(V),$.subSelf(P.multiplyScalar(P.dot(V))).normalize(),Y.cross(h.vertexNormals[e],V),k=Y.dot(W[k]),k=k<0?-1:1,h.vertexTangents[e]=new THREE.Vector4($.x,$.y,$.z,k)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
+W[c].addSelf(O);W[e].addSelf(O)}var c,b,e,k,h,f,l,n,u,t,p,w,v,z,x,y,C,A,B,D,K,H,M,V,L=[],W=[],N=new THREE.Vector3,O=new THREE.Vector3,Z=new THREE.Vector3,Y=new THREE.Vector3,P=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)L[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var o=["a","b",
|
|
|
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)P.copy(h.vertexNormals[e]),k=h[o[e]],V=L[k],Z.copy(V),Z.subSelf(P.multiplyScalar(P.dot(V))).normalize(),Y.cross(h.vertexNormals[e],V),k=Y.dot(W[k]),k=k<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,k)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;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=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,k=Math.pow(10,4),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*k),Math.round(e.y*k),Math.round(e.z*k)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
|
|
|
b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
@@ -146,46 +146,49 @@ THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?n
|
|
|
!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
|
|
|
THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
|
|
|
-THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
|
+THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
|
|
|
+THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
|
+THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
|
+THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,k,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;k=b/2;h=e/2};this.render=function(b,e){var n,u,t,p,w,v,z,x;a=c.projectScene(b,e);n=0;for(u=a.length;n<u;n++)if(w=a[n],w instanceof THREE.RenderableParticle){z=w.x*k+k;x=w.y*h+h;t=0;for(p=w.material.length;t<p;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=x+"px"}}};
|
|
|
THREE.CanvasRenderer=function(a){function c(a){if(A!=a)x.globalAlpha=A=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)x.strokeStyle=D=a}function k(a){if(K!=a)x.fillStyle=K=a}var h=this,f,l,n,u=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),C=0,A=1,B=0,D=null,K=null,H=null,M=null,V=null,L,W,N,O,$=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,Z=new THREE.Color,ga=new THREE.Color,ha=[],oa,ma,ka,sa,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,da=!1,va=new THREE.Color,ua=new THREE.Color,ta=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
|
|
|
+p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),C=0,A=1,B=0,D=null,K=null,H=null,M=null,V=null,L,W,N,O,Z=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,$=new THREE.Color,ga=new THREE.Color,ha=[],oa,ma,ka,sa,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,da=!1,ua=new THREE.Color,va=new THREE.Color,ta=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
|
|
|
Ga.width=Ga.height=2;Ba=Ga.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ka=Ba.getImageData(0,0,2,2);ya=Ka.data;X=document.createElement("canvas");X.width=X.height=a;Ia=X.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;w=b;v=Math.floor(p/2);z=Math.floor(w/2);t.width=p;t.height=w;fa.set(-v,-z,v,z);ia.set(-v,-z,v,z);A=1;B=0;V=M=
|
|
|
H=K=D=null};this.setClearColor=function(a,b){y.copy(a);C=b;ia.set(-v,-z,v,z)};this.setClearColorHex=function(a,b){y.setHex(a);C=b;ia.set(-v,-z,v,z)};this.clear=function(){x.setTransform(1,0,0,-1,v,z);ia.isEmpty()||(ia.minSelf(fa),ia.inflate(2),C<1&&x.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),C>0&&(b(THREE.NormalBlending),c(1),k("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+C+")"),x.fillRect(Math.floor(ia.getX()),
|
|
|
-Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,t){function p(a){var b,c,e,f;va.setRGB(0,0,0);ua.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):e instanceof THREE.PointLight&&(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b)}function w(a,b,c,e){var f,k,h,o,l,n;f=0;for(k=a.length;f<k;f++)h=a[f],
|
|
|
+Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,t){function p(a){var b,c,e,f;ua.setRGB(0,0,0);va.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):e instanceof THREE.DirectionalLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.PointLight&&(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b)}function w(a,b,c,e){var f,k,h,o,l,n;f=0;for(k=a.length;f<k;f++)h=a[f],
|
|
|
o=h.color,h instanceof THREE.DirectionalLight?(l=h.matrixWorld.getPosition(),n=c.dot(l),n<=0||(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):h instanceof THREE.PointLight&&(l=h.matrixWorld.getPosition(),n=c.dot(wa.sub(l,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(l)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function y(a,f,h){c(h.opacity);b(h.blending);var o,l,n,u,t,p;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)u=h.map.image,t=u.width>>
|
|
|
1,p=u.height>>1,h=f.scale.x*v,n=f.scale.y*z,o=h*t,l=n*p,G.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(G)&&(x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(h,-n),x.translate(-t,-p),x.drawImage(u,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(o=f.scale.x*v,l=f.scale.y*z,G.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(G)&&(e(h.color.getContextStyle()),k(h.color.getContextStyle()),x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(o,l),h.program(x),x.restore()))}function ab(a,
|
|
|
f,h,k){c(k.opacity);b(k.blending);x.beginPath();x.moveTo(a.positionScreen.x,a.positionScreen.y);x.lineTo(f.positionScreen.x,f.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){a=k.linewidth;if(H!=a)x.lineWidth=H=a;a=k.linecap;if(M!=a)x.lineCap=M=a;a=k.linejoin;if(V!=a)x.lineJoin=V=a;e(k.color.getContextStyle());x.stroke();G.inflate(k.linewidth*2)}}function A(a,e,f,k,l,u,v,p){h.info.render.vertices+=3;h.info.render.faces++;c(p.opacity);b(p.blending);P=a.positionScreen.x;o=a.positionScreen.y;
|
|
|
U=e.positionScreen.x;Q=e.positionScreen.y;aa=f.positionScreen.x;T=f.positionScreen.y;C(P,o,U,Q,aa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,wa.copy(v.vertexNormalsWorld[k]),Da=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Ea=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+
|
|
|
0.5,wa.copy(v.vertexNormalsWorld[l]),Ca=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Fa=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,wa.copy(v.vertexNormalsWorld[u]),za=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,F=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,Wa(P,o,U,Q,aa,T,Da,Ea,Ca,Fa,za,F,p.envMap)}else p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
|
|
|
-(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map)),b(THREE.SubtractiveBlending)),da?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ea.r=ca.r=Z.r=va.r,ea.g=ca.g=Z.g=va.g,ea.b=ca.b=Z.b=va.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ea),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],ca),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],Z),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,
|
|
|
-Math.min(p.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),ga.r=(ca.r+Z.r)*0.5,ga.g=(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(la.r=va.r,la.g=va.g,la.b=va.b,w(n,v.centroidWorld,v.normalWorld,la),la.r=Math.max(0,Math.min(p.color.r*
|
|
|
-la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)):p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),Z.r=Z.g=Z.b=1-Oa(f.positionScreen.z,oa,ma),ga.r=(ca.r+Z.r)*0.5,ga.g=
|
|
|
-(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(p instanceof THREE.MeshNormalMaterial)la.r=Ta(v.normalWorld.x),la.g=Ta(v.normalWorld.y),la.b=Ta(v.normalWorld.z),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)}function B(a,e,f,k,l,u,p,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
|
|
|
+(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map)),b(THREE.SubtractiveBlending)),da?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ea.r=ca.r=$.r=ua.r,ea.g=ca.g=$.g=ua.g,ea.b=ca.b=$.b=ua.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ea),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],ca),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],$),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,
|
|
|
+Math.min(p.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),ga.r=(ca.r+$.r)*0.5,ga.g=(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(la.r=ua.r,la.g=ua.g,la.b=ua.b,w(n,v.centroidWorld,v.normalWorld,la),la.r=Math.max(0,Math.min(p.color.r*
|
|
|
+la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)):p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(f.positionScreen.z,oa,ma),ga.r=(ca.r+$.r)*0.5,ga.g=
|
|
|
+(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(p instanceof THREE.MeshNormalMaterial)la.r=Ta(v.normalWorld.x),la.g=Ta(v.normalWorld.y),la.b=Ta(v.normalWorld.z),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)}function B(a,e,f,k,l,u,p,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
|
|
|
U=e.positionScreen.x,Q=e.positionScreen.y,aa=f.positionScreen.x,T=f.positionScreen.y,J=k.positionScreen.x,ra=k.positionScreen.y,pa=l.positionScreen.x,na=l.positionScreen.y,qa=u.positionScreen.x,ja=u.positionScreen.y,v instanceof THREE.MeshBasicMaterial)D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color);else if(v instanceof THREE.MeshLambertMaterial)da?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ea.r=
|
|
|
-ca.r=Z.r=ga.r=va.r,ea.g=ca.g=Z.g=ga.g=va.g,ea.b=ca.b=Z.b=ga.b=va.b,w(n,p.v1.positionWorld,p.vertexNormalsWorld[0],ea),w(n,p.v2.positionWorld,p.vertexNormalsWorld[1],ca),w(n,p.v4.positionWorld,p.vertexNormalsWorld[3],Z),w(n,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),ea.r=Math.max(0,Math.min(v.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(v.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(v.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,
|
|
|
-Math.min(v.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(v.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(v.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(v.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)):(la.r=va.r,la.g=va.g,la.b=va.b,w(n,p.centroidWorld,p.normalWorld,la),la.r=Math.max(0,Math.min(v.color.r*
|
|
|
+ca.r=$.r=ga.r=ua.r,ea.g=ca.g=$.g=ga.g=ua.g,ea.b=ca.b=$.b=ga.b=ua.b,w(n,p.v1.positionWorld,p.vertexNormalsWorld[0],ea),w(n,p.v2.positionWorld,p.vertexNormalsWorld[1],ca),w(n,p.v4.positionWorld,p.vertexNormalsWorld[3],$),w(n,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),ea.r=Math.max(0,Math.min(v.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(v.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(v.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,
|
|
|
+Math.min(v.color.b*ca.b,1)),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,$,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)):(la.r=ua.r,la.g=ua.g,la.b=ua.b,w(n,p.centroidWorld,p.normalWorld,la),la.r=Math.max(0,Math.min(v.color.r*
|
|
|
la.r,1)),la.g=Math.max(0,Math.min(v.color.g*la.g,1)),la.b=Math.max(0,Math.min(v.color.b*la.b,1)),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(la)):(D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color));else if(v instanceof THREE.MeshNormalMaterial)la.r=Ta(p.normalWorld.x),la.g=Ta(p.normalWorld.y),la.b=Ta(p.normalWorld.z),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,
|
|
|
-v.wireframeLinecap,v.wireframeLinejoin):Ma(la);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),Z.r=Z.g=Z.b=1-Oa(k.positionScreen.z,oa,ma),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,ma),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)}function C(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
|
|
|
+v.wireframeLinecap,v.wireframeLinejoin):Ma(la);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(k.positionScreen.z,oa,ma),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,ma),ka=Ua(ea,ca,$,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)}function C(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
|
|
|
b);x.closePath()}function D(a,b,c,e,f,k,h,o){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(h,o);x.lineTo(a,b);x.closePath()}function K(a,b,c,f){if(H!=b)x.lineWidth=H=b;if(M!=c)x.lineCap=M=c;if(V!=f)x.lineJoin=V=f;e(a.getContextStyle());x.stroke();G.inflate(b*2)}function Ma(a){k(a.getContextStyle());x.fill()}function Wa(a,b,c,e,f,h,o,l,n,v,p,u,t){if(t.image.width!=0){if(t.needsUpdate==!0||ha[t.id]==void 0){var xa=t.wrapS==THREE.RepeatWrapping,w=t.wrapT==THREE.RepeatWrapping;ha[t.id]=
|
|
|
x.createPattern(t.image,xa&&w?"repeat":xa&&!w?"repeat-x":!xa&&w?"repeat-y":"no-repeat");t.needsUpdate=!1}k(ha[t.id]);var xa=t.offset.x/t.repeat.x,w=t.offset.y/t.repeat.y,F=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,o=(o+xa)*F,l=(l+w)*t,n=(n+xa)*F,v=(v+w)*t,p=(p+xa)*F,u=(u+w)*t;c-=a;e-=b;f-=a;h-=b;n-=o;v-=l;p-=o;u-=l;xa=1/(n*u-p*v);t=(u*c-v*f)*xa;v=(u*e-v*h)*xa;c=(n*f-p*c)*xa;e=(n*h-p*e)*xa;a=a-t*o-c*l;b=b-v*o-e*l;x.save();x.transform(t,v,c,e,a,b);x.fill();x.restore()}}function Sa(a,
|
|
|
b,c,e,f,k,h,o,l,n,v,p,u){var t,xa;t=u.width-1;xa=u.height-1;h*=t;o*=xa;l*=t;n*=xa;v*=t;p*=xa;c-=a;e-=b;f-=a;k-=b;l-=h;n-=o;v-=h;p-=o;xa=1/(l*p-v*n);t=(p*c-n*f)*xa;n=(p*e-n*k)*xa;c=(l*f-v*c)*xa;e=(l*k-v*e)*xa;a=a-t*h-c*o;b=b-n*h-e*o;x.save();x.transform(t,n,c,e,a,b);x.clip();x.drawImage(u,0,0);x.restore()}function Ua(a,b,c,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),v=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);ya[0]=
|
|
|
f<0?0:f>255?255:f;ya[1]=k<0?0:k>255?255:k;ya[2]=a<0?0:a>255?255:a;ya[4]=h<0?0:h>255?255:h;ya[5]=o<0?0:o>255?255:o;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=n<0?0:n>255?255:n;ya[10]=c<0?0:c>255?255:c;ya[12]=v<0?0:v>255?255:v;ya[13]=p<0?0:p>255?255:p;ya[14]=e<0?0:e>255?255:e;Ba.putImageData(Ka,0,0);Ia.drawImage(Ga,0,0);return X}function Oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Na(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/
|
|
|
Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Va,Xa,Aa,Ha;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,z);h.info.render.vertices=0;h.info.render.faces=0;f=u.projectScene(a,t,this.sortElements);l=f.elements;n=f.lights;(da=n.length>0)&&p(n);Va=0;for(Xa=l.length;Va<Xa;Va++)if(Aa=l[Va],Ha=Aa.material,Ha=Ha instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){G.empty();if(Aa instanceof THREE.RenderableParticle)L=Aa,L.x*=v,L.y*=z,y(L,Aa,Ha,a);else if(Aa instanceof
|
|
|
THREE.RenderableLine)L=Aa.v1,W=Aa.v2,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,G.addPoint(L.positionScreen.x,L.positionScreen.y),G.addPoint(W.positionScreen.x,W.positionScreen.y),fa.intersects(G)&&ab(L,W,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace3)L=Aa.v1,W=Aa.v2,N=Aa.v3,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,Ha.overdraw&&(Na(L.positionScreen,W.positionScreen),
|
|
|
-Na(W.positionScreen,N.positionScreen),Na(N.positionScreen,L.positionScreen)),G.add3Points(L.positionScreen.x,L.positionScreen.y,W.positionScreen.x,W.positionScreen.y,N.positionScreen.x,N.positionScreen.y),fa.intersects(G)&&A(L,W,N,0,1,2,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace4)L=Aa.v1,W=Aa.v2,N=Aa.v3,O=Aa.v4,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,O.positionScreen.x*=v,O.positionScreen.y*=z,$.positionScreen.copy(W.positionScreen),
|
|
|
-Y.positionScreen.copy(O.positionScreen),Ha.overdraw&&(Na(L.positionScreen,W.positionScreen),Na(W.positionScreen,O.positionScreen),Na(O.positionScreen,L.positionScreen),Na(N.positionScreen,$.positionScreen),Na(N.positionScreen,Y.positionScreen)),G.addPoint(L.positionScreen.x,L.positionScreen.y),G.addPoint(W.positionScreen.x,W.positionScreen.y),G.addPoint(N.positionScreen.x,N.positionScreen.y),G.addPoint(O.positionScreen.x,O.positionScreen.y),fa.intersects(G)&&Ha.opacity!=0&&B(L,W,N,O,$,Y,Aa,Ha,a);
|
|
|
+Na(W.positionScreen,N.positionScreen),Na(N.positionScreen,L.positionScreen)),G.add3Points(L.positionScreen.x,L.positionScreen.y,W.positionScreen.x,W.positionScreen.y,N.positionScreen.x,N.positionScreen.y),fa.intersects(G)&&A(L,W,N,0,1,2,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace4)L=Aa.v1,W=Aa.v2,N=Aa.v3,O=Aa.v4,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,O.positionScreen.x*=v,O.positionScreen.y*=z,Z.positionScreen.copy(W.positionScreen),
|
|
|
+Y.positionScreen.copy(O.positionScreen),Ha.overdraw&&(Na(L.positionScreen,W.positionScreen),Na(W.positionScreen,O.positionScreen),Na(O.positionScreen,L.positionScreen),Na(N.positionScreen,Z.positionScreen),Na(N.positionScreen,Y.positionScreen)),G.addPoint(L.positionScreen.x,L.positionScreen.y),G.addPoint(W.positionScreen.x,W.positionScreen.y),G.addPoint(N.positionScreen.x,N.positionScreen.y),G.addPoint(O.positionScreen.x,O.positionScreen.y),fa.intersects(G)&&Ha.opacity!=0&&B(L,W,N,O,Z,Y,Aa,Ha,a);
|
|
|
ia.addRectangle(G)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function a(a,b,c,e){var f,k,h,l,n,v;f=0;for(k=a.length;f<k;f++)h=a[f],l=h.color,h instanceof THREE.DirectionalLight?(n=h.matrixWorld.getPosition(),v=c.dot(n),v<=0||(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)):h instanceof THREE.PointLight&&(n=h.matrixWorld.getPosition(),v=c.dot(L.sub(n,b).normalize()),v<=0||(v*=h.distance==0?1:1-Math.min(b.distanceTo(n)/h.distance,1),v!=0&&(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)))}function c(a){W[a]==null&&(W[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),P==0&&W[a].setAttribute("shape-rendering","crispEdges"));return W[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,k,h,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,t,p,w,v,z,x,y,C=new THREE.Rectangle,A=new THREE.Rectangle,B=!1,D=new THREE.Color,K=new THREE.Color,H=new THREE.Color,M=new THREE.Color,V,L=new THREE.Vector3,W=[],N=[],O,$,Y,P=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+"path"),P==0&&W[a].setAttribute("shape-rendering","crispEdges"));return W[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,k,h,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,t,p,w,v,z,x,y,C=new THREE.Rectangle,A=new THREE.Rectangle,B=!1,D=new THREE.Color,K=new THREE.Color,H=new THREE.Color,M=new THREE.Color,V,L=new THREE.Vector3,W=[],N=[],O,Z,Y,P=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low":P=0}};this.setSize=function(a,b){u=a;t=b;p=u/2;w=t/2;n.setAttribute("viewBox",-p+" "+-w+" "+u+" "+t);n.setAttribute("width",u);n.setAttribute("height",t);C.set(-p,-w,p,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,u){var t,L,T,J;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;k=l.projectScene(o,u,this.sortElements);h=k.elements;
|
|
|
-f=k.lights;Y=$=0;if(B=f.length>0){K.setRGB(0,0,0);H.setRGB(0,0,0);M.setRGB(0,0,0);t=0;for(L=f.length;t<L;t++)J=f[t],T=J.color,J instanceof THREE.AmbientLight?(K.r+=T.r,K.g+=T.g,K.b+=T.b):J instanceof THREE.DirectionalLight?(H.r+=T.r,H.g+=T.g,H.b+=T.b):J instanceof THREE.PointLight&&(M.r+=T.r,M.g+=T.g,M.b+=T.b)}t=0;for(L=h.length;t<L;t++)if(T=h[t],J=T.material,J=J instanceof THREE.MeshFaceMaterial?T.faceMaterial:J,!(J==null||J.opacity==0))if(A.empty(),T instanceof THREE.RenderableParticle)v=T,v.x*=
|
|
|
+f=k.lights;Y=Z=0;if(B=f.length>0){K.setRGB(0,0,0);H.setRGB(0,0,0);M.setRGB(0,0,0);t=0;for(L=f.length;t<L;t++)J=f[t],T=J.color,J instanceof THREE.AmbientLight?(K.r+=T.r,K.g+=T.g,K.b+=T.b):J instanceof THREE.DirectionalLight?(H.r+=T.r,H.g+=T.g,H.b+=T.b):J instanceof THREE.PointLight&&(M.r+=T.r,M.g+=T.g,M.b+=T.b)}t=0;for(L=h.length;t<L;t++)if(T=h[t],J=T.material,J=J instanceof THREE.MeshFaceMaterial?T.faceMaterial:J,!(J==null||J.opacity==0))if(A.empty(),T instanceof THREE.RenderableParticle)v=T,v.x*=
|
|
|
p,v.y*=-w,m=0,ml=T.materials.length;else if(T instanceof THREE.RenderableLine){if(v=T.v1,z=T.v2,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(A)){T=v;var W=z,pa=Y++;N[pa]==null&&(N[pa]=document.createElementNS("http://www.w3.org/2000/svg","line"),P==0&&N[pa].setAttribute("shape-rendering","crispEdges"));O=N[pa];O.setAttribute("x1",T.positionScreen.x);
|
|
|
O.setAttribute("y1",T.positionScreen.y);O.setAttribute("x2",W.positionScreen.x);O.setAttribute("y2",W.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+J.color.getContextStyle()+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),n.appendChild(O))}}else if(T instanceof THREE.RenderableFace3){if(v=T.v1,z=T.v2,x=T.v3,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=
|
|
|
-p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),C.intersects(A)){var W=v,pa=z,na=x;e.info.render.vertices+=3;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
|
|
|
+p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),C.intersects(A)){var W=v,pa=z,na=x;e.info.render.vertices+=3;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
|
|
|
D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style",
|
|
|
"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}else if(T instanceof THREE.RenderableFace4&&(v=T.v1,z=T.v2,x=T.v3,y=T.v4,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=
|
|
|
--w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(A))){var W=v,pa=z,na=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+
|
|
|
+-w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(A))){var W=v,pa=z,na=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+
|
|
|
" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&
|
|
|
D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
@@ -249,54 +252,54 @@ h.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>
|
|
|
0,h.__webglLineCount),P.info.render.calls++):k instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),P.info.render.calls++):k instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),P.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
|
o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,k,l,n,v,p,u,t,x=a.count*3;for(t=0;t<x;t+=9)c=a.normalArray,e=c[t],f=c[t+1],h=c[t+2],k=c[t+3],n=c[t+4],p=c[t+5],l=c[t+6],v=c[t+7],u=c[t+8],e=(e+k+l)/3,f=(f+n+v)/3,h=(h+p+u)/3,c[t]=e,c[t+1]=f,c[t+2]=h,c[t+3]=e,c[t+4]=f,c[t+5]=h,c[t+6]=e,c[t+7]=f,c[t+8]=h}o.bufferData(o.ARRAY_BUFFER,
|
|
|
a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function f(a){if(pa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),pa=a.doubleSided;if(na!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),na=a.flipSided}function l(a){ja!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ja=a)}function n(a){la!==a&&(o.depthMask(a),la=a)}
|
|
|
-function u(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(ca!==b||Z!==c))o.polygonOffset(b,c),ca=b,Z=c}function t(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
|
|
|
+function u(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(ca!==b||$!==c))o.polygonOffset(b,c),ca=b,$=c}function t(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
|
|
|
a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ka[e].x*b.n14+ka[e].y*b.n24+ka[e].z*b.n34+ka[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,u,x,w,F,y=a.lights;ua||(ua=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){T=
|
|
|
--1;P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[v]||(ta[v]=new THREE.Matrix4);u=P.shadowMap[v];x=ta[v];ua.position.copy(n.position);ua.lookAt(n.target.position);ua.update(void 0,!0);a.update(void 0,!1,ua);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ua.projectionMatrix);x.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(Ea);
|
|
|
-ua.projectionMatrix.flattenToArray(Da);sa.multiply(ua.projectionMatrix,ua.matrixWorldInverse);t(sa);W(u);o.clearColor(1,1,1,1);P.clear();o.clearColor(G.r,G.g,G.b,da);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<x;u++)w=a.__webglObjects[u],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||p(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),C(F,ua,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);H(THREE.NormalBlending);for(u=0;u<x;u++)if(w=
|
|
|
-a.__webglObjects[u],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Ba:Ga,k(ua,y,null,w,buffer,F);for(u=0;u<n;u++)w=a.__webglObjectsImmediate[u],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),J=-1,C(F,ua,!1),f(F),program=e(ua,y,null,Ga,F),F.immediateRenderCallback?F.immediateRenderCallback(program,o,ka):F.render(function(a){h(a,program,Ga.shading)}));v++}}function y(a,
|
|
|
-b){var c,e,f;c=X.attributes;var h=X.uniforms,k=ma/oa,l,n=[],v=oa*0.5,u=ma*0.5,p=!0;o.useProgram(X.program);Q=X.program;J=ja=qa=-1;Ia||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,
|
|
|
-!1,Da);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,
|
|
|
-1),o.uniform3f(h.screenPosition,(f.position.x-v)/v,(u-f.position.y)/u,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?ma:1),n[0]=l*k*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),
|
|
|
-o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(la)}function C(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
|
|
|
-function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function B(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function K(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function H(a){if(a!==qa){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
|
|
|
-o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}qa=a}}function M(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,
|
|
|
-o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,$(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,$(b.minFilter)))}function V(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
|
|
|
-o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);M(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function L(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
|
|
|
-o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function W(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();
|
|
|
-if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);M(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
|
|
|
-f,e.__webglTexture,0);L(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),M(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),
|
|
|
-L(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=ma,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),aa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
|
|
|
-o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function O(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function $(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
|
|
|
-default:return o.LINEAR}}function Y(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;
|
|
|
-case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
|
|
|
-var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,na=null,qa=null,ja=null,la=null,ea=null,ca=null,Z=null,ga=0,ha=0,oa=0,ma=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-F=a.stencil!==void 0?a.stencil:!0,fa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,G=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),da=a.clearAlpha!==void 0?a.clearAlpha:0,va=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=za;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=
|
|
|
-this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ua,ta=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
|
|
|
-vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Ga._shadowPass=!0;Ba._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",{antialias:ia,stencil:F,preserveDrawingBuffer:fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}o.clearColor(0,
|
|
|
-0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(G.r,G.g,G.b,da);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);F=0;X.vertices[F++]=-1;X.vertices[F++]=-1;X.vertices[F++]=0;X.vertices[F++]=1;X.vertices[F++]=1;
|
|
|
-X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=0;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=0;F=X.vertices[F++]=0;X.faces[F++]=0;X.faces[F++]=1;X.faces[F++]=2;X.faces[F++]=0;X.faces[F++]=2;X.faces[F++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);
|
|
|
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,
|
|
|
-"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,
|
|
|
-"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;ma=e;o.viewport(ga,ha,oa,ma)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=
|
|
|
-function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){G.setHex(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.setClearColor=function(a,b){G.copy(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.getClearColor=function(){return G};this.getClearAlpha=function(){return da};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};
|
|
|
-this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);
|
|
|
-o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);P.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof
|
|
|
-THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),P.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,k,l;a instanceof THREE.MeshDepthMaterial?l="depth":
|
|
|
-a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var v,p,u;v=u=n=0;for(p=b.length;v<p;v++)k=b[v],k instanceof
|
|
|
-THREE.SpotLight&&u++,k instanceof THREE.DirectionalLight&&u++,k instanceof THREE.PointLight&&n++;n+u<=va?v=u:(v=Math.ceil(va*u/(n+u)),n=va-v);k={directional:v,point:n};n=u=0;for(v=b.length;n<v;n++)p=b[n],p instanceof THREE.SpotLight&&p.castShadow&&u++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var x;a:{v=a.fragmentShader;p=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},F,e=[];l?e.push(l):(e.push(v),e.push(p));for(F in c)e.push(F),e.push(c[F]);l=e.join();F=0;
|
|
|
-for(e=U.length;F<e;F++)if(U[F].code===l){x=U[F].program;break a}F=o.createProgram();e=[ya?"#define VERTEX_TEXTURES":"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
|
|
|
-"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,u,x,w,F,y=a.lights;va||(va=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){T=
|
|
|
+-1;P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[v]||(ta[v]=new THREE.Matrix4);u=P.shadowMap[v];x=ta[v];va.position.copy(n.position);va.lookAt(n.target.position);va.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(va));a.updateMatrixWorld();va.matrixWorldInverse.getInverse(va.matrixWorld);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,
|
|
|
+0,0,1);x.multiplySelf(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Ea);va.projectionMatrix.flattenToArray(Da);sa.multiply(va.projectionMatrix,va.matrixWorldInverse);t(sa);W(u);o.clearColor(1,1,1,1);P.clear();o.clearColor(G.r,G.g,G.b,da);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<x;u++)w=a.__webglObjects[u],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||p(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),
|
|
|
+C(F,va,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);H(THREE.NormalBlending);for(u=0;u<x;u++)if(w=a.__webglObjects[u],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Ba:Ga,k(va,y,null,w,buffer,F);for(u=0;u<n;u++)w=a.__webglObjectsImmediate[u],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),J=-1,C(F,va,!1),f(F),program=e(va,y,null,Ga,F),F.immediateRenderCallback?F.immediateRenderCallback(program,
|
|
|
+o,ka):F.render(function(a){h(a,program,Ga.shading)}));v++}}function y(a,b){var c,e,f;c=X.attributes;var h=X.uniforms,k=ma/oa,l,n=[],v=oa*0.5,u=ma*0.5,p=!0;o.useProgram(X.program);Q=X.program;J=ja=qa=-1;Ia||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
|
|
|
+8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Da);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
|
+f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-v)/v,(u-f.position.y)/u,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?ma:1),n[0]=l*k*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,
|
|
|
+f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(la)}function C(a,
|
|
|
+b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function B(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function K(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
+function H(a){if(a!==qa){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}qa=a}}function M(a,b,c){(c.width&c.width-
|
|
|
+1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)))}function V(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
+!0,a.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);M(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function L(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
+a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function W(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);M(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),
|
|
|
+null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);L(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),M(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),L(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=ma,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
+b),o.viewport(e,f,c,a),aa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function O(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
+o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
|
+case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
|
+case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,na=null,qa=null,ja=null,la=null,ea=null,ca=null,$=null,ga=0,ha=0,oa=0,ma=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),
|
|
|
+Ea=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.stencil!==void 0?a.stencil:!0,fa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,G=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),da=a.clearAlpha!==void 0?a.clearAlpha:0,ua=a.maxLights!==
|
|
|
+void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=za;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=
|
|
|
+50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var va,ta=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Ga._shadowPass=!0;Ba._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",{antialias:ia,stencil:F,
|
|
|
+preserveDrawingBuffer:fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,
|
|
|
+o.ONE_MINUS_SRC_ALPHA);o.clearColor(G.r,G.g,G.b,da);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);F=0;X.vertices[F++]=-1;X.vertices[F++]=-1;X.vertices[F++]=0;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=0;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=0;F=X.vertices[F++]=0;X.faces[F++]=0;
|
|
|
+X.faces[F++]=1;X.faces[F++]=2;X.faces[F++]=0;X.faces[F++]=2;X.faces[F++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));
|
|
|
+o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,
|
|
|
+"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,
|
|
|
+"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;ma=e;o.viewport(ga,ha,oa,ma)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){G.setHex(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.setClearColor=function(a,b){G.copy(a);da=b;o.clearColor(G.r,G.g,G.b,
|
|
|
+da)};this.getClearColor=function(){return G};this.getClearAlpha=function(){return da};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=
|
|
|
+a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=
|
|
|
+0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);P.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),
|
|
|
+P.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),P.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,k,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof
|
|
|
+THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var v,p,u;v=u=n=0;for(p=b.length;v<p;v++)k=b[v],k instanceof THREE.SpotLight&&u++,k instanceof THREE.DirectionalLight&&u++,k instanceof THREE.PointLight&&n++;n+u<=ua?v=u:(v=Math.ceil(ua*u/(n+u)),n=ua-v);k={directional:v,point:n};n=u=0;for(v=b.length;n<v;n++)p=b[n],p instanceof THREE.SpotLight&&p.castShadow&&
|
|
|
+u++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var x;a:{v=a.fragmentShader;p=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,
|
|
|
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},F,e=[];l?e.push(l):(e.push(v),e.push(p));for(F in c)e.push(F),e.push(c[F]);l=e.join();F=0;for(e=U.length;F<e;F++)if(U[F].code===l){x=U[F].program;break a}F=o.createProgram();e=[ya?"#define VERTEX_TEXTURES":"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+
|
|
|
+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(F,O("fragment",k+v));o.attachShader(F,
|
|
|
O("vertex",e+p));o.linkProgram(F);o.getProgramParameter(F,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(F,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");F.uniforms={};F.attributes={};var w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n)e.push(w);w=e;e=0;for(n=w.length;e<n;e++)v=w[e],F.uniforms[v]=o.getUniformLocation(F,
|
|
|
v);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)e.push("morphTarget"+w);for(x in b)e.push(x);x=e;w=0;for(b=x.length;w<b;w++)c=x[w],F.attributes[c]=o.getAttribLocation(F,c);F.id=U.length;U.push({program:F,code:l});P.info.memory.programs=U.length;x=F}a.program=x;x=a.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);
|
|
|
x.tangent>=0&&o.enableVertexAttribArray(x.tangent);a.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(a.attributes)for(h in a.attributes)x[h]!==void 0&&x[h]>=0&&o.enableVertexAttribArray(x[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)w="morphTarget"+h,x[w]>=0&&(o.enableVertexAttribArray(x[w]),
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,D,G,ga,L=a.lights,K=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(b.matrixAutoUpdate){for(A=b;A.parent;)A=
|
|
|
-A.parent;A.update(void 0,!0)}a.update(void 0,!1,b);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(Da);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);t(sa);W(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(D=a.__webglObjects[F],G=D.object,G.visible)if(!(G instanceof THREE.Mesh)||!G.frustumCulled||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),v(D),D.render=
|
|
|
-!0,this.sortObjects)G.renderDepth?D.z=G.renderDepth:(Ca.copy(G.position),sa.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),w(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);H(a.overrideMaterial.blending);for(F=0;F<A;F++)if(D=a.__webglObjects[F],
|
|
|
-D.render)G=D.object,ga=D.buffer,f(G),k(b,L,K,a.overrideMaterial,ga,G);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,f(G),ia=e(b,L,K,a.overrideMaterial,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,D,G,ga,L=a.lights,K=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;b.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
+a.add(b));a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(Da);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);t(sa);W(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(D=a.__webglObjects[F],G=D.object,G.visible)if(!(G instanceof THREE.Mesh)||!G.frustumCulled||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),
|
|
|
+C(G,b,!0),v(D),D.render=!0,this.sortObjects)G.renderDepth?D.z=G.renderDepth:(Ca.copy(G.position),sa.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),w(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);H(a.overrideMaterial.blending);for(F=0;F<A;F++)if(D=
|
|
|
+a.__webglObjects[F],D.render)G=D.object,ga=D.buffer,f(G),k(b,L,K,a.overrideMaterial,ga,G);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,f(G),ia=e(b,L,K,a.overrideMaterial,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,
|
|
|
fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)});for(F=0;F<A;F++)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,
|
|
|
fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
|
|
|
N(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,k=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){k=e.geometry;
|
|
@@ -313,27 +316,27 @@ l.__webglColorBuffer=o.createBuffer(),P.info.memory.geometries++,l=k,n=l.vertice
|
|
|
attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)l=k.geometryGroups[h],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
|
|
|
e instanceof THREE.ParticleSystem?(k=e.geometry,K(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)D(f.__webglObjects,
|
|
|
e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(k=f.length-1;k>=0;k--)f[k]===h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&D(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(k=a.__webglObjects[e].object,h=k.geometry,l=t=p=void 0,k instanceof THREE.Mesh){n=0;for(v=h.geometryGroupsList.length;n<v;n++)if(p=h.geometryGroupsList[n],l=c(k,p),t=l.attributes&&A(l),h.__dirtyVertices||
|
|
|
-h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!h.dynamic,p.__inittedArrays){var fa=w=x=void 0,G=void 0,C=fa=void 0,ga=void 0,L=void 0,va=void 0,N=y=ia=z=u=void 0,J=void 0,H=void 0,ha=void 0,O=void 0,R=G=va=G=L=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=C=da=R=G=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,$=0,ua=0,oa=0,X=0,Y=0,S=0,U=0,ma=I=0,ma=void 0,V=p.__vertexArray,wa=p.__uvArray,la=p.__uv2Array,
|
|
|
-aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,Z=p.__skinVertexAArray,ca=p.__skinVertexBArray,ta=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,na=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=k.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=qa.__dirtyMorphTargets,za=qa.vertices,
|
|
|
-Ya=p.faces,bb=qa.faces,Za=qa.faceVertexUvs[0],$a=qa.faceVertexUvs[1],Pa=qa.skinVerticesA,Qa=qa.skinVerticesB,Ra=qa.skinIndices,La=qa.skinWeights,Ja=qa.morphTargets;if(sa){R=0;for(da=sa.length;R<da;R++)sa[R].offset=0,sa[R].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(fa=Ya[x],G=bb[fa],Za&&(y=Za[fa]),$a&&(N=$a[fa]),fa=G.vertexNormals,C=G.normal,ga=G.vertexColors,L=G.color,va=G.vertexTangents,G instanceof THREE.Face3){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,V[Q]=J.x,V[Q+1]=J.y,
|
|
|
+h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!h.dynamic,p.__inittedArrays){var fa=w=x=void 0,G=void 0,C=fa=void 0,ga=void 0,L=void 0,ua=void 0,N=y=ia=z=u=void 0,J=void 0,H=void 0,ha=void 0,O=void 0,R=G=ua=G=L=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=C=da=R=G=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,va=0,Z=0,oa=0,X=0,Y=0,S=0,U=0,ma=I=0,ma=void 0,V=p.__vertexArray,wa=p.__uvArray,la=p.__uv2Array,
|
|
|
+aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,$=p.__skinVertexAArray,ca=p.__skinVertexBArray,ta=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,na=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=k.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=qa.__dirtyMorphTargets,za=qa.vertices,
|
|
|
+Ya=p.faces,bb=qa.faces,Za=qa.faceVertexUvs[0],$a=qa.faceVertexUvs[1],Pa=qa.skinVerticesA,Qa=qa.skinVerticesB,Ra=qa.skinIndices,La=qa.skinWeights,Ja=qa.morphTargets;if(sa){R=0;for(da=sa.length;R<da;R++)sa[R].offset=0,sa[R].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(fa=Ya[x],G=bb[fa],Za&&(y=Za[fa]),$a&&(N=$a[fa]),fa=G.vertexNormals,C=G.normal,ga=G.vertexColors,L=G.color,ua=G.vertexTangents,G instanceof THREE.Face3){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,V[Q]=J.x,V[Q+1]=J.y,
|
|
|
V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,Q+=9;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+
|
|
|
2]=E.value[ma+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c]):E.boundTo==="faces"?(ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],E.offsetSrc+=3),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=
|
|
|
H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z),E.offset+=9):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.offset+=12))}if(Ia){R=0;for(da=
|
|
|
Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z;U+=9}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=
|
|
|
-da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],Z[S]=R.x,Z[S+1]=R.y,Z[S+2]=R.z,Z[S+3]=1,Z[S+4]=da.x,Z[S+5]=da.y,Z[S+6]=da.z,Z[S+7]=1,Z[S+8]=I.x,Z[S+9]=I.y,Z[S+10]=I.z,Z[S+11]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,S+=12;if(Fa&&z)ga.length===3&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2]):
|
|
|
-da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,Y+=9;if(Ca&&qa.hasTangents)ga=va[0],L=va[1],G=va[2],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,oa+=12;if(Ka&&ia)if(fa.length===3&&Ga)for(R=0;R<3;R++)C=fa[R],aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;else for(R=0;R<3;R++)aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;if(ya&&
|
|
|
-y!==void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+2,$+=3,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+2,na[X+4]=M+1,na[X+5]=M+2,X+=6,M+=3)}else if(G instanceof THREE.Face4){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,O=za[G.d].position,V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,V[Q+9]=O.x,V[Q+10]=O.y,V[Q+
|
|
|
+da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,S+=12;if(Fa&&z)ga.length===3&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2]):
|
|
|
+da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,Y+=9;if(Ca&&qa.hasTangents)ga=ua[0],L=ua[1],G=ua[2],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,oa+=12;if(Ka&&ia)if(fa.length===3&&Ga)for(R=0;R<3;R++)C=fa[R],aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;else for(R=0;R<3;R++)aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;if(ya&&y!==
|
|
|
+void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+2,va+=3,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+2,na[X+4]=M+1,na[X+5]=M+2,X+=6,M+=3)}else if(G instanceof THREE.Face4){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,O=za[G.d].position,V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,V[Q+9]=O.x,V[Q+10]=O.y,V[Q+
|
|
|
11]=O.z,Q+=12;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c],E.array[I+3]=E.value[G.d]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.array[I+3]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+2]=E.value[ma+2],E.array[I+
|
|
|
3]=E.value[ma+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c],O=E.value[G.d]):E.boundTo==="faces"?(O=ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],O=E.value[ma+3],E.offsetSrc+=4),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.array[I+6]=O.x,E.array[I+7]=O.y,E.offset+=8):E.size===3?(E.type===
|
|
|
"c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b,E.array[I+9]=O.r,E.array[I+10]=O.g,E.array[I+11]=O.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z,E.array[I+9]=O.x,E.array[I+10]=O.y,E.array[I+11]=O.z),E.offset+=12):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,
|
|
|
E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.array[I+12]=O.x,E.array[I+13]=O.y,E.array[I+14]=O.z,E.array[I+15]=O.w,E.offset+=16))}if(Ia){R=0;for(da=Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,O=Ja[R].vertices[G.d].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z,I[U+
|
|
|
9]=O.x,I[U+10]=O.y,I[U+11]=O.z;U+=12}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],E=La[G.d],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,ja[S+12]=E.x,ja[S+13]=E.y,ja[S+14]=E.z,ja[S+15]=E.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],E=Ra[G.d],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,ta[S+12]=E.x,ta[S+13]=
|
|
|
-E.y,ta[S+14]=E.z,ta[S+15]=E.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],E=Pa[G.d],Z[S]=R.x,Z[S+1]=R.y,Z[S+2]=R.z,Z[S+3]=1,Z[S+4]=da.x,Z[S+5]=da.y,Z[S+6]=da.z,Z[S+7]=1,Z[S+8]=I.x,Z[S+9]=I.y,Z[S+10]=I.z,Z[S+11]=1,Z[S+12]=E.x,Z[S+13]=E.y,Z[S+14]=E.z,Z[S+15]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],G=Qa[G.d],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,ca[S+12]=G.x,ca[S+13]=G.y,ca[S+14]=G.z,ca[S+15]=1,S+=16;if(Fa&&z)ga.length===
|
|
|
-4&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2],ga=ga[3]):ga=da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,ea[Y+9]=ga.r,ea[Y+10]=ga.g,ea[Y+11]=ga.b,Y+=12;if(Ca&&qa.hasTangents)ga=va[0],L=va[1],G=va[2],va=va[3],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,ka[oa+12]=va.x,ka[oa+13]=va.y,ka[oa+14]=va.z,ka[oa+15]=
|
|
|
-va.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)C=fa[R],aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;else for(R=0;R<4;R++)aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+3,Ba[$+3]=M+1,Ba[$+4]=M+2,Ba[$+5]=M+3,$+=6,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+3,na[X+4]=M+1,na[X+5]=M+2,na[X+6]=M+2,na[X+7]=M+3,X+=8,M+=4)}Da&&
|
|
|
+E.y,ta[S+14]=E.z,ta[S+15]=E.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],E=Pa[G.d],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,$[S+12]=E.x,$[S+13]=E.y,$[S+14]=E.z,$[S+15]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],G=Qa[G.d],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,ca[S+12]=G.x,ca[S+13]=G.y,ca[S+14]=G.z,ca[S+15]=1,S+=16;if(Fa&&z)ga.length===
|
|
|
+4&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2],ga=ga[3]):ga=da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,ea[Y+9]=ga.r,ea[Y+10]=ga.g,ea[Y+11]=ga.b,Y+=12;if(Ca&&qa.hasTangents)ga=ua[0],L=ua[1],G=ua[2],ua=ua[3],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,ka[oa+12]=ua.x,ka[oa+13]=ua.y,ka[oa+14]=ua.z,ka[oa+15]=
|
|
|
+ua.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)C=fa[R],aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;else for(R=0;R<4;R++)aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+3,Ba[va+3]=M+1,Ba[va+4]=M+2,Ba[va+5]=M+3,va+=6,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+3,na[X+4]=M+1,na[X+5]=M+2,na[X+6]=M+2,na[X+7]=M+3,X+=8,M+=4)}Da&&
|
|
|
(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,t));if(sa){R=0;for(da=sa.length;R<da;R++)E=sa[R],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,t))}if(Ia){R=0;for(da=Ja.length;R<da;R++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[R]),o.bufferData(o.ARRAY_BUFFER,pa[R],t)}Fa&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ea,t));Ka&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),
|
|
|
o.bufferData(o.ARRAY_BUFFER,aa,t));Ca&&qa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ka,t));ya&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,t));ya&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,t));Ea&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
|
|
|
-na,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,
|
|
|
+na,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,
|
|
|
delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;l.attributes&&B(l)}else if(k instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){k=h;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=k.vertices;v=k.colors;u=w.length;p=v.length;z=k.__vertexArray;
|
|
|
t=k.__colorArray;ia=k.__dirtyColors;if(k.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){k=h;l=o.DYNAMIC_DRAW;
|
|
|
n=x=F=F=void 0;w=k.vertices;v=k.colors;u=w.length;p=v.length;z=k.__vertexArray;t=k.__colorArray;ia=k.__dirtyColors;if(k.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof
|
|
@@ -439,7 +442,7 @@ this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace
|
|
|
THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,k,h,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,k);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
|
|
|
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
|
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
|
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
@@ -449,14 +452,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
|
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
|
THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function k(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,k=b.getControlPointsArray(),l=b.getLength(),y=k.length,C=0;h=y-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<y-1;h++)C=e*l.chunks[h]/l.total,b.keys[h]={time:C,pos:k[h]};f.hierarchy[0]=
|
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,l=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*l;this.theta=this.lon*l;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
|
|
|
a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var e=a[1]-a[0];this.phi=b((c-a[0])/e)*e+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);e=a[1]-a[0];this.theta=b((c-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
|
function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=k(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=k(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),l=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,l);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);l=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,l),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
|
|
|
e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
|
|
|
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
@@ -493,14 +496,14 @@ l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0
|
|
|
1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=U*b,f=U*(b+1),h=qa+pa+e,k=qa+pa+f,o=h,e=qa+na+e,f=qa+na+f,p=k;o+=W;e+=W;f+=W;p+=W;L.faces.push(new THREE.Face4(o,e,f,p,null,null,D));D&&(o=b/c,e=(b+1)/c,f=l+n*2,h=(L.vertices[h].position.z+n)/f,k=(L.vertices[k].position.z+n)/f,L.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(k,o),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function h(a,b,c){L.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=W;b+=W;c+=W;L.faces.push(new THREE.Face3(a,
|
|
|
b,c,null,null,B));if(B){var e=K.maxY,f=K.maxX,h=L.vertices[b].position.x,b=L.vertices[b].position.y,k=L.vertices[c].position.x,c=L.vertices[c].position.y;L.faceVertexUvs[0].push([new THREE.UV(L.vertices[a].position.x/f,L.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
!0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,x=c.extrudePath,y,C=!1,A=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,K=this.shapebb;if(x)y=x.getPoints(w),v=y.length,C=!0,p=!1;p||(u=n=t=0);var H,M,V,L=this,W=this.vertices.length;z&&a.addWrapPath(z);w=A?a.extractAllSpacedPoints(w):a.extractAllPoints(w);z=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();M=0;for(V=w.length;M<V;M++)H=w[M],THREE.Shape.Utils.isClockWise(H)&&
|
|
|
-(w[M]=H.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;M=0;for(V=w.length;M<V;M++)H=w[M],z=z.concat(H);var N,O,$,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=A.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),aa[N]=e(A[N],A[pa],A[na]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){H=w[M];J=[];N=0;O=H.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),J[N]=e(H[N],H[pa],H[na]);T.push(J);ra=ra.concat(J)}for($=0;$<t;$++){Y=$/t;P=n*(1-Y);Y=
|
|
|
-u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,-P);M=0;for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),h(o.x,o.y,-P)}}Y=u;for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[0].y,y[0].x):h(o.x,o.y,0);for($=1;$<=v;$++)for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[$-1].y,y[$-1].x):h(o.x,o.y,l/v*$);for($=t-1;$>=0;$--){Y=$/t;P=n*(1-Y);Y=u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,l+P);M=0;
|
|
|
+(w[M]=H.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;M=0;for(V=w.length;M<V;M++)H=w[M],z=z.concat(H);var N,O,Z,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=A.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),aa[N]=e(A[N],A[pa],A[na]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){H=w[M];J=[];N=0;O=H.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),J[N]=e(H[N],H[pa],H[na]);T.push(J);ra=ra.concat(J)}for(Z=0;Z<t;Z++){Y=Z/t;P=n*(1-Y);Y=
|
|
|
+u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,-P);M=0;for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),h(o.x,o.y,-P)}}Y=u;for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[0].y,y[0].x):h(o.x,o.y,0);for(Z=1;Z<=v;Z++)for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[Z-1].y,y[Z-1].x):h(o.x,o.y,l/v*Z);for(Z=t-1;Z>=0;Z--){Y=Z/t;P=n*(1-Y);Y=u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,l+P);M=0;
|
|
|
for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),C?h(o.x,o.y+y[v-1].y,y[v-1].x+P):h(o.x,o.y,l+P)}}if(p){p=U*0;for(N=0;N<Q;N++)u=x[N],f(u[2]+p,u[1]+p,u[0]+p);p=U*(v+t*2);for(N=0;N<Q;N++)u=x[N],f(u[0]+p,u[1]+p,u[2]+p)}else{for(N=0;N<Q;N++)u=x[N],f(u[2],u[1],u[0]);for(N=0;N<Q;N++)u=x[N],f(u[0]+U*v,u[1]+U*v,u[2]+U*v)}var pa,na,qa=0;k(A);qa+=A.length;M=0;for(V=w.length;M<V;M++)H=w[M],k(H),qa+=H.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return k.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=k.vertices[a].position,f=k.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var k=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),u=e(h.faces[l].b,h.faces[l].c),t=e(h.faces[l].c,h.faces[l].a);b(h.faces[l].a,n,t,a);b(h.faces[l].b,u,
|
|
|
n,a);b(h.faces[l].c,t,u,a);b(n,u,t,a)}h.faces=a.faces}k.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],k=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),b[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.001;n+=c){for(l=0;l<b.length;l++)n<this.angle?(b[l]=f.multiplyVector3(b[l].clone()),this.vertices.push(new THREE.Vertex(b[l])),k[l]=this.vertices.length-1):k=h;n==0&&(h=e);
|
|
|
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],k=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),b[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(l=0;l<b.length;l++)n<this.angle?(b[l]=f.multiplyVector3(b[l].clone()),this.vertices.push(new THREE.Vertex(b[l])),k[l]=this.vertices.length-1):k=h;n==0&&(h=e);
|
|
|
for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(k[l],k[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,l/a.length),new THREE.UV(1-n/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,l/a.length)]);e=k;k=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,l){l<1?(l=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),l.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
|
|
|
f.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,l),h(b.uv,b.position,l),h(c.uv,c.position,l)])):(l-=1,e(a,k(a,b),k(a,c),l),e(k(a,b),b,k(b,c),l),e(k(a,c),k(b,c),c,l),e(k(a,b),k(b,c),k(a,c),l))}function k(a,c){l[a.index]||(l[a.index]=[]);l[c.index]||(l[c.index]=[]);var e=l[a.index][c.index];e===void 0&&(l[a.index][c.index]=l[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
|
|
@@ -519,7 +522,7 @@ this.getFace(),b=this.size/c.resolution,e=0,k=String(a).split(""),h=k.length,f=[
|
|
|
u));k.moveTo(l,u);break;case "l":l=c[a++]*b+e;u=c[a++]*b;h.push(new THREE.Vector2(l,u));k.lineTo(l,u);break;case "q":l=c[a++]*b+e;u=c[a++]*b;w=c[a++]*b+e;v=c[a++]*b;k.quadraticCurveTo(w,v,l,u);if(f=h[h.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var C=f/divisions,A=THREE.Shape.Utils.b2(C,t,w,l),C=THREE.Shape.Utils.b2(C,p,v,u);h.push(new THREE.Vector2(A,C))}}break;case "b":if(l=c[a++]*b+e,u=c[a++]*b,w=c[a++]*b+e,v=c[a++]*-b,z=c[a++]*b+e,x=c[a++]*-b,k.bezierCurveTo(l,u,
|
|
|
w,v,z,x),f=h[h.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)C=f/divisions,A=THREE.Shape.Utils.b3(C,t,w,z,l),C=THREE.Shape.Utils.b3(C,p,v,x,u),h.push(new THREE.Vector2(A,C))}}}return{offset:y.ha*b,points:h,path:k}}}};
|
|
|
(function(a){var c=function(a){for(var c=a.length,k=0,h=c-1,f=0;f<c;h=f++)k+=a[h].x*a[f].y-a[f].x*a[h].y;return k*0.5};a.Triangulate=function(a,e){var k=a.length;if(k<3)return null;var h=[],f=[],l=[],n,u,t;if(c(a)>0)for(u=0;u<k;u++)f[u]=u;else for(u=0;u<k;u++)f[u]=k-1-u;var p=2*k;for(u=k-1;k>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=u;k<=n&&(n=0);u=n+1;k<=u&&(u=0);t=u+1;k<=t&&(t=0);var w;a:{w=a;var v=n,z=u,x=t,y=k,C=f,A=void 0,B=void 0,D=void 0,
|
|
|
-K=void 0,H=void 0,M=void 0,V=void 0,L=void 0,W=void 0,B=w[C[v]].x,D=w[C[v]].y,K=w[C[z]].x,H=w[C[z]].y,M=w[C[x]].x,V=w[C[x]].y;if(1.0E-10>(K-B)*(V-D)-(H-D)*(M-B))w=!1;else{for(A=0;A<y;A++)if(!(A==v||A==z||A==x)){var L=w[C[A]].x,W=w[C[A]].y,N=void 0,O=void 0,$=void 0,Y=void 0,P=void 0,o=void 0,U=void 0,Q=void 0,aa=void 0,T=void 0,J=void 0,ra=void 0,N=$=P=void 0,N=M-K,O=V-H,$=B-M,Y=D-V,P=K-B,o=H-D,U=L-B,Q=W-D,aa=L-K,T=W-H,J=L-M,ra=W-V,N=N*T-O*aa,P=P*Q-o*U,$=$*ra-Y*J;if(N>=0&&$>=0&&P>=0){w=!1;break a}}w=
|
|
|
+K=void 0,H=void 0,M=void 0,V=void 0,L=void 0,W=void 0,B=w[C[v]].x,D=w[C[v]].y,K=w[C[z]].x,H=w[C[z]].y,M=w[C[x]].x,V=w[C[x]].y;if(1.0E-10>(K-B)*(V-D)-(H-D)*(M-B))w=!1;else{for(A=0;A<y;A++)if(!(A==v||A==z||A==x)){var L=w[C[A]].x,W=w[C[A]].y,N=void 0,O=void 0,Z=void 0,Y=void 0,P=void 0,o=void 0,U=void 0,Q=void 0,aa=void 0,T=void 0,J=void 0,ra=void 0,N=Z=P=void 0,N=M-K,O=V-H,Z=B-M,Y=D-V,P=K-B,o=H-D,U=L-B,Q=W-D,aa=L-K,T=W-H,J=L-M,ra=W-V,N=N*T-O*aa,P=P*Q-o*U,Z=Z*ra-Y*J;if(N>=0&&Z>=0&&P>=0){w=!1;break a}}w=
|
|
|
!0}}if(w){h.push([a[f[n]],a[f[u]],a[f[t]]]);l.push([f[n],f[u],f[t]]);n=u;for(t=u+1;t<k;n++,t++)f[n]=f[t];k--;p=2*k}}if(e)return l;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,c,b,e,k){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=k||Math.PI*2;k=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;k.x=this.radius*Math.cos(h);k.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);l.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(l.clone().subSelf(k).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var k=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,l=(this.segmentsT+1)*b+e,n=new THREE.Face4(k,h,f,l,[c[k],c[h],c[f],c[l]]);n.normal.addSelf(c[k]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[l]);n.normal.normalize();this.faces.push(n);
|
|
@@ -549,18 +552,18 @@ c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,k,h){var f=new XMLHttpRequest,l=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,k,c):alert("Couldn't load ["+l+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",l,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=t(a,b),h=t(a,b+1),f=t(a,b+2),k=t(a,b+3),l=(k<<1&255|f>>7)-127;e|=(f&127)<<16|h<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),h=t(a,b+2);return(t(a,b+3)<<24)+(h<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function u(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
|
-e,h;c=k(a,b);e=k(a,b+H);h=k(a,b+M);b=n(a,b+V);C.faces.push(new THREE.Face3(c,e,h,null,null,b))}function w(b){var c,e,h,f,o,p,u;c=k(a,b);e=k(a,b+H);h=k(a,b+M);f=n(a,b+V);o=k(a,b+L);p=k(a,b+W);u=k(a,b+N);var b=D[p*3],t=D[p*3+1];p=D[p*3+2];var v=D[u*3],x=D[u*3+1];u=D[u*3+2];C.faces.push(new THREE.Face3(c,e,h,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,t,p),new THREE.Vector3(v,x,u)],null,f))}function v(b){var c,e,h,f;c=k(a,b);e=k(a,b+O);h=k(a,b+$);f=k(a,b+Y);b=n(a,b+P);C.faces.push(new THREE.Face4(c,
|
|
|
-e,h,f,null,null,b))}function z(b){var c,e,h,f,p,u,t,v,x;c=k(a,b);e=k(a,b+O);h=k(a,b+$);f=k(a,b+Y);p=n(a,b+P);u=k(a,b+o);t=k(a,b+U);v=k(a,b+Q);x=k(a,b+aa);var b=D[t*3],w=D[t*3+1];t=D[t*3+2];var F=D[v*3],y=D[v*3+1];v=D[v*3+2];var ia=D[x*3],G=D[x*3+1];x=D[x*3+2];C.faces.push(new THREE.Face4(c,e,h,f,[new THREE.Vector3(D[u*3],D[u*3+1],D[u*3+2]),new THREE.Vector3(b,w,t),new THREE.Vector3(F,y,v),new THREE.Vector3(ia,G,x)],null,p))}function x(b){var c,e,h,f;c=k(a,b);e=k(a,b+T);h=k(a,b+J);b=K[c*2];f=K[c*2+
|
|
|
+e,h;c=k(a,b);e=k(a,b+H);h=k(a,b+M);b=n(a,b+V);C.faces.push(new THREE.Face3(c,e,h,null,null,b))}function w(b){var c,e,h,f,o,p,u;c=k(a,b);e=k(a,b+H);h=k(a,b+M);f=n(a,b+V);o=k(a,b+L);p=k(a,b+W);u=k(a,b+N);var b=D[p*3],t=D[p*3+1];p=D[p*3+2];var v=D[u*3],x=D[u*3+1];u=D[u*3+2];C.faces.push(new THREE.Face3(c,e,h,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,t,p),new THREE.Vector3(v,x,u)],null,f))}function v(b){var c,e,h,f;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);b=n(a,b+P);C.faces.push(new THREE.Face4(c,
|
|
|
+e,h,f,null,null,b))}function z(b){var c,e,h,f,p,u,t,v,x;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);p=n(a,b+P);u=k(a,b+o);t=k(a,b+U);v=k(a,b+Q);x=k(a,b+aa);var b=D[t*3],w=D[t*3+1];t=D[t*3+2];var F=D[v*3],y=D[v*3+1];v=D[v*3+2];var ia=D[x*3],G=D[x*3+1];x=D[x*3+2];C.faces.push(new THREE.Face4(c,e,h,f,[new THREE.Vector3(D[u*3],D[u*3+1],D[u*3+2]),new THREE.Vector3(b,w,t),new THREE.Vector3(F,y,v),new THREE.Vector3(ia,G,x)],null,p))}function x(b){var c,e,h,f;c=k(a,b);e=k(a,b+T);h=k(a,b+J);b=K[c*2];f=K[c*2+
|
|
|
1];c=K[e*2];var n=C.faceVertexUvs[0];e=K[e*2+1];var o=K[h*2];h=K[h*2+1];var p=[];p.push(new THREE.UV(b,f));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,h));n.push(p)}function y(b){var c,e,h,f,n,o;c=k(a,b);e=k(a,b+ra);h=k(a,b+pa);f=k(a,b+na);b=K[c*2];n=K[c*2+1];c=K[e*2];o=K[e*2+1];e=K[h*2];var p=C.faceVertexUvs[0];h=K[h*2+1];var u=K[f*2];f=K[f*2+1];var t=[];t.push(new THREE.UV(b,n));t.push(new THREE.UV(c,o));t.push(new THREE.UV(e,h));t.push(new THREE.UV(u,f));p.push(t)}var C=this,A=0,B,D=[],K=[],
|
|
|
-H,M,V,L,W,N,O,$,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea,ca,Z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:k(a,A+16),nnormals:k(a,A+16+4),nuvs:k(a,A+16+8),ntri_flat:k(a,A+16+12),ntri_smooth:k(a,A+16+16),ntri_flat_uv:k(a,
|
|
|
-A+16+20),ntri_smooth_uv:k(a,A+16+24),nquad_flat:k(a,A+16+28),nquad_smooth:k(a,A+16+32),nquad_flat_uv:k(a,A+16+36),nquad_smooth_uv:k(a,A+16+40)};A+=B.header_bytes;H=B.vertex_index_bytes;M=B.vertex_index_bytes*2;V=B.vertex_index_bytes*3;L=B.vertex_index_bytes*3+B.material_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;N=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;O=B.vertex_index_bytes;$=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;P=B.vertex_index_bytes*
|
|
|
-4;o=B.vertex_index_bytes*4+B.material_index_bytes;U=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Q=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;T=B.uv_index_bytes;J=B.uv_index_bytes*2;ra=B.uv_index_bytes;pa=B.uv_index_bytes*2;na=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;Z=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;ja=B.ntri_smooth*(b+B.normal_index_bytes*
|
|
|
-3);la=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ea=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*Z;b=B.nquad_smooth*(Z+B.normal_index_bytes*4);Z=B.nquad_flat_uv*(Z+B.uv_index_bytes*4);A+=function(b){for(var e,h,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return B.nvertices*l}(A);A+=function(b){for(var c,e,h,f=B.normal_coordinate_bytes*
|
|
|
-3,k=b+B.nnormals*f;b<k;b+=f)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),h=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,h/127);return B.nnormals*f}(A);A+=function(b){for(var e,h,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+B.uv_coordinate_bytes),K.push(e,h);return B.nuvs*k}(A);qa=A+qa;ja=qa+ja;la=ja+la;ea=la+ea;ca=ea+ca;b=ca+b;Z=b+Z;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,h=a+B.ntri_flat_uv*e;for(b=a;b<h;b+=e)p(b),x(b+c);
|
|
|
+H,M,V,L,W,N,O,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea,ca,$;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:k(a,A+16),nnormals:k(a,A+16+4),nuvs:k(a,A+16+8),ntri_flat:k(a,A+16+12),ntri_smooth:k(a,A+16+16),ntri_flat_uv:k(a,
|
|
|
+A+16+20),ntri_smooth_uv:k(a,A+16+24),nquad_flat:k(a,A+16+28),nquad_smooth:k(a,A+16+32),nquad_flat_uv:k(a,A+16+36),nquad_smooth_uv:k(a,A+16+40)};A+=B.header_bytes;H=B.vertex_index_bytes;M=B.vertex_index_bytes*2;V=B.vertex_index_bytes*3;L=B.vertex_index_bytes*3+B.material_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;N=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;O=B.vertex_index_bytes;Z=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;P=B.vertex_index_bytes*
|
|
|
+4;o=B.vertex_index_bytes*4+B.material_index_bytes;U=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Q=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;T=B.uv_index_bytes;J=B.uv_index_bytes*2;ra=B.uv_index_bytes;pa=B.uv_index_bytes*2;na=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;$=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;ja=B.ntri_smooth*(b+B.normal_index_bytes*
|
|
|
+3);la=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ea=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*$;b=B.nquad_smooth*($+B.normal_index_bytes*4);$=B.nquad_flat_uv*($+B.uv_index_bytes*4);A+=function(b){for(var e,h,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return B.nvertices*l}(A);A+=function(b){for(var c,e,h,f=B.normal_coordinate_bytes*
|
|
|
+3,k=b+B.nnormals*f;b<k;b+=f)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),h=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,h/127);return B.nnormals*f}(A);A+=function(b){for(var e,h,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+B.uv_coordinate_bytes),K.push(e,h);return B.nuvs*k}(A);qa=A+qa;ja=qa+ja;la=ja+la;ea=la+ea;ca=ea+ca;b=ca+b;$=b+$;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,h=a+B.ntri_flat_uv*e;for(b=a;b<h;b+=e)p(b),x(b+c);
|
|
|
return h-a})(ja);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,h=a+B.ntri_smooth_uv*e;for(b=a;b<h;b+=e)w(b),x(b+c);return h-a})(la);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,h=a+B.nquad_flat_uv*e;for(b=a;b<h;b+=e)v(b),y(b+c);return h-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,h=a+B.nquad_smooth_uv*e;for(b=a;b<
|
|
|
-h;b+=e)z(b),y(b+c);return h-a})(Z);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(A);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(qa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ea);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
+h;b+=e)z(b),y(b+c);return h-a})($);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(A);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(qa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ea);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k(b))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");sa=c("//dae:library_effects/dae:effect",$,"effect");ma=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");sa=c("//dae:library_effects/dae:effect",Z,"effect");ma=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
t,"visual_scene");Ca=[];Fa=[];(a=ja.evaluate(".//dae:scene/dae:instance_visual_scene",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Da[a]):ea=null;la=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)la.add(h(ea.nodes[a]));b();for(var n in ha);n={scene:la,morphs:Ca,skins:Fa,dae:{images:ga,materials:ka,effects:sa,geometries:ma,controllers:oa,animations:ha,visualScenes:Da,scene:ea}};e&&e(n);return n}function c(a,b,c){for(var a=ja.evaluate(a,
|
|
|
ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new b).parse(h);if(h.id.length==0)h.id=c+f++;e[h.id]=h;h=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ha)for(var h=ha[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,h){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
|
|
|
a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);b.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],b,c,a.world)}function k(a,c,h){var f=oa[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ea.getChildById(c.skeleton[0],!0)||ea.getChildBySid(c.skeleton[0],!0),l,n,o,p,u=new THREE.Vector3,
|
|
@@ -573,10 +576,10 @@ else{p=p.morph;for(u=0;u<p.targets.length;u++){var w=ma[p.targets[u]];if(w.mesh&
|
|
|
b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function w(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function C(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function B(){this.material="";this.count=
|
|
|
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function H(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function V(){this.name=this.id="";this.instance_effect=null}function L(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function W(a,
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function N(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function $(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
-this.dotSyntax=this.sid=null}function U(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Q(a){var b=a.getAttribute("id");if(Z[b]!=void 0)return Z[b];Z[b]=(new M(b)).parse(a);return Z[b]}function aa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function T(a){for(var a=ra(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function J(a){for(var a=ra(a),b=[],c=0;c<
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function N(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
+this.dotSyntax=this.sid=null}function U(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Q(a){var b=a.getAttribute("id");if($[b]!=void 0)return $[b];$[b]=(new M(b)).parse(a);return $[b]}function aa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function T(a){for(var a=ra(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function J(a){for(var a=ra(a),b=[],c=0;c<
|
|
|
a.length;c++)b.push(parseInt(a[c],10));return b}function ra(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function pa(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function na(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function qa(a,b){var c="";c+=na(a.x,b)+",";c+=na(a.y,b)+",";c+=na(a.z,b);return c}var ja=null,la=null,ea,ca=
|
|
|
-null,Z={},ga={},ha={},oa={},ma={},ka={},sa={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
|
|
|
+null,$={},ga={},ha={},oa={},ma={},ka={},sa={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
|
|
|
c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var h=a.childNodes[e];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);b[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],h=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new H).parse(e))}}return b};u.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<a.childNodes.length;h++){var f=a.childNodes[h];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
T(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new M).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};u.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
@@ -593,9 +596,9 @@ w.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.t
|
|
|
this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ja.evaluate(".//dae:instance_material",c,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ja.evaluate(".//dae:instance_material",
|
|
|
c,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new C(this)).parse(c)}}return this};C.prototype.parse=function(a){function b(a,c){var e=qa(a.position);h[e]===void 0&&(h[e]={v:a,index:c});return h[e]}this.primitives=[];var c;for(c=
|
|
|
-0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Q(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new B).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=Z[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
+0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Q(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new B).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=$[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};C.prototype.handlePrimitive=function(a,b,c){var e=0,h,f,k=a.p,l=a.inputs,n,o,p,u=0,t=3,v=[];for(h=0;h<l.length;h++)switch(n=l[h],
|
|
|
-n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(t=a.vcount[u++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(n=l[f],source=Z[n.source],o=k[e+h*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=qa(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
|
|
|
+n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(t=a.vcount[u++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(n=l[f],source=$[n.source],o=k[e+h*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=qa(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
|
|
|
source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var A;t==3?A=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):t==4&&(A=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));A.daeMaterial=a.material;b.faces.push(A);for(f=0;f<v.length;f++)h=y[v[f]],b.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};A.prototype=new B;A.prototype.constructor=A;B.prototype.setVertices=
|
|
|
function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};B.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=pa(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new H).parse(a.childNodes[b]));break;case "vcount":this.vcount=J(c.textContent);break;case "p":this.p=J(c.textContent)}}return this};D.prototype.parse=
|
|
|
function(a){this.params=[];this.source=a.getAttribute("source");this.count=pa(a,"count",0);this.stride=pa(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new H).parse(a.childNodes[b]),this.input[input.semantic]=
|
|
@@ -607,9 +610,9 @@ this.texcoord=c.getAttribute("texcoord")}}return this};W.prototype.parse=functio
|
|
|
e=f;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};W.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof L)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
|
|
|
a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=za;return this.material=new THREE.MeshLambertMaterial(a)};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
|
|
|
c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
|
|
|
-break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};$.prototype.create=function(){if(this.shader==null)return null};$.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};$.prototype.parseNewparam=
|
|
|
-function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new N(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};$.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};$.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new W(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
+break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Z.prototype.create=function(){if(this.shader==null)return null};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Z.prototype.parseNewparam=
|
|
|
+function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new N(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};Z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};Z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new W(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new U(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){h=a.split("(");a=h.shift();for(b=0;b<h.length;b++)h[b]=parseInt(h[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new H).parse(c))}}return this};
|
|
|
U.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
@@ -626,17 +629,17 @@ THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.pos
|
|
|
s=A.scale;q=0;W.length==0&&(W=new THREE.MeshFaceMaterial);W.length>1&&(W=new THREE.MeshFaceMaterial);object=new THREE.Mesh(H,W);object.name=v;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;Q.scene.add(object);Q.objects[v]=object;A.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(a));if(A.castsShadow)a=
|
|
|
new THREE.ShadowVolume(H),Q.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},Q.triggers[object.name]=a)}}else B=A.position,r=A.rotation,q=A.quaternion,s=A.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
A.visible!==void 0?A.visible:!1,Q.scene.add(object),Q.objects[v]=object,Q.empties[v]=object,A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},Q.triggers[object.name]=a)}function n(a){return function(c){Q.geometries[a]=c;l();Y-=1;b.onLoadComplete();t()}}function u(a){return function(b){Q.geometries[a]=b}}function t(){b.callbackProgress({totalModels:o,totalTextures:U,loadedModels:o-Y,loadedTextures:U-P},Q);b.onLoadProgress();Y==0&&P==0&&c(Q)}var p,w,v,z,x,y,C,A,B,D,K,H,M,V,L,
|
|
|
-W,N,O,$,Y,P,o,U,Q;O=a.data;L=new THREE.BinaryLoader;$=new THREE.JSONLoader;P=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in O.objects)if(A=O.objects[v],A.meshCollider){a=!0;break}if(a)Q.scene.collisions=new THREE.CollisionSystem;if(O.transform){a=O.transform.position;D=O.transform.rotation;var aa=O.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);D&&Q.scene.rotation.set(D[0],D[1],D[2]);aa&&Q.scene.scale.set(aa[0],
|
|
|
+W,N,O,Z,Y,P,o,U,Q;O=a.data;L=new THREE.BinaryLoader;Z=new THREE.JSONLoader;P=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in O.objects)if(A=O.objects[v],A.meshCollider){a=!0;break}if(a)Q.scene.collisions=new THREE.CollisionSystem;if(O.transform){a=O.transform.position;D=O.transform.rotation;var aa=O.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);D&&Q.scene.rotation.set(D[0],D[1],D[2]);aa&&Q.scene.scale.set(aa[0],
|
|
|
aa[1],aa[2]);(a||D||aa)&&Q.scene.updateMatrix()}a=function(){P-=1;t();b.onLoadComplete()};for(x in O.cameras)D=O.cameras[x],D.type=="perspective"?M=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(M=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),B=D.position,D=D.target,M.position.set(B[0],B[1],B[2]),M.target=new THREE.Vector3(D[0],D[1],D[2]),Q.cameras[x]=M;for(z in O.lights)x=O.lights[z],M=x.color!==void 0?x.color:16777215,D=x.intensity!==void 0?
|
|
|
x.intensity:1,x.type=="directional"?(B=x.direction,N=new THREE.DirectionalLight(M,D),N.position.set(B[0],B[1],B[2]),N.position.normalize()):x.type=="point"?(B=x.position,d=x.distance,N=new THREE.PointLight(M,D,d),N.position.set(B[0],B[1],B[2])):x.type=="ambient"&&(N=new THREE.AmbientLight(M)),Q.scene.add(N),Q.lights[z]=N;for(y in O.fogs)z=O.fogs[y],z.type=="linear"?V=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(V=new THREE.FogExp2(0,z.density)),D=z.color,V.color.setRGB(D[0],D[1],D[2]),Q.fogs[y]=
|
|
|
V;if(Q.cameras&&O.defaults.camera)Q.currentCamera=Q.cameras[O.defaults.camera];if(Q.fogs&&O.defaults.fog)Q.scene.fog=Q.fogs[O.defaults.fog];D=O.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(D[0],D[1],D[2]);Q.bgColorAlpha=O.defaults.bgalpha;for(p in O.geometries)if(y=O.geometries[p],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,b.onLoadStart();o=Y;for(p in O.geometries)y=O.geometries[p],y.type=="cube"?(H=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,
|
|
|
y.segmentsDepth,null,y.flipped,y.sides),Q.geometries[p]=H):y.type=="plane"?(H=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),Q.geometries[p]=H):y.type=="sphere"?(H=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),Q.geometries[p]=H):y.type=="cylinder"?(H=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),Q.geometries[p]=H):y.type=="torus"?(H=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),Q.geometries[p]=H):
|
|
|
-y.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(y.subdivisions),Q.geometries[p]=H):y.type=="bin_mesh"?L.load(e(y.url,O.urlBaseType),n(p)):y.type=="ascii_mesh"?$.load(e(y.url,O.urlBaseType),n(p)):y.type=="embedded_mesh"&&(y=O.embeds[y.id])&&$.createModel(y,u(p),"");for(C in O.textures)if(p=O.textures[C],p.url instanceof Array){P+=p.url.length;for(L=0;L<p.url.length;L++)b.onLoadStart()}else P+=1,b.onLoadStart();U=P;for(C in O.textures){p=O.textures[C];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
+y.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(y.subdivisions),Q.geometries[p]=H):y.type=="bin_mesh"?L.load(e(y.url,O.urlBaseType),n(p)):y.type=="ascii_mesh"?Z.load(e(y.url,O.urlBaseType),n(p)):y.type=="embedded_mesh"&&(y=O.embeds[y.id])&&Z.createModel(y,u(p),"");for(C in O.textures)if(p=O.textures[C],p.url instanceof Array){P+=p.url.length;for(L=0;L<p.url.length;L++)b.onLoadStart()}else P+=1,b.onLoadStart();U=P;for(C in O.textures){p=O.textures[C];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){L=[];for(var T=0;T<p.url.length;T++)L[T]=e(p.url[T],O.urlBaseType);L=THREE.ImageUtils.loadTextureCube(L,p.mapping,a)}else{L=THREE.ImageUtils.loadTexture(e(p.url,O.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)L.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)L.magFilter=THREE[p.magFilter];if(p.repeat){L.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)L.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)L.wrapT=THREE.RepeatWrapping}p.offset&&
|
|
|
-L.offset.set(p.offset[0],p.offset[1]);if(p.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[p.wrap[0]]!==void 0)L.wrapS=$[p.wrap[0]];if($[p.wrap[1]]!==void 0)L.wrapT=$[p.wrap[1]]}}Q.textures[C]=L}for(w in O.materials){C=O.materials[w];for(K in C.parameters)if(K=="envMap"||K=="map"||K=="lightMap")C.parameters[K]=Q.textures[C.parameters[K]];else if(K=="shading")C.parameters[K]=C.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")C.parameters[K]=
|
|
|
+L.offset.set(p.offset[0],p.offset[1]);if(p.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[p.wrap[0]]!==void 0)L.wrapS=Z[p.wrap[0]];if(Z[p.wrap[1]]!==void 0)L.wrapT=Z[p.wrap[1]]}}Q.textures[C]=L}for(w in O.materials){C=O.materials[w];for(K in C.parameters)if(K=="envMap"||K=="map"||K=="lightMap")C.parameters[K]=Q.textures[C.parameters[K]];else if(K=="shading")C.parameters[K]=C.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")C.parameters[K]=
|
|
|
THREE[C.parameters[K]]?THREE[C.parameters[K]]:THREE.NormalBlending;else if(K=="combine")C.parameters[K]=C.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(C.parameters[K]=="face")C.parameters[K]=THREE.FaceColors;else if(C.parameters[K])C.parameters[K]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=!0;if(C.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
|
-L=C.parameters.color;$=C.parameters.specular;y=C.parameters.ambient;V=C.parameters.shininess;a.tNormal.texture=Q.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)a.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)a.tDiffuse.texture=C.parameters.map,a.enableDiffuse.value=!0;if(C.parameters.lightMap)a.tAO.texture=C.parameters.lightMap,a.enableAO.value=!0;if(C.parameters.specularMap)a.tSpecular.texture=Q.textures[C.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
-a.uDiffuseColor.value.setHex(L);a.uSpecularColor.value.setHex($);a.uAmbientColor.value.setHex(y);a.uShininess.value=V;if(C.parameters.opacity)a.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);Q.materials[w]=C}l();b.callbackSync(Q);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
+L=C.parameters.color;Z=C.parameters.specular;y=C.parameters.ambient;V=C.parameters.shininess;a.tNormal.texture=Q.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)a.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)a.tDiffuse.texture=C.parameters.map,a.enableDiffuse.value=!0;if(C.parameters.lightMap)a.tAO.texture=C.parameters.lightMap,a.enableAO.value=!0;if(C.parameters.specularMap)a.tSpecular.texture=Q.textures[C.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
+a.uDiffuseColor.value.setHex(L);a.uSpecularColor.value.setHex(Z);a.uAmbientColor.value.setHex(y);a.uShininess.value=V;if(C.parameters.opacity)a.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);Q.materials[w]=C}l();b.callbackSync(Q);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,k=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,l=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
c,k,h,f,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,k=0;k<8;k++){for(var h=0,f=0;f<c;++f){var l=a.charCodeAt(f+e);h+=l>>1^-(l&1);b[8*f+k]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(k=f=0;k<c;k++)l=a.charCodeAt(k+e),h[k]=f-l,l==0&&f++;return[b,h]};
|
|
@@ -700,7 +703,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,k=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,l=new THREE.Matrix4,n,u,t;k.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.PerspectiveCamera(53,1,1,1E4);v.position.z=
|
|
|
2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
-var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);p.width=a;p.height=e;w.width=a;w.height=e};this.render=function(a,b){b.update(null,!0);if(n!==b.aspect||u!==b.near||t!==b.fov){n=b.aspect;u=b.near;t=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,B=A*u/125,D=u*Math.tan(t*Math.PI/360),K;f.n14=A;l.n14=-A;A=-D*n+B;K=D*n+B;C.n11=2*u/(K-A);C.n13=(K+A)/(K-A);k.projectionMatrix=C.clone();A=-D*n-B;K=D*n-B;C.n11=2*u/(K-A);C.n13=
|
|
|
-(K+A)/(K-A);h.projectionMatrix=C.clone()}k.matrix=b.matrixWorld.clone().multiplySelf(l);k.update(null,!0);k.position.copy(b.position);k.near=u;k.far=b.far;e.call(c,a,k,p,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=u;h.far=b.far;e.call(c,a,h,w,!0);e.call(c,z,v)}};
|
|
|
+var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);p.width=a;p.height=e;w.width=a;w.height=e};this.render=function(a,b){if(n!==b.aspect||u!==b.near||t!==b.fov){n=b.aspect;u=b.near;t=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,B=A*u/125,D=u*Math.tan(t*Math.PI/360),K;f.n14=A;l.n14=-A;A=-D*n+B;K=D*n+B;C.n11=2*u/(K-A);C.n13=(K+A)/(K-A);k.projectionMatrix=C.clone();A=-D*n-B;K=D*n-B;C.n11=2*u/(K-A);C.n13=(K+A)/(K-A);h.projectionMatrix=
|
|
|
+C.clone()}k.matrix=b.matrixWorld.clone().multiplySelf(l);k.position.copy(b.position);k.near=u;k.far=b.far;e.call(c,a,k,p,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.position.copy(b.position);h.near=u;h.far=b.far;e.call(c,a,h,w,!0);e.call(c,z,v)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,k,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);k=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);l.projectionMatrix=f.projectionMatrix;l.position.copy(b.position);l.target.copy(b.target);l.translateX(-c.separation);l.lookAt(l.target);this.setViewport(0,0,k,h);e.call(c,a,f);this.setViewport(k,0,k,h);e.call(c,a,l,!1)}};
|