|
@@ -12,7 +12,7 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLengt
|
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(G,v,H,o){o=o.clone().subSelf(v);H=H.clone().subSelf(v);var M=G.clone().subSelf(v);G=o.dot(o);v=o.dot(H);o=o.dot(M);var e=H.dot(H);H=H.dot(M);M=1/(G*e-v*v);e=(e*o-v*H)*M;G=(G*H-v*o)*M;return e>0&&G>0&&e+G<1}var c,d,f,g,h,k,j,m,n,w,
|
|
|
-u,p=a.geometry,x=p.vertices,A=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());n=u.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,w))/n;w=w.addSelf(u.multiplyScalar(m));if(f instanceof
|
|
|
+u,p=a.geometry,x=p.vertices,A=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());n=u.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,w))/n;w=w.addSelf(u.multiplyScalar(m));if(f instanceof
|
|
|
THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
|
|
|
THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,n,w){k=!1;b=j;c=m;d=n;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
|
|
|
this.add3Points=function(j,m,n,w,u,p){if(k){k=!1;b=j<n?j<u?j:u:n<u?n:u;c=m<w?m<p?m:p:w<p?w:p;d=j>n?j>u?j:u:n>u?n:u;f=m>w?m>p?m:p:w>p?w:p}else{b=j<n?j<u?j<b?j:b:u<b?u:b:n<u?n<b?n:b:u<b?u:b;c=m<w?m<p?m<c?m:c:p<c?p:c:w<p?w<c?w:c:p<c?p:c;d=j>n?j>u?j>d?j:d:u>d?u:d:n>u?n>d?n:d:u>d?u:d;f=m>w?m>p?m>f?m:f:p>f?p:f:w>p?w>f?w:f:p>f?p:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
@@ -41,11 +41,11 @@ b.n24=f*m*n-g*j*n+g*h*u-c*m*u-f*h*p+c*j*p;b.n31=k*p*x-m*w*x+m*n*A-h*p*A-k*n*v+h*
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*w;return b};
|
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
|
|
|
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
|
|
|
-1;this.visible=!0};
|
|
|
-THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
|
|
|
-this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
|
|
|
-Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotation=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
|
+!0};
|
|
|
+THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);this.matrix.n11=this.matrixRotation.n11;this.matrix.n12=
|
|
|
+this.matrixRotation.n12;this.matrix.n13=this.matrixRotation.n13;this.matrix.n21=this.matrixRotation.n21;this.matrix.n22=this.matrixRotation.n22;this.matrix.n23=this.matrixRotation.n23;this.matrix.n31=this.matrixRotation.n31;this.matrix.n32=this.matrixRotation.n32;this.matrix.n33=this.matrixRotation.n33;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))}return!0},update:function(a,b,
|
|
|
+c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
|
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;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);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
|
|
|
multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,n=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+n*-k-w*-h;b.y=n*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-n*-g;return b},slerp:function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-
|
|
@@ -77,9 +77,9 @@ THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hie
|
|
|
THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=
|
|
|
0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
-this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
|
|
|
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.near)return!1;if(h+g<-this.far)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
|
|
|
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
|
|
|
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
|
|
|
+THREE.Camera.prototype.frustumContains=function(a){var b=a.matrixWorld.n14,c=a.matrixWorld.n24,d=a.matrixWorld.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.near)return!1;if(h+g<-this.far)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
|
|
|
if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(n,b,h,g);return!0};function bind(a,b){return function(){b.apply(a,arguments)}}
|
|
|
THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movement_speed=1;this.look_speed=0.005;this.nofly=!1;this.look_vertical=!0;this.domElement=document;if(a){if(a.movement_speed!==undefined)this.movement_speed=a.movement_speed;if(a.look_speed!==undefined)this.look_speed=a.look_speed;if(a.nofly!==undefined)this.nofly=a.nofly;if(a.look_vertical!==undefined)this.look_vertical=a.look_vertical;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=
|
|
|
this.phy=this.lon=this.lat=this.mouseY=this.mouseX=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=
|
|
@@ -129,11 +129,11 @@ var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=0;d<
|
|
|
-f;d++)this.children[d].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
|
|
|
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];d=this.bones[c];
|
|
|
f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
|
|
|
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}}};
|
|
|
THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
|
|
@@ -142,15 +142,15 @@ THREE.Sound3D=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.
|
|
|
-1)f="audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound3D=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound3D.prototype=new THREE.Object3D;THREE.Sound3D.prototype.constructor=THREE.Sound3D;THREE.Sound3D.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Sound3D.prototype.onLoad=function(){var a=this.THREESound3D;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound3D.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound3D.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};
|
|
|
THREE.Sound3D.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};THREE.Sound3D.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound3D.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
|
|
|
-THREE.Sound3D.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.localMatrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;
|
|
|
+THREE.Sound3D.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;
|
|
|
THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
|
|
|
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
|
|
|
THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
|
|
|
THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
THREE.Projector=function(){function a(O,P){return P.z-O.z}function b(O,P){var V=0,S=1,Z=O.z+O.w,ea=P.z+P.w,J=-O.z+O.w,$=-P.z+P.w;if(Z>=0&&ea>=0&&J>=0&&$>=0)return!0;else if(Z<0&&ea<0||J<0&&$<0)return!1;else{if(Z<0)V=Math.max(V,Z/(Z-ea));else ea<0&&(S=Math.min(S,Z/(Z-ea)));if(J<0)V=Math.max(V,J/(J-$));else $<0&&(S=Math.min(S,J/(J-$)));if(S<V)return!1;else{O.lerpSelf(P,V);P.lerpSelf(O,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],u,p,x=[],A=new THREE.Vector4,G=new THREE.Vector4,v=new THREE.Matrix4,
|
|
|
-H=new THREE.Matrix4,o=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,e=new THREE.Vector4,da;this.projectObjects=function(O,P,V){P=[];var S,Z,ea;d=0;Z=O.objects;O=0;for(S=Z.length;O<S;O++){ea=Z[O];var J;if(!(J=!ea.visible))if(J=ea instanceof THREE.Mesh){a:{J=void 0;for(var $=ea.globalMatrix,ta=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),aa=0;aa<6;aa++){J=o[aa].x*$.n14+o[aa].y*
|
|
|
-$.n24+o[aa].z*$.n34+o[aa].w;if(J<=ta){J=!1;break a}}J=!0}J=!J}if(!J){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ea.position);v.multiplyVector3(A);c.object=ea;c.z=A.z;P.push(c);d++}}V&&P.sort(a);return P};this.projectScene=function(O,P,V){var S=[],Z=P.near,ea=P.far,J,$,ta,aa,la,ia,ga,ua,xa,l,y,B,q,t,E,C;k=n=p=0;P.matrixAutoUpdate&&P.update();v.multiply(P.projectionMatrix,P.globalMatrix);o[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);o[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+
|
|
|
-v.n14);o[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);o[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);o[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);o[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(J=0;J<6;J++){ia=o[J];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,P);ia=this.projectObjects(O,P,!0);O=0;for(J=ia.length;O<J;O++){ga=ia[O].object;if(ga.visible){ga.matrixAutoUpdate&&ga.updateMatrix();ua=ga.globalMatrix;y=ga.matrixRotation;
|
|
|
+H=new THREE.Matrix4,o=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,e=new THREE.Vector4,da;this.projectObjects=function(O,P,V){P=[];var S,Z,ea;d=0;Z=O.objects;O=0;for(S=Z.length;O<S;O++){ea=Z[O];var J;if(!(J=!ea.visible))if(J=ea instanceof THREE.Mesh){a:{J=void 0;for(var $=ea.matrixWorld,ta=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),aa=0;aa<6;aa++){J=o[aa].x*$.n14+o[aa].y*
|
|
|
+$.n24+o[aa].z*$.n34+o[aa].w;if(J<=ta){J=!1;break a}}J=!0}J=!J}if(!J){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ea.position);v.multiplyVector3(A);c.object=ea;c.z=A.z;P.push(c);d++}}V&&P.sort(a);return P};this.projectScene=function(O,P,V){var S=[],Z=P.near,ea=P.far,J,$,ta,aa,la,ia,ga,ua,xa,l,y,B,q,t,E,C;k=n=p=0;P.matrixAutoUpdate&&P.update();v.multiply(P.projectionMatrix,P.matrixWorld);o[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);o[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+
|
|
|
+v.n14);o[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);o[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);o[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);o[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(J=0;J<6;J++){ia=o[J];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,P);ia=this.projectObjects(O,P,!0);O=0;for(J=ia.length;O<J;O++){ga=ia[O].object;if(ga.visible){ga.matrixAutoUpdate&&ga.updateMatrix();ua=ga.matrixWorld;y=ga.matrixRotation;
|
|
|
xa=ga.materials;l=ga.overdraw;if(ga instanceof THREE.Mesh){B=ga.geometry;q=B.vertices;$=0;for(ta=q.length;$<ta;$++){t=q[$];t.positionWorld.copy(t.position);ua.multiplyVector3(t.positionWorld);aa=t.positionScreen;aa.copy(t.positionWorld);v.multiplyVector4(aa);aa.x/=aa.w;aa.y/=aa.w;t.__visible=aa.z>Z&&aa.z<ea}B=B.faces;$=0;for(ta=B.length;$<ta;$++){t=B[$];if(t instanceof THREE.Face3){aa=q[t.a];la=q[t.b];E=q[t.c];if(aa.__visible&&la.__visible&&E.__visible&&(ga.doubleSided||ga.flipSided!=(E.positionScreen.x-
|
|
|
aa.positionScreen.x)*(la.positionScreen.y-aa.positionScreen.y)-(E.positionScreen.y-aa.positionScreen.y)*(la.positionScreen.x-aa.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(aa.positionWorld);g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(aa.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(t.normal);y.multiplyVector3(g.normalWorld);
|
|
|
g.centroidWorld.copy(t.centroid);ua.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=t.vertexNormals;da=g.vertexNormalsWorld;aa=0;for(la=E.length;aa<la;aa++){C=da[aa]=da[aa]||new THREE.Vector3;C.copy(E[aa]);y.multiplyVector3(C)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=t.materials;g.overdraw=l;if(ga.geometry.uvs[$]){g.uvs[0]=ga.geometry.uvs[$][0];g.uvs[1]=ga.geometry.uvs[$][1];g.uvs[2]=ga.geometry.uvs[$][2]}S.push(g);k++}}else if(t instanceof
|
|
@@ -159,7 +159,7 @@ g.v1.positionWorld.copy(aa.positionWorld);g.v2.positionWorld.copy(la.positionWor
|
|
|
xa;g.faceMaterials=t.materials;g.overdraw=l;if(ga.geometry.uvs[$]){g.uvs[0]=ga.geometry.uvs[$][0];g.uvs[1]=ga.geometry.uvs[$][1];g.uvs[2]=ga.geometry.uvs[$][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(la.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(C.positionWorld);h.v1.positionScreen.copy(la.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(C.positionScreen);h.normalWorld.copy(g.normalWorld);
|
|
|
h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=t.materials;h.overdraw=l;if(ga.geometry.uvs[$]){h.uvs[0]=ga.geometry.uvs[$][1];h.uvs[1]=ga.geometry.uvs[$][2];h.uvs[2]=ga.geometry.uvs[$][3]}S.push(h);k++}}}}else if(ga instanceof THREE.Line){H.multiply(v,ua);q=ga.geometry.vertices;t=q[0];t.positionScreen.copy(t.position);H.multiplyVector4(t.positionScreen);$=1;for(ta=q.length;$<ta;$++){aa=q[$];aa.positionScreen.copy(aa.position);
|
|
|
H.multiplyVector4(aa.positionScreen);la=q[$-1];M.copy(aa.positionScreen);e.copy(la.positionScreen);if(b(M,e)){M.multiplyScalar(1/M.w);e.multiplyScalar(1/e.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(M);m.v2.positionScreen.copy(e);m.z=Math.max(M.z,e.z);m.materials=ga.materials;S.push(m);n++}}}else if(ga instanceof THREE.Particle){G.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){u=x[p]=x[p]||new THREE.RenderableParticle;u.x=G.x/
|
|
|
-G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(G.x+P.projectionMatrix.n11)/(G.w+P.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(G.y+P.projectionMatrix.n22)/(G.w+P.projectionMatrix.n24));u.materials=ga.materials;S.push(u);p++}}}}V&&S.sort(a);return S};this.unprojectVector=function(O,P){var V=THREE.Matrix4.makeInvert(P.globalMatrix);V.multiplySelf(THREE.Matrix4.makeInvert(P.projectionMatrix));V.multiplyVector3(O);return O}};
|
|
|
+G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(G.x+P.projectionMatrix.n11)/(G.w+P.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(G.y+P.projectionMatrix.n22)/(G.w+P.projectionMatrix.n24));u.materials=ga.materials;S.push(u);p++}}}}V&&S.sort(a);return S};this.unprojectVector=function(O,P){var V=THREE.Matrix4.makeInvert(P.matrixWorld);V.multiplySelf(THREE.Matrix4.makeInvert(P.projectionMatrix));V.multiplyVector3(O);return O}};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,u,p,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;A=u.y*g+g;n=0;for(w=u.material.length;n<w;n++){p=u.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=x+"px";p.style.top=A+"px"}}}}}};
|
|
|
THREE.CanvasRenderer=function(){function a(ha){if(u!=ha)m.globalAlpha=u=ha}function b(ha){if(p!=ha){switch(ha){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=ha}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,u=1,p=0,x=null,A=null,G=1,v,H,o,M,e,da,O,P,V,S=new THREE.Color,
|
|
|
Z=new THREE.Color,ea=new THREE.Color,J=new THREE.Color,$=new THREE.Color,ta,aa,la,ia,ga,ua,xa,l,y,B=new THREE.Rectangle,q=new THREE.Rectangle,t=new THREE.Rectangle,E=!1,C=new THREE.Color,I=new THREE.Color,L=new THREE.Color,z=new THREE.Color,D=Math.PI*2,F=new THREE.Vector3,T,Q,fa,ka,qa,na,ma=16;T=document.createElement("canvas");T.width=T.height=2;Q=T.getContext("2d");Q.fillStyle="rgba(0,0,0,1)";Q.fillRect(0,0,2,2);fa=Q.getImageData(0,0,2,2);ka=fa.data;qa=document.createElement("canvas");qa.width=
|
|
@@ -169,7 +169,7 @@ W[K];U=ba.color;if(ba instanceof THREE.AmbientLight){I.r+=U.r;I.g+=U.g;I.b+=U.b}
|
|
|
ja);F.normalize();pa=ba.dot(F)*Ea;if(pa>0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}}}function Ha(K,ja,ba){if(ba.opacity!=0){a(ba.opacity);b(ba.blending);var U,W,pa,Da,Ea,Ia;if(ba instanceof THREE.ParticleBasicMaterial){if(ba.map){Da=ba.map.image;Ea=Da.width>>1;Ia=Da.height>>1;W=ja.scale.x*k;pa=ja.scale.y*j;ba=W*Ea;U=pa*Ia;t.set(K.x-ba,K.y-U,K.x+ba,K.y+U);if(B.instersects(t)){m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(W,-pa);m.translate(-Ea,-Ia);m.drawImage(Da,0,0);m.restore()}}}else if(ba instanceof
|
|
|
THREE.ParticleCircleMaterial){if(E){C.r=I.r+L.r+z.r;C.g=I.g+L.g+z.g;C.b=I.b+L.b+z.b;S.r=ba.color.r*C.r;S.g=ba.color.g*C.g;S.b=ba.color.b*C.b;S.updateStyleString()}else S.__styleString=ba.color.__styleString;ba=ja.scale.x*k;U=ja.scale.y*j;t.set(K.x-ba,K.y-U,K.x+ba,K.y+U);if(B.instersects(t)){W=S.__styleString;if(A!=W)m.fillStyle=A=W;m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(ba,U);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function La(K,ja,ba,U){if(U.opacity!=
|
|
|
0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ja.positionScreen.x,ja.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){S.__styleString=U.color.__styleString;K=U.linewidth;if(G!=K)m.lineWidth=G=K;K=S.__styleString;if(x!=K)m.strokeStyle=x=K;m.stroke();t.inflate(U.linewidth*2)}}}function ca(K,ja,ba,U,W,pa){if(W.opacity!=0){a(W.opacity);b(W.blending);M=K.positionScreen.x;e=K.positionScreen.y;da=ja.positionScreen.x;O=ja.positionScreen.y;
|
|
|
-P=ba.positionScreen.x;V=ba.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(da,O);m.lineTo(P,V);m.lineTo(M,e);m.closePath();if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(W.env_map){if(W.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.globalMatrix;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;ga=-(F.x*
|
|
|
+P=ba.positionScreen.x;V=ba.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(da,O);m.lineTo(P,V);m.lineTo(M,e);m.closePath();if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(W.env_map){if(W.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.matrixWorld;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;ga=-(F.x*
|
|
|
K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ua=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;ra(M,e,da,O,P,V,W.env_map.image,ia,ga,ua,xa,l,y)}}else W.wireframe?X(W.color.__styleString,W.wireframe_linewidth):Y(W.color.__styleString);else if(W instanceof THREE.MeshLambertMaterial){if(W.map&&!W.wireframe){W.map.mapping instanceof
|
|
|
THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!W.wireframe&&W.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){Z.r=ea.r=J.r=I.r;Z.g=ea.g=J.g=I.g;Z.b=ea.b=J.b=I.b;Ga(pa,U.v1.positionWorld,U.vertexNormalsWorld[0],Z);Ga(pa,U.v2.positionWorld,U.vertexNormalsWorld[1],ea);Ga(pa,U.v3.positionWorld,U.vertexNormalsWorld[2],J);$.r=(ea.r+J.r)*0.5;$.g=(ea.g+J.g)*0.5;$.b=(ea.b+J.b)*0.5;la=Ja(Z,ea,
|
|
|
J,$);ra(M,e,da,O,P,V,la,0,0,1,0,0,1)}else{C.r=I.r;C.g=I.g;C.b=I.b;Ga(pa,U.centroidWorld,U.normalWorld,C);S.r=W.color.r*C.r;S.g=W.color.g*C.g;S.b=W.color.b*C.b;S.updateStyleString();W.wireframe?X(S.__styleString,W.wireframe_linewidth):Y(S.__styleString)}else W.wireframe?X(W.color.__styleString,W.wireframe_linewidth):Y(W.color.__styleString)}else if(W instanceof THREE.MeshDepthMaterial){ta=Ca.near;aa=Ca.far;Z.r=Z.g=Z.b=1-Aa(K.positionScreen.z,ta,aa);ea.r=ea.g=ea.b=1-Aa(ja.positionScreen.z,ta,aa);J.r=
|
|
@@ -194,7 +194,7 @@ document.createElementNS("http://www.w3.org/2000/svg","line");la==0&&ea[C].setAt
|
|
|
E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(J)}}}}else if(t instanceof THREE.RenderableFace3){u=t.v1;p=t.v2;x=t.v3;u.positionScreen.x*=n;u.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(v)){l=0;for(y=t.meshMaterials.length;l<y;){E=t.meshMaterials[l++];if(E instanceof
|
|
|
THREE.MeshFaceMaterial){B=0;for(q=t.faceMaterials.length;B<q;)(E=t.faceMaterials[B++])&&b(u,p,x,t,E,ia)}else E&&b(u,p,x,t,E,ia)}}}else if(t instanceof THREE.RenderableFace4){u=t.v1;p=t.v2;x=t.v3;A=t.v4;u.positionScreen.x*=n;u.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;A.positionScreen.x*=n;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,
|
|
|
x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(v)){l=0;for(y=t.meshMaterials.length;l<y;){E=t.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(q=t.faceMaterials.length;B<q;)(E=t.faceMaterials[B++])&&c(u,p,x,A,t,E,ia)}else E&&c(u,p,x,A,t,E,ia)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(l,y,B){var q,t,E,C=l.vertices,I=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,fa=l.__dirtyColors;if(B.sortParticles){$.multiplySelf(B.globalMatrix);for(q=0;q<I;q++){t=C[q].position;ia.copy(t);$.multiplyVector3(ia);T[q]=[ia.z,q]}T.sort(function(ka,qa){return qa[0]-ka[0]});for(q=0;q<I;q++){t=C[T[q][1]].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}for(q=0;q<z;q++){E=q*3;color=L[T[q][1]];F[E]=color.r;F[E+
|
|
|
+THREE.WebGLRenderer=function(a){function b(l,y,B){var q,t,E,C=l.vertices,I=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,fa=l.__dirtyColors;if(B.sortParticles){$.multiplySelf(B.matrixWorld);for(q=0;q<I;q++){t=C[q].position;ia.copy(t);$.multiplyVector3(ia);T[q]=[ia.z,q]}T.sort(function(ka,qa){return qa[0]-ka[0]});for(q=0;q<I;q++){t=C[T[q][1]].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}for(q=0;q<z;q++){E=q*3;color=L[T[q][1]];F[E]=color.r;F[E+
|
|
|
1]=color.g;F[E+2]=color.b}}else{if(Q)for(q=0;q<I;q++){t=C[q].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}if(fa)for(q=0;q<z;q++){color=L[q];E=q*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(fa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
|
|
|
Uniforms.clone(y.uniforms)}function d(l,y,B,q,t){q.program||P.initMaterial(q,y,B);var E=q.program,C=E.uniforms,I=q.uniforms;if(E!=da){e.useProgram(E);da=E;e.uniformMatrix4fv(C.projectionMatrix,!1,ta)}if(B&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){I.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){I.fogNear.value=B.near;I.fogFar.value=
|
|
|
B.far}else if(B instanceof THREE.FogExp2)I.fogDensity.value=B.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,fa,ka,qa=P.lights,na=qa.directional.colors,ma=qa.directional.positions,ha=qa.point.colors,Ca=qa.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;fa=z.position;ka=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;na[z]=Q.r*ka;na[z+1]=
|
|
@@ -214,29 +214,29 @@ if(q.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>
|
|
|
THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else E instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}function g(l,y){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.position);e.vertexAttribPointer(y.attributes.position,
|
|
|
3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.normal);e.vertexAttribPointer(y.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(ea!=
|
|
|
l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ea=l}}function j(l){J[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);J[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);J[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);J[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);J[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);J[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var y;for(l=0;l<6;l++){y=J[l];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}
|
|
|
-function m(l){for(var y=l.globalMatrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),q=0;q<6;q++){l=J[q].x*y.n14+J[q].y*y.n24+J[q].z*y.n34+J[q].w;if(l<=B)return!1}return!0}function n(l,y){l.list[l.count]=y;l.count+=1}function w(l){var y,B,q=l.object,t=l.opaque,E=l.transparent;E.count=0;l=t.count=0;for(y=q.materials.length;l<y;l++){B=q.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?n(E,B):n(t,B)}}function u(l){var y,B,q,t,E=l.object,C=
|
|
|
-l.buffer,I=l.opaque,L=l.transparent;L.count=0;l=I.count=0;for(q=E.materials.length;l<q;l++){y=E.materials[l];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=C.materials.length;y<B;y++)(t=C.materials[y])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t))}else{t=y;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t)}}}function p(l,y){return y.z-l.z}function x(l,y,B,q,t){if(y[B]==undefined){l.push({buffer:q,object:t,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
-count:0}});y[B]=1}}function A(l,y){l._modelViewMatrix.multiplyToArray(y.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function G(l){if(l!=Z){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
|
|
|
-break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Z=l}}function v(l,y){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,
|
|
|
-l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,o(l.format),l.width,l.height,0,o(l.format),o(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);
|
|
|
-e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,q,t;if(l){B=l.__webGLFramebuffer;q=l.width;t=l.height}else{B=null;q=M.width;t=M.height}if(B!=O){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,q,t);y&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=B}}function H(l,y){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l==
|
|
|
-"vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,y);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function o(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
|
|
|
-case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
|
|
|
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),e,da=null,O=null,P=this,V=null,S=null,Z=null,ea=null,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],$=new THREE.Matrix4,ta=new Float32Array(16),aa=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,ga=
|
|
|
-!0,ua=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(q){console.log(q)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
|
|
|
-e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(ga,ua,xa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
|
|
|
-e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,y,B){var q,t;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
|
|
|
-THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,I,L;t=I=L=0;for(E=y.length;t<E;t++){C=y[t];C instanceof THREE.DirectionalLight&&I++;C instanceof THREE.PointLight&&L++}if(L+I<=4)y=I;else{y=Math.ceil(4*I/(L+I));L=4-y}t={directional:y,point:L};L=l.fragment_shader;y=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};B=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
|
|
-"#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
|
-E.maxPointLights,E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+function m(l){for(var y=l.matrixWorld,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),q=0;q<6;q++){l=J[q].x*y.n14+J[q].y*y.n24+J[q].z*y.n34+J[q].w;if(l<=B)return!1}return!0}function n(l,y){l.list[l.count]=y;l.count+=1}function w(l){var y,B,q=l.object,t=l.opaque,E=l.transparent;E.count=0;l=t.count=0;for(y=q.materials.length;l<y;l++){B=q.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?n(E,B):n(t,B)}}function u(l){var y,B,q,t,E=l.object,C=l.buffer,
|
|
|
+I=l.opaque,L=l.transparent;L.count=0;l=I.count=0;for(q=E.materials.length;l<q;l++){y=E.materials[l];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=C.materials.length;y<B;y++)(t=C.materials[y])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t))}else{t=y;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t)}}}function p(l,y){return y.z-l.z}function x(l,y,B,q,t){if(y[B]==undefined){l.push({buffer:q,object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});
|
|
|
+y[B]=1}}function A(l,y){l._modelViewMatrix.multiplyToArray(y.matrixWorld,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function G(l){if(l!=Z){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);
|
|
|
+e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Z=l}}function v(l,y){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,
|
|
|
+o(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,o(l.format),l.width,l.height,0,o(l.format),o(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,
|
|
|
+l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,q,t;if(l){B=l.__webGLFramebuffer;q=l.width;t=l.height}else{B=null;q=M.width;t=M.height}if(B!=O){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,q,t);y&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=B}}function H(l,y){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,y);e.compileShader(B);
|
|
|
+if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function o(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;
|
|
|
+case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;
|
|
|
+case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),e,da=null,O=null,P=this,V=null,S=null,Z=null,ea=null,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],$=new THREE.Matrix4,ta=new Float32Array(16),aa=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,ga=!0,ua=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);
|
|
|
+if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(q){console.log(q)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(ga,ua,xa);this.context=
|
|
|
+e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,y,B){var q,t;if(l instanceof THREE.MeshDepthMaterial)c(l,
|
|
|
+THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,I,L;t=I=L=0;for(E=y.length;t<
|
|
|
+E;t++){C=y[t];C instanceof THREE.DirectionalLight&&I++;C instanceof THREE.PointLight&&L++}if(L+I<=4)y=I;else{y=Math.ceil(4*I/(L+I));L=4-y}t={directional:y,point:L};L=l.fragment_shader;y=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};B=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
|
+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",
|
|
|
+E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
e.attachShader(B,H("fragment",t+L));e.attachShader(B,H("vertex",E+y));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(q in l.uniforms)B.push(q);q=l.program;L=0;for(y=B.length;L<
|
|
|
y;L++){t=B[L];q.uniforms[t]=e.getUniformLocation(q,t)}q=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];L=0;for(y=B.length;L<y;L++){t=B[L];q.attributes[t]=e.getAttribLocation(q,t)}q=l.program.attributes;e.enableVertexAttribArray(q.position);q.color>=0&&e.enableVertexAttribArray(q.color);q.normal>=0&&e.enableVertexAttribArray(q.normal);q.tangent>=0&&e.enableVertexAttribArray(q.tangent);if(l.skinning&&q.skinVertexA>=0&&q.skinVertexB>=
|
|
|
-0&&q.skinIndex>=0&&q.skinWeight>=0){e.enableVertexAttribArray(q.skinVertexA);e.enableVertexAttribArray(q.skinVertexB);e.enableVertexAttribArray(q.skinIndex);e.enableVertexAttribArray(q.skinWeight)}};this.render=function(l,y,B,q){var t,E,C,I,L,z,D,F,T=l.lights,Q=l.fog;y.matrixAutoUpdate&&y.update();y.globalMatrix.flattenToArray(la);y.projectionMatrix.flattenToArray(ta);y.inverseMatrix.flattenToArray(aa);$.multiply(y.projectionMatrix,y.globalMatrix);j($);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
-l.update(undefined,!1,y);this.initWebGLObjects(l,y);v(B,q!==undefined?q:!0);this.autoClear&&this.clear();L=l.__webGLObjects.length;for(q=0;q<L;q++){t=l.__webGLObjects[q];D=t.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);u(t);t.render=!0;if(this.sortObjects){ia.copy(D.position);$.multiplyVector3(ia);t.z=ia.z}}else t.render=!1;else t.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);z=l.__webGLObjectsImmediate.length;for(q=0;q<
|
|
|
-z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){D.matrixAutoUpdate&&D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);w(t)}}G(THREE.NormalBlending);for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,
|
|
|
+0&&q.skinIndex>=0&&q.skinWeight>=0){e.enableVertexAttribArray(q.skinVertexA);e.enableVertexAttribArray(q.skinVertexB);e.enableVertexAttribArray(q.skinIndex);e.enableVertexAttribArray(q.skinWeight)}};this.render=function(l,y,B,q){var t,E,C,I,L,z,D,F,T=l.lights,Q=l.fog;y.matrixAutoUpdate&&y.update();y.matrixWorld.flattenToArray(la);y.projectionMatrix.flattenToArray(ta);y.inverseMatrix.flattenToArray(aa);$.multiply(y.projectionMatrix,y.matrixWorld);j($);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
+l.update(undefined,!1,y);this.initWebGLObjects(l,y);v(B,q!==undefined?q:!0);this.autoClear&&this.clear();L=l.__webGLObjects.length;for(q=0;q<L;q++){t=l.__webGLObjects[q];D=t.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);u(t);t.render=!0;if(this.sortObjects){ia.copy(D.position);$.multiplyVector3(ia);t.z=ia.z}}else t.render=!1;else t.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);z=l.__webGLObjectsImmediate.length;for(q=0;q<
|
|
|
+z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);w(t)}}G(THREE.NormalBlending);for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,
|
|
|
E)})}}}for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depth_test);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depth_test);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
|
|
|
e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l,y){var B,q,t;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}B=0;for(q=l.objects.length;B<q;B++){t=l.objects[B];var E=l,C=y,I=void 0,L=void 0,z=void 0,D=void 0;L=t.geometry;if(E.__webGLObjectsMap[t.id]==undefined){E.__webGLObjectsMap[t.id]={};t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);
|
|
|
-t._objectMatrixArray=new Float32Array(16);t.globalMatrix.flattenToArray(t._objectMatrixArray)}D=E.__webGLObjectsMap[t.id];objlist=E.__webGLObjects;if(t instanceof THREE.Mesh){for(I in L.geometryChunks){z=L.geometryChunks[I];if(!z.__webGLVertexBuffer){C=z;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=
|
|
|
+t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}D=E.__webGLObjectsMap[t.id];objlist=E.__webGLObjects;if(t instanceof THREE.Mesh){for(I in L.geometryChunks){z=L.geometryChunks[I];if(!z.__webGLVertexBuffer){C=z;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=
|
|
|
e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=z;var F=t,T=void 0,Q=void 0,fa=0,ka=E=0,qa=F.geometry.faces,na=C.faces;T=0;for(Q=na.length;T<Q;T++){fi=na[T];face=qa[fi];if(face instanceof THREE.Face3){fa+=3;E+=1;ka+=3}else if(face instanceof THREE.Face4){fa+=4;E+=2;ka+=4}}C.__vertexArray=new Float32Array(fa*3);C.__normalArray=
|
|
|
new Float32Array(fa*3);C.__tangentArray=new Float32Array(fa*4);C.__colorArray=new Float32Array(fa*3);C.__uvArray=new Float32Array(fa*2);C.__uv2Array=new Float32Array(fa*2);C.__skinVertexAArray=new Float32Array(fa*4);C.__skinVertexBArray=new Float32Array(fa*4);C.__skinIndexArray=new Float32Array(fa*4);C.__skinWeightArray=new Float32Array(fa*4);C.__faceArray=new Uint16Array(E*3);C.__lineArray=new Uint16Array(ka*2);Q=T=C;fa=void 0;qa=void 0;var ma=void 0,ha=void 0;ma=void 0;na=!1;fa=0;for(qa=F.materials.length;fa<
|
|
|
qa;fa++){ma=F.materials[fa];if(ma instanceof THREE.MeshFaceMaterial){ma=0;for(ha=Q.materials.length;ma<ha;ma++)if(Q.materials[ma]&&Q.materials[ma].shading!=undefined&&Q.materials[ma].shading==THREE.SmoothShading){na=!0;break}}else if(ma&&ma.shading!=undefined&&ma.shading==THREE.SmoothShading){na=!0;break}if(na)break}T.__needsSmoothNormals=na;C.__webGLFaceCount=E*3;C.__webGLLineCount=ka*2;L.__dirtyVertices=!0;L.__dirtyElements=!0;L.__dirtyUvs=!0;L.__dirtyNormals=!0;L.__dirtyTangents=!0;L.__dirtyColors=
|
|
@@ -280,10 +280,10 @@ THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightW
|
|
|
THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
|
|
THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
|
|
|
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.globalMatrix.n14,a.globalMatrix.n24,a.globalMatrix.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var u=new THREE.Vertex(h[n].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}n=0;for(w=j.length;n<w;n++){h=j[n];var p,x=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+
|
|
|
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var u=new THREE.Vertex(h[n].position.clone());c&&b.matrix.multiplyVector3(u.position);g.push(u)}n=0;for(w=j.length;n<w;n++){h=j[n];var p,x=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+
|
|
|
d,h.b+d,h.c+d,h.d+d));p.centroid.copy(h.centroid);p.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];p.vertexNormals.push(u.clone())}p.materials=h.materials.slice();k.push(p)}n=0;for(w=f.length;n<w;n++){d=f[n];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
|
|
|
b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(n in O.objects)if(!J.objects[n]){A=O.objects[n];if(o=J.geometries[A.geometry]){da=[];for(i=0;i<A.materials.length;i++)da[i]=J.materials[A.materials[i]];G=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(o,da);object.position.set(G[0],
|
|
|
G[1],G[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;J.scene.addObject(object);J.objects[n]=object}}}function h($){return function(ta){J.geometries[$]=ta;g();V-=1;k()}}function k(){d({total_models:Z,total_textures:ea,loaded_models:Z-V,loaded_textures:ea-S},J);V==0&&S==0&&c(J)}var j,m,n,w,u,p,x,A,G,v,H,o,M,e,da,O,P,V,S,Z,ea,J;O=f.data;P=new THREE.Loader;S=V=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
|