|
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;thi
|
|
|
e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
|
multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,g=this.w,f=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+g*f+d*k-e*j;this.y=d*b+g*j+e*f-c*k;this.z=e*b+g*k+c*j-d*f;this.w=g*b-c*f-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,g=b.z,f=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*g-k*e,o=
|
|
|
m*e+k*d-f*g,p=m*g+f*e-j*d,d=-f*d-j*e-k*g;c.x=n*m+d*-f+o*-k-p*-j;c.y=o*m+d*-j+p*-f-n*-k;c.z=p*m+d*-k+n*-j-o*-f;return c}};
|
|
|
-THREE.Quaternion.slerp=function(b,c,d,e){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var f=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;g=Math.sin((1-e)*f)/j;e=Math.sin(e*f)/j;d.w=b.w*g+c.w*e;d.x=b.x*g+c.x*e;d.y=b.y*g+c.y*e;d.z=b.z*g+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(b,c,d,e){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var f=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;g=Math.sin((1-e)*f)/j;e=Math.sin(e*f)/j;d.w=b.w*g+c.w*e;d.x=b.x*g+c.x*e;d.y=b.y*g+c.y*e;d.z=b.z*g+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,c,d,e,g,f){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,d,e,g,f,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
@@ -256,7 +256,7 @@ h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!o?(h.
|
|
|
xa||(h.enableVertexAttribArray(M.attributes.vertex),h.enableVertexAttribArray(M.attributes.uv),xa=!0);h.uniform1i(x.occlusionMap,0);h.uniform1i(x.map,1);h.bindBuffer(h.ARRAY_BUFFER,M.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,M.elementBuffer);h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,M.occlusionTexture);h.activeTexture(h.TEXTURE1);for(e=0;e<f;e++)if(c=
|
|
|
b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,y[0]=v[0]*p+p,y[1]=v[1]*o+o,M.hasVertexTexture||y[0]>0&&y[0]<ha&&y[1]>0&&y[1]<ea){h.bindTexture(h.TEXTURE_2D,M.tempTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,y[0]-8,y[1]-8,16,16,0);h.uniform1i(x.renderType,0);h.uniform2fv(x.scale,u);h.uniform3fv(x.screenPosition,v);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);
|
|
|
h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,M.occlusionTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,y[0]-8,y[1]-8,16,16,0);h.uniform1i(x.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,M.tempTexture);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);c.positionScreen.x=v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();h.uniform1i(x.renderType,2);h.enable(h.BLEND);g=0;for(j=c.lensFlares.length;g<
|
|
|
-j;g++)if(k=c.lensFlares[g],k.opacity>0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ea,u[0]=t*n,u[1]=t,h.uniform3fv(x.screenPosition,v),h.uniform2fv(x.scale,u),h.uniform1f(x.rotation,k.rotation),h.uniform1f(x.opacity,k.opacity),H(k.blending),A(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(J)}function B(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+j;g++)if(k=c.lensFlares[g],k.opacity>0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ea,u[0]=t*n,u[1]=t,h.uniform3fv(x.screenPosition,v),h.uniform2fv(x.scale,u),h.uniform1f(x.rotation,k.rotation),h.uniform1f(x.opacity,k.opacity),H(k.blending),A(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(J)}function B(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
function y(b){var d,e,f,g,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(g in f.__webglCustomAttributes)if(f.__webglCustomAttributes[g].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=h.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,n=void 0,p=void 0,o=void 0,t=p=void 0,u=void 0,v=void 0,y=void 0,x=void 0,z=void 0,B=void 0,
|
|
|
G=void 0,Z=void 0,A=void 0,D=void 0,F=void 0,H=void 0,E=o=y=o=v=u=void 0,C=void 0,w=C=E=u=void 0,ja=void 0,L=w=C=E=p=p=t=y=o=w=C=E=ja=w=C=E=ja=w=C=E=void 0,fa=0,J=0,M=0,ma=0,O=0,S=0,K=0,Q=0,N=0,I=0,P=0,C=E=0,V=f.__vertexArray,aa=f.__uvArray,$=f.__uv2Array,ga=f.__normalArray,R=f.__tangentArray,W=f.__colorArray,U=f.__skinVertexAArray,ia=f.__skinVertexBArray,X=f.__skinIndexArray,Y=f.__skinWeightArray,ha=f.__morphTargetsArrays,ea=f.__webglCustomAttributes,w=void 0,ca=f.__faceArray,da=f.__lineArray,ka=
|
|
|
f.__needsSmoothNormals,z=f.__vertexColorType,x=f.__uvType,B=f.__normalType,oa=j.geometry,za=oa.__dirtyVertices,wa=oa.__dirtyElements,qa=oa.__dirtyUvs,xa=oa.__dirtyNormals,Va=oa.__dirtyTangents,Wa=oa.__dirtyColors,Xa=oa.__dirtyMorphTargets,Ea=oa.vertices,Za=f.faces,bb=oa.faces,$a=oa.faceVertexUvs[0],ab=oa.faceVertexUvs[1],Fa=oa.skinVerticesA,Ga=oa.skinVerticesB,Ha=oa.skinIndices,ya=oa.skinWeights,Ca=j instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,va=oa.morphTargets;if(ea)for(L in ea)ea[L].offset=
|
|
@@ -377,7 +377,7 @@ this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=g,this.points[2]=f,thi
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],g,f,j,k,m,n;g=(b.length-1)*c;f=Math.floor(g);g-=f;d[0]=f==0?f:f-1;d[1]=f;d[2]=f>b.length-2?f:f+1;d[3]=f>b.length-3?f:f+2;f=b[d[0]];k=b[d[1]];m=b[d[2]];n=b[d[3]];d=g*g;j=g*d;e[0]=this.interpolate(f[0],k[0],m[0],n[0],g,d,j);e[1]=this.interpolate(f[1],k[1],m[1],n[1],g,d,j);e[2]=this.interpolate(f[2],k[2],m[2],n[2],g,d,j);return e};
|
|
|
THREE.Animation.prototype.interpolate=function(b,c,d,e,g,f,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*f+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
|
|
|
-THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
|
+THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.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=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
|
void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}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.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
|
|
|
b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
|
|
@@ -389,7 +389,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
|
|
|
THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
|
THREE.PathCamera=function(b){function c(b,c,d,e){var f={name:d,fps:0.6,length:e,hierarchy:[]},g,j=c.getControlPointsArray(),k=c.getLength(),m=j.length,D=0;g=m-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:e,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<m-1;g++)D=e*k.chunks[g]/k.total,c.keys[g]={time:D,pos:j[g]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(b,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(b,c){var d,
|
|
|
e,f=new THREE.Geometry;for(d=0;d<b.points.length*c;d++)e=d/(b.points.length*c),e=b.getPoint(e),f.vertices[d]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(b,c){var e=d(c,10),f=d(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,g);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);f=new THREE.Sphere(1,
|
|
|
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,g),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
|
+16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,g),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
|
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
|
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,f=Math.PI/180;this.update=function(b,c,d){var e,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi=
|
|
@@ -397,7 +397,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j
|
|
|
b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=c(this.animationParent,
|
|
|
this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),!1)};
|
|
|
THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
|
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
@@ -425,32 +425,27 @@ c(this,function(b){d&&(f=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=
|
|
|
b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?f=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(n=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
|
|
|
this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
|
-THREE.Cube=function(b,c,d,e,g,f,j,k,m){function n(b,c,d,j,k,m,n,p){var t,u,v=e||1,z=g||1,h=k/2,U=m/2,Q=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=f||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=f||1;var W=v+1,J=z+1;k/=v;var $=m/z;for(u=0;u<J;u++)for(m=0;m<W;m++){var R=new THREE.Vector3;R[b]=(m*k-h)*d;R[c]=(u*$-U)*j;R[t]=n;o.vertices.push(new THREE.Vertex(R))}for(u=0;u<z;u++)for(m=0;m<v;m++)o.faces.push(new THREE.Face4(m+W*u+Q,m+W*(u+
|
|
|
-1)+Q,m+1+W*(u+1)+Q,m+1+W*u+Q,null,null,p)),o.faceVertexUvs[0].push([new THREE.UV(m/v,u/z),new THREE.UV(m/v,(u+1)/z),new THREE.UV((m+1)/v,(u+1)/z),new THREE.UV((m+1)/v,u/z)])}THREE.Geometry.call(this);var o=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var z in m)this.sides[z]!=void 0&&(this.sides[z]=m[z]);
|
|
|
-this.sides.px&&n("z","y",1*k,-1,d,c,-p,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,d,c,p,this.materials[1]);this.sides.py&&n("x","z",1*k,1,b,d,t,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,b,d,-t,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=o.vertices.length;d<e;d++){for(var f=o.vertices[d],g=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==m.position.x&&
|
|
|
-f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;g=!0;break}}if(!g)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=o.faces.length;d<e;d++)f=o.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
|
-THREE.Cylinder=function(b,c,d,e,g,f){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,n=Math.PI*2,o=e/2;for(m=0;m<b;m++)j(Math.sin(n*m/b)*c,Math.cos(n*m/b)*c,-o);for(m=0;m<b;m++)j(Math.sin(n*m/b)*d,Math.cos(n*m/b)*d,o);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-o-(f||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,o+(g||0));
|
|
|
-for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],g=this.vertices[d.a],f=this.vertices[d.b],o=this.vertices[d.c],p=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/n,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/n,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/n,0.5+o.position.z/
|
|
|
-e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/n,0.5+p.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
|
|
|
-THREE.Icosahedron=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=g.vertices[b].position,f=g.vertices[d].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,f=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
|
|
|
-1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in f.faces){var m=e(f.faces[k].a,f.faces[k].b),n=e(f.faces[k].b,f.faces[k].c),o=e(f.faces[k].c,f.faces[k].a);d(f.faces[k].a,m,o,j);d(f.faces[k].b,n,m,j);d(f.faces[k].c,
|
|
|
-o,n,j);d(m,n,o,j)}f.faces=j.faces}g.faces=f.faces;delete f;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
|
-THREE.Lathe=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],g=[],f=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),g[k]=this.vertices.length-1):g=f;m==0&&(f=e);for(k=0;k<
|
|
|
-e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
|
-THREE.Plane=function(b,c,d,e){THREE.Geometry.call(this);var g,f=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var n=c/e;for(g=0;g<m;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-f,-(g*n-j),0)));for(g=0;g<e;g++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/d,g/e),new THREE.UV(c/d,(g+1)/e),new THREE.UV((c+1)/d,(g+1)/e),new THREE.UV((c+1)/d,g/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
-THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
|
-THREE.Sphere=function(b,c,d){THREE.Geometry.call(this);for(var e,g=Math.PI,f=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*g),m=b*Math.sin(e*g),n=[],o=0;for(e=0;e<f;e++){var p=2*e/f,t=m*Math.sin(p*g),p=m*Math.cos(p*g);(d==0||d==j)&&e>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);n.push(o)}c.push(n)}for(var u,v,z,g=c.length,d=0;d<g;d++)if(f=c[d].length,d>0)for(e=0;e<f;e++){n=e==f-1;j=c[d][n?0:e+1];k=c[d][n?f-1:e];m=c[d-1][n?f-1:e];n=c[d-
|
|
|
-1][n?0:e+1];t=d/(g-1);u=(d-1)/(g-1);v=(e+1)/f;var p=e/f,o=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),B=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,p]));d>1&&(u=this.vertices[j].position.clone(),
|
|
|
-v=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,p,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
|
|
|
-THREE.Torus=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
|
|
|
-1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,g=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,f,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
|
|
|
-THREE.TorusKnot=function(b,c,d,e,g,f,j){function k(b,c,d,e,f,g){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,g*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=g||2;this.q=f||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
|
|
|
-b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,g=k(m,j,this.q,this.p,this.radius,this.heightScale),m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=m.x-g.x;d.y=m.y-g.y;d.z=m.z-g.z;e.x=m.x+g.x;e.y=m.y+g.y;e.z=m.z+g.z;f.cross(d,e);e.cross(f,d);f.normalize();e.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*e.x+j*f.x;g.y+=m*e.y+j*f.y;g.z+=m*e.z+j*f.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
|
|
|
-0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][f],f=this.grid[b][f],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,d,e,f));this.faceVertexUvs[0].push([j,m,n,o])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
-THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Text=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
|
|
|
-THREE.Text.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,d=c.height!==void 0?c.height:50,e=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=g;THREE.FontUtils.weight=f;THREE.FontUtils.style=j;var g=THREE.FontUtils.drawText(b),e=g.points,k=g.faces,g=g.contour;this.vertices=[];this.faces=
|
|
|
-[];for(var m,j=e.length,n=k.length,f=0;f<j;f++)m=e[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,0)));for(f=0;f<j;f++)m=e[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,d)));for(f=0;f<n;f++)d=k[f],this.faces.push(new THREE.Face3(d[2],d[1],d[0]));for(f=0;f<n;f++)d=k[f],this.faces.push(new THREE.Face3(d[0]+j,d[1]+j,d[2]+j));for(var f=g.length,o;--f>0;){if(o){if(o.equals(g[f])){o=null;continue}}else o=g[f];for(d=0;d<j;d++)if(e[d].equals(g[f]))break;for(k=0;k<j;k++)if(e[k].equals(g[f-
|
|
|
-1]))break;this.faces.push(new THREE.Face4(d,k,k+j,d+j))}this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.CubeGeometry=function(b,c,d,e,g,f,j,k,m){function n(b,c,d,j,k,m,n,p){var t,u,v=e||1,z=g||1,h=k/2,U=m/2,Q=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=f||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=f||1;var W=v+1,J=z+1;k/=v;var $=m/z;for(u=0;u<J;u++)for(m=0;m<W;m++){var R=new THREE.Vector3;R[b]=(m*k-h)*d;R[c]=(u*$-U)*j;R[t]=n;o.vertices.push(new THREE.Vertex(R))}for(u=0;u<z;u++)for(m=0;m<v;m++)o.faces.push(new THREE.Face4(m+W*u+
|
|
|
+Q,m+W*(u+1)+Q,m+1+W*(u+1)+Q,m+1+W*u+Q,null,null,p)),o.faceVertexUvs[0].push([new THREE.UV(m/v,u/z),new THREE.UV(m/v,(u+1)/z),new THREE.UV((m+1)/v,(u+1)/z),new THREE.UV((m+1)/v,u/z)])}THREE.Geometry.call(this);var o=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var z in m)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
+m[z]);this.sides.px&&n("z","y",1*k,-1,d,c,-p,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,d,c,p,this.materials[1]);this.sides.py&&n("x","z",1*k,1,b,d,t,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,b,d,-t,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=o.vertices.length;d<e;d++){for(var f=o.vertices[d],g=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==m.position.x&&
|
|
|
+f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;g=!0;break}}if(!g)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=o.faces.length;d<e;d++)f=o.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(b,c,d,e,g,f){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,n=Math.PI*2,o=e/2;for(m=0;m<b;m++)j(Math.sin(n*m/b)*c,Math.cos(n*m/b)*c,-o);for(m=0;m<b;m++)j(Math.sin(n*m/b)*d,Math.cos(n*m/b)*d,o);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-o-(f||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,o+
|
|
|
+(g||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],g=this.vertices[d.a],f=this.vertices[d.b],o=this.vertices[d.c],p=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/n,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/n,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/n,0.5+o.position.z/
|
|
|
+e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/n,0.5+p.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.IcosahedronGeometry=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=g.vertices[b].position,f=g.vertices[d].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,f=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in f.faces){var m=e(f.faces[k].a,f.faces[k].b),n=e(f.faces[k].b,f.faces[k].c),o=e(f.faces[k].c,f.faces[k].a);d(f.faces[k].a,m,o,j);d(f.faces[k].b,n,m,j);
|
|
|
+d(f.faces[k].c,o,n,j);d(m,n,o,j)}f.faces=j.faces}g.faces=f.faces;delete f;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+THREE.LatheGeometry=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],g=[],f=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.001;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),g[k]=this.vertices.length-1):g=f;m==0&&(f=e);
|
|
|
+for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
+THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var g,f=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var n=c/e;for(g=0;g<m;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-f,-(g*n-j),0)));for(g=0;g<e;g++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/d,g/e),new THREE.UV(c/d,(g+1)/e),new THREE.UV((c+1)/d,(g+1)/e),new THREE.UV((c+1)/d,g/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
+THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,g=Math.PI,f=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*g),m=b*Math.sin(e*g),n=[],o=0;for(e=0;e<f;e++){var p=2*e/f,t=m*Math.sin(p*g),p=m*Math.cos(p*g);(d==0||d==j)&&e>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);n.push(o)}c.push(n)}for(var u,v,z,g=c.length,d=0;d<g;d++)if(f=c[d].length,d>0)for(e=0;e<f;e++){n=e==f-1;j=c[d][n?0:e+1];k=c[d][n?f-1:e];m=c[d-1][n?
|
|
|
+f-1:e];n=c[d-1][n?0:e+1];t=d/(g-1);u=(d-1)/(g-1);v=(e+1)/f;var p=e/f,o=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),B=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,p]));d>1&&(u=
|
|
|
+this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,p,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
+THREE.TextGeometry.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,d=c.height!==void 0?c.height:50,e=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=g;THREE.FontUtils.weight=f;THREE.FontUtils.style=j;var g=THREE.FontUtils.drawText(b),e=g.points,k=g.faces,g=g.contour;this.vertices=
|
|
|
+[];this.faces=[];for(var m,j=e.length,n=k.length,f=0;f<j;f++)m=e[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,0)));for(f=0;f<j;f++)m=e[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,d)));for(f=0;f<n;f++)d=k[f],this.faces.push(new THREE.Face3(d[2],d[1],d[0]));for(f=0;f<n;f++)d=k[f],this.faces.push(new THREE.Face3(d[0]+j,d[1]+j,d[2]+j));for(var f=g.length,o;--f>0;){if(o){if(o.equals(g[f])){o=null;continue}}else o=g[f];for(d=0;d<j;d++)if(e[d].equals(g[f]))break;
|
|
|
+for(k=0;k<j;k++)if(e[k].equals(g[f-1]))break;this.faces.push(new THREE.Face4(d,k,k+j,d+j))}this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
|
|
|
{points:b,faces:[]};var d,e,g,f,j=[],k;for(k in c){b=c[k];f=[];for(d in b)e=b[d],f.push(e.x+","+e.y);var m,n;n=f.slice(1).indexOf(f[0]);var o=this.Triangulate.area(b.slice(0,n+1))<0;e=[];for(n=-1;n<f.length;){m=n+1;n=f[m];n=f.slice(m+1).indexOf(n)+m;if(n<=m)break;var p=b.slice(m,n+1);o?this.Triangulate.area(p)<0?(m>0&&j.push({shape:g,holes:e}),g=p,e=[]):e.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:e}),e=[]):e.push(p);n++}o&&j.push({shape:g,holes:e})}var t,u,v,z,B,y;f=[];for(k=0;k<j.length;k++){m=
|
|
|
j[k];g=m.shape;e=m.holes;for(o=0;o<e.length;o++){n=e[o];v=Number.POSITIVE_INFINITY;for(p=0;p<n.length;p++){B=n[p];for(d=0;d<g.length;d++)z=g[d],z=B.distanceTo(z),z<v&&(v=z,t=p,u=d)}d=u-1>=0?u-1:g.length-1;var p=t-1>=0?t-1:n.length-1,D=[];D.push(n[t]);D.push(g[u]);D.push(g[d]);v=this.Triangulate.area(D);var x=[];x.push(n[t]);x.push(n[p]);x.push(g[u]);B=this.Triangulate.area(x);z=u;y=t;u+=1;t+=-1;u<0&&(u+=g.length);u%=g.length;t<0&&(t+=n.length);t%=g.length;d=u-1>=0?u-1:g.length-1;p=t-1>=0?t-1:n.length-
|
|
@@ -462,7 +457,14 @@ d+e;m=c[b++]*d;p=c[b++]*d+e;t=c[b++]*d;if(f=g[g.length-1]){n=f.x;o=f.y;f=1;for(d
|
|
|
B))}}}return{offset:z.ha*d,points:g}}}};
|
|
|
(function(b){var c=function(b){for(var c=b.length,g=0,f=c-1,j=0;j<c;f=j++)g+=b[f].x*b[j].y-b[j].x*b[f].y;return g*0.5};b.Triangulate=function(b,e){var g=b.length;if(g<3)return null;var f=[],j=[],k=[],m,n,o;if(c(b)>0)for(n=0;n<g;n++)j[n]=n;else for(n=0;n<g;n++)j[n]=g-1-n;var p=2*g;for(n=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}m=n;g<=m&&(m=0);n=m+1;g<=n&&(n=0);o=n+1;g<=o&&(o=0);var t;a:{t=b;var u=m,v=n,z=o,B=g,y=j,D=void 0,x=void 0,H=void 0,
|
|
|
F=void 0,A=void 0,O=void 0,C=void 0,L=void 0,G=void 0,x=t[y[u]].x,H=t[y[u]].y,F=t[y[v]].x,A=t[y[v]].y,O=t[y[z]].x,C=t[y[z]].y;if(1.0E-10>(F-x)*(C-H)-(A-H)*(O-x))t=!1;else{for(D=0;D<B;D++)if(!(D==u||D==v||D==z)){var L=t[y[D]].x,G=t[y[D]].y,S=void 0,h=void 0,U=void 0,Q=void 0,W=void 0,J=void 0,$=void 0,R=void 0,P=void 0,ga=void 0,V=void 0,da=void 0,S=U=W=void 0,S=O-F,h=C-A,U=x-O,Q=H-C,W=F-x,J=A-H,$=L-x,R=G-H,P=L-F,ga=G-A,V=L-O,da=G-C,S=S*ga-h*P,W=W*R-J*$,U=U*da-Q*V;if(S>=0&&U>=0&&W>=0){t=!1;break a}}t=
|
|
|
-!0}}if(t){p=j[m];t=j[n];u=j[o];f.push(b[p]);f.push(b[t]);f.push(b[u]);k.push([j[m],j[n],j[o]]);m=n;for(o=n+1;o<g;m++,o++)j[m]=j[o];g--;p=2*g}}if(e)return k;return f};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+!0}}if(t){p=j[m];t=j[n];u=j[o];f.push(b[p]);f.push(b[t]);f.push(b[u]);k.push([j[m],j[n],j[o]]);m=n;for(o=n+1;o<g;m++,o++)j[m]=j[o];g--;p=2*g}}if(e)return k;return f};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+THREE.TorusGeometry=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
|
|
|
+1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,g=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,f,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
+THREE.TorusKnotGeometry=function(b,c,d,e,g,f,j){function k(b,c,d,e,f,g){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,g*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=g||2;this.q=f||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
+this.segmentsT;++c){var m=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,g=k(m,j,this.q,this.p,this.radius,this.heightScale),m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=m.x-g.x;d.y=m.y-g.y;d.z=m.z-g.z;e.x=m.x+g.x;e.y=m.y+g.y;e.z=m.z+g.z;f.cross(d,e);e.cross(f,d);f.normalize();e.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*e.x+j*f.x;g.y+=m*e.y+j*f.y;g.z+=m*e.z+j*f.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][f],f=this.grid[b][f],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,d,e,f));this.faceVertexUvs[0].push([j,m,n,o])}this.computeCentroids();
|
|
|
+this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var e=0;e<c.length;++e)b.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],d)]},createMaterial:function(b,c){function d(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function e(b,c){var e=new Image;e.onload=function(){if(!d(this.width)||!d(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/
|
|
|
Math.LN2));b.image.width=c;b.image.height=e;b.image.getContext("2d").drawImage(this,0,0,c,e)}else b.image=this;b.needsUpdate=!0};e.src=c}var g,f,j;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?g="MeshPhongMaterial":b.shading=="Basic"&&(g="MeshBasicMaterial"));if(b.blending)if(b.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(b.blending==
|
|
@@ -558,8 +560,9 @@ e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var e=d.dot(b.direction.clone());if(e<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-e*e);if(d>=0)return Math.abs(e)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
-THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,g=new THREE.Camera,f=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},j=new THREE.WebGLRenderTarget(512,512,b),k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.Camera(53,1,1,1E4);m.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:j},mapRight:{type:"t",value:1,texture:k}},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 n=new THREE.Scene;n.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);j.width=b;j.height=e;k.width=b;k.height=e};this.render=
|
|
|
-function(b,d){g.projectionMatrix=d.projectionMatrix;g.position.copy(d.position);g.target.position.copy(d.target.position);g.translateX(-10);f.projectionMatrix=d.projectionMatrix;f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(10);e.call(c,b,g,j,!0);e.call(c,b,f,k,!0);e.call(c,n,m)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
|
|
|
-THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,d=this.setSize,e=this.render,g,f,j=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,e){d.call(c,b,e);g=b/2;f=e};this.render=function(b,d){this.clear();j.fov=d.fov;j.aspect=0.5*d.aspect;j.near=d.near;j.far=d.far;j.updateProjectionMatrix();
|
|
|
-j.position.copy(d.position);j.target.position.copy(d.target.position);j.translateX(c.separation);k.projectionMatrix=j.projectionMatrix;k.position.copy(d.position);k.target.position.copy(d.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,f);e.call(c,b,j);this.setViewport(g,0,g,f);e.call(c,b,k,!1)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,g=new THREE.Camera,f=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},j=new THREE.WebGLRenderTarget(512,512,b),k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.Camera(53,1,1,1E4);m.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:j},mapRight:{type:"t",value:1,
|
|
|
+texture:k}},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 n=
|
|
|
+new THREE.Scene;n.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);j.width=b;j.height=e;k.width=b;k.height=e};this.render=function(b,d){g.projectionMatrix=d.projectionMatrix;g.position.copy(d.position);g.target.position.copy(d.target.position);g.translateX(-10);f.projectionMatrix=d.projectionMatrix;f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(10);e.call(c,b,g,j,!0);e.call(c,b,f,k,!0);e.call(c,n,m)}},THREE.AnaglyphWebGLRenderer.prototype=
|
|
|
+new THREE.WebGLRenderer,THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,d=this.setSize,e=this.render,g,f,j=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,e){d.call(c,b,e);g=b/2;f=e};this.render=function(b,d){this.clear();j.fov=d.fov;j.aspect=0.5*d.aspect;j.near=d.near;j.far=d.far;
|
|
|
+j.updateProjectionMatrix();j.position.copy(d.position);j.target.position.copy(d.target.position);j.translateX(c.separation);k.projectionMatrix=j.projectionMatrix;k.position.copy(d.position);k.target.position.copy(d.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,f);e.call(c,b,j);this.setViewport(g,0,g,f);e.call(c,b,k,!1)}},THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer,THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;
|