|
@@ -93,7 +93,7 @@ c)THREE.Quaternion.slerp(f,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,j;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,c,e);return d};
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,j;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,c,e);return d};
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,e){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,e){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var g=c[f],e=this.getNextKeyWith(g,a,0);e&&e.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
|
|
|
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var g=c[f],e=this.getNextKeyWith(g,a,0);e&&e.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,g;for(c=0;c<d;c++){f=this.hierarchy[c];g=this.data.hierarchy[c];f.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,g;for(c=0;c<d;c++){f=this.hierarchy[c];g=this.data.hierarchy[c];f.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
|
|
f.matrix;f=this.data.hierarchy[c].keys;if(f.length)g.animationCache.prevKey=f[0],g.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
f.matrix;f=this.data.hierarchy[c].keys;if(f.length)g.animationCache.prevKey=f[0],g.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
@@ -113,7 +113,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspe
|
|
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(2*a)),c=180/Math.PI*c;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(2*a)),c=180/Math.PI*c;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=void 0!==b?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
|
|
|
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=void 0!==b?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
@@ -123,14 +123,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
|
|
this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var f={name:c,fps:0.6,length:d,hierarchy:[]},e,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,r=0;e=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[e]={time:d,pos:g[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<q-1;e++)r=d*h.chunks[e]/h.total,b.keys[e]={time:r,pos:g[e]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);
|
|
THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var f={name:c,fps:0.6,length:d,hierarchy:[]},e,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,r=0;e=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[e]={time:d,pos:g[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<q-1;e++)r=d*h.chunks[e]/h.total,b.keys[e]={time:r,pos:g[e]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
-new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
|
|
|
|
+new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=0<=a?a:a+e;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=0<=a?a:a+e;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
|
|
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
|
|
document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
|
|
|
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
@@ -148,7 +148,7 @@ function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove"
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
0,0);var d=!1,f=-1,g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
0,0);var d=!1,f=-1,g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
-c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(e.dot(h)/e.length()/h.length());if(a){var b=(new THREE.Vector3).cross(e,h).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);
|
|
|
|
|
|
+c.screen.height+c.screen.offsetTop-b)/c.radius,0),f=d.length();1<f?d.normalize():d.z=Math.sqrt(1-f*f);g.copy(c.object.position).subSelf(c.target);f=c.object.up.clone().setLength(d.y);f.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));f.addSelf(g.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(e.dot(h)/e.length()/h.length());if(a){var b=(new THREE.Vector3).cross(e,h).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);
|
|
d.multiplyVector3(h);c.staticMoving?e=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(e))}};this.zoomCamera=function(){var a=1+(j.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?i=j:i.y+=(j.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(k);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
|
|
d.multiplyVector3(h);c.staticMoving?e=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(e))}};this.zoomCamera=function(){var a=1+(j.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?i=j:i.y+=(j.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(k);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
|
|
c.target.addSelf(b);c.staticMoving?k=o:k.addSelf(a.sub(o,k).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
|
|
c.target.addSelf(b);c.staticMoving?k=o:k.addSelf(a.sub(o,k).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
|
|
c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=j=c.getMouseOnScreen(a.clientX,a.clientY),k=o=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,
|
|
c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=j=c.getMouseOnScreen(a.clientX,a.clientY),k=o=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,
|
|
@@ -163,10 +163,10 @@ l=j[i+1][h+1],n=j[i][h+1],p=this.vertices[c].position.clone().setY(0).normalize(
|
|
0;h<d;h++)c=j[0][h],o=j[0][h+1],l=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=k[0][h].clone(),t=k[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([s,t,v])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],l=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,
|
|
0;h<d;h++)c=j[0][h],o=j[0][h+1],l=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=k[0][h].clone(),t=k[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([s,t,v])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],l=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,
|
|
0),s=k[i][h+1].clone(),t=k[i][h].clone(),v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([s,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
0),s=k[i][h+1].clone(),t=k[i][h].clone(),v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,o,l,[p,m,q])),this.faceVertexUvs[0].push([s,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,f=a.length;this.shapebb=a[f-1].getBoundingBox();for(d=0;d<f;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,f=a.length;this.shapebb=a[f-1].getBoundingBox();for(d=0;d<f;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(var b=
|
|
|
|
-0,c=n+2*k,b=0;b<c;b++){var d=G*b,e=G*(b+1),f=R+C+d,g=R+C+e,j=f,d=R+L+d,e=R+L+e,o=g,j=j+F,d=d+F,e=e+F,o=o+F;A.faces.push(new THREE.Face4(j,d,e,o,null,null,v));void 0!==v&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
|
|
|
|
-b,c,null,null,t));if(void 0!==t){var d=u.minX,e=u.minY,f=u.maxY,g=u.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,e=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
|
+h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);0===e&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(var b=
|
|
|
|
+0,c=n+2*k,b=0;b<c;b++){var d=G*b,f=G*(b+1),e=R+C+d,g=R+C+f,j=e,d=R+L+d,f=R+L+f,o=g,j=j+F,d=d+F,f=f+F,o=o+F;A.faces.push(new THREE.Face4(j,d,f,o,null,null,v));void 0!==v&&(j=b/c,d=(b+1)/c,f=h+2*i,e=(A.vertices[e].position.z+i)/f,g=(A.vertices[g].position.z+i)/f,A.faceVertexUvs[0].push([new THREE.UV(e,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(e,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
|
|
|
|
+b,c,null,null,t));if(void 0!==t){var d=u.minX,f=u.minY,e=u.maxY,g=u.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-f,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-f;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.vertices[a].position.y-f)/e),new THREE.UV(h/g,b/e),new THREE.UV(i/g,c/e)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
|
|
3,o=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,p=b.bendPath,m=b.extrudePath,q,r=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial,u=this.shapebb;if(m)q=m.getPoints(l),n=q.length,r=!0,o=!1;o||(j=i=k=0);var w,z,x,A=this,F=this.vertices.length;p&&a.addWrapPath(p);l=s?a.extractAllSpacedPoints(l):a.extractAllPoints(l);p=l.shape;l=l.holes;if(m=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();for(z=
|
|
3,o=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,p=b.bendPath,m=b.extrudePath,q,r=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial,u=this.shapebb;if(m)q=m.getPoints(l),n=q.length,r=!0,o=!1;o||(j=i=k=0);var w,z,x,A=this,F=this.vertices.length;p&&a.addWrapPath(p);l=s?a.extractAllSpacedPoints(l):a.extractAllPoints(l);p=l.shape;l=l.holes;if(m=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();for(z=
|
|
0,x=l.length;z<x;z++)w=l[z],THREE.Shape.Utils.isClockWise(w)&&(l[z]=w.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,l);s=p;for(z=0,x=l.length;z<x;z++)w=l[z],p=p.concat(w);for(var E,I,J,B,G=p.length,D=m.length,H=[],y=0,K=s.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),H[y]=d(s[y],s[C],s[L]);var N=[],M,O=H.concat();for(z=0,x=l.length;z<x;z++){w=l[z];M=[];for(y=0,K=w.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),M[y]=d(w[y],w[C],w[L]);N.push(M);O=O.concat(M)}for(E=
|
|
0,x=l.length;z<x;z++)w=l[z],THREE.Shape.Utils.isClockWise(w)&&(l[z]=w.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,l);s=p;for(z=0,x=l.length;z<x;z++)w=l[z],p=p.concat(w);for(var E,I,J,B,G=p.length,D=m.length,H=[],y=0,K=s.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),H[y]=d(s[y],s[C],s[L]);var N=[],M,O=H.concat();for(z=0,x=l.length;z<x;z++){w=l[z];M=[];for(y=0,K=w.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),M[y]=d(w[y],w[C],w[L]);N.push(M);O=O.concat(M)}for(E=
|
|
0;E<k;E++){I=E/k;J=i*(1-I);I=j*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],I),g(B.x,B.y,-J);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),g(B.x,B.y,-J)}}I=j;for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?g(B.x,B.y+q[0].y,q[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?g(B.x,B.y+q[E-1].y,q[E-1].x):g(B.x,B.y,h/n*E);for(E=k-1;0<=E;E--){I=E/k;J=i*(1-I);I=j*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],
|
|
0;E<k;E++){I=E/k;J=i*(1-I);I=j*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],I),g(B.x,B.y,-J);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),g(B.x,B.y,-J)}}I=j;for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?g(B.x,B.y+q[0].y,q[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<G;y++)B=o?c(p[y],O[y],I):p[y],r?g(B.x,B.y+q[E-1].y,q[E-1].x):g(B.x,B.y,h/n*E);for(E=k-1;0<=E;E--){I=E/k;J=i*(1-I);I=j*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],
|
|
@@ -176,7 +176,7 @@ THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+
|
|
0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=f.vertices[a].position,e=f.vertices[c].position;return b((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,
|
|
0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=f.vertices[a].position,e=f.vertices[c].position;return b((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,
|
|
g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var e=0;e<this.subdivisions;e++){for(var a=new THREE.Geometry,e=0,h=g.faces.length;e<h;e++){var i=g.faces[e],j=d(i.a,i.b),k=d(i.b,i.c),o=d(i.c,i.a);c(i.a,j,o,a);c(i.b,k,j,a);c(i.c,o,k,a);c(j,k,o,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}f.faces=g.faces;f.faceVertexUvs[0]=
|
|
g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var e=0;e<this.subdivisions;e++){for(var a=new THREE.Geometry,e=0,h=g.faces.length;e<h;e++){var i=g.faces[e],j=d(i.a,i.b),k=d(i.b,i.c),o=d(i.c,i.a);c(i.a,j,o,a);c(i.b,k,j,a);c(i.c,o,k,a);c(j,k,o,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}f.faces=g.faces;f.faceVertexUvs[0]=
|
|
g.faceVertexUvs[0];this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
g.faceVertexUvs[0];this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=e.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=g;0==i&&(g=d);
|
|
|
|
|
|
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=e.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=g;0==i&&(g=d);
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];void 0===d&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){0>c&&1===a.u&&
|
|
e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];void 0===d&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){0>c&&1===a.u&&
|
|
@@ -199,13 +199,13 @@ a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);for(i=j,k=j+1;k<f;i++,k++)e[i]=e[k];f
|
|
THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
|
|
THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
|
|
this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,e=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,g,e,h,[b[f],b[g],b[e],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[e]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,e=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,g,e,h,[b[f],b[g],b[e],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[e]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
-THREE.TorusKnotGeometry=function(a,b,c,d,f,g,e){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
|
|
|
+THREE.TorusKnotGeometry=function(a,b,c,d,f,g,e){function h(a,b,c,d,f,e){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*f*(2+c);b=0.5*f*(2+c)*b;f=0.5*e*f*Math.sin(a);return new THREE.Vector3(g,b,f)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,e=2*(b/this.segmentsT)*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,e=2*(b/this.segmentsT)*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
|
|
0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();this.computeFaceNormals();
|
|
0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();this.computeFaceNormals();
|
|
this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){k.vertexColors=[];for(var j,o,m,n=0;4>n;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)o=h.vertexColors[m[p]-1],j.r+=o.r,j.g+=o.g,j.b+=o.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}f.push(k);(!e.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){k.vertexColors=[];for(var j,o,m,n=0;4>n;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)o=h.vertexColors[m[p]-1],j.r+=o.r,j.g+=o.g,j.b+=o.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}f.push(k);(!e.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},l=[],n,p,m,q,r,s=a.faceVertexUvs[0];for(n=0,p=s.length;n<p;n++)for(m=0,q=s[n].length;m<q;m++)r=d[n]["abcd".charAt(m)],l[r]||(l[r]=s[n][m]);var t;for(n=0,p=d.length;n<p;n++)if(r=d[n],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),e.supportUVs&&0!=l.length){t=new THREE.UV;if(r instanceof THREE.Face3)t.u=l[r.a].u+l[r.b].u+l[r.c].u,t.v=l[r.a].v+l[r.b].v+l[r.c].v,t.u/=3,t.v/=3;else if(r instanceof THREE.Face4)t.u=
|
|
b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},l=[],n,p,m,q,r,s=a.faceVertexUvs[0];for(n=0,p=s.length;n<p;n++)for(m=0,q=s[n].length;m<q;m++)r=d[n]["abcd".charAt(m)],l[r]||(l[r]=s[n][m]);var t;for(n=0,p=d.length;n<p;n++)if(r=d[n],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),e.supportUVs&&0!=l.length){t=new THREE.UV;if(r instanceof THREE.Face3)t.u=l[r.a].u+l[r.b].u+l[r.c].u,t.v=l[r.a].v+l[r.b].v+l[r.c].v,t.u/=3,t.v/=3;else if(r instanceof THREE.Face4)t.u=
|
|
-l[r.a].u+l[r.b].u+l[r.c].u+l[r.d].u,t.v=l[r.a].v+l[r.b].v+l[r.c].v+l[r.d].v,t.u/=4,t.v/=4;l.push(t)}p=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,s=h.length,u,w,z={},x={},A=function(a,
|
|
|
|
|
|
+l[r.a].u+l[r.b].u+l[r.c].u+l[r.d].u,t.v=l[r.a].v+l[r.b].v+l[r.c].v+l[r.d].v,t.u/=4,t.v/=4;l.push(t)}p=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};for(d=0,f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var v=0,s=h.length,u,w,z={},x={},A=function(a,
|
|
b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},F=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(n in p){t=p[n];u=n.split("_");w=u[0];u=u[1];A(w,[w,u]);A(u,[w,u]);for(m=0,q=t.length;m<q;m++)r=t[m],F(w,r,n),F(u,r,n);2>t.length&&(o[n]=!0)}for(n in p)if(t=p[n],r=t[0],t=t[1],u=n.split("_"),w=u[0],u=u[1],q=new THREE.Vector3,o[n]?(q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.5)):(q.addSelf(j[r]),q.addSelf(j[t]),q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.25)),
|
|
b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},F=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(n in p){t=p[n];u=n.split("_");w=u[0];u=u[1];A(w,[w,u]);A(u,[w,u]);for(m=0,q=t.length;m<q;m++)r=t[m],F(w,r,n),F(u,r,n);2>t.length&&(o[n]=!0)}for(n in p)if(t=p[n],r=t[0],t=t[1],u=n.split("_"),w=u[0],u=u[1],q=new THREE.Vector3,o[n]?(q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.5)):(q.addSelf(j[r]),q.addSelf(j[t]),q.addSelf(h[w].position),q.addSelf(h[u].position),q.multiplyScalar(0.25)),
|
|
k[n]=s+d.length+v,i.push(new THREE.Vertex(q)),v++,e.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[u].u,t.v=l[w].v+l[u].v,t.u/=2,t.v/=2,l.push(t);var E,I;u=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],B=["1234","34","4","41"],G=["1234","41","1","12"];for(n=0,p=j.length;n<p;n++)r=d[n],t=s+n,r instanceof THREE.Face3?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.a),b(t,k[v],r.b,k[w],r,u),b(t,k[w],r.c,k[E],r,q),b(t,k[E],r.a,k[v],
|
|
k[n]=s+d.length+v,i.push(new THREE.Vertex(q)),v++,e.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[u].u,t.v=l[w].v+l[u].v,t.u/=2,t.v/=2,l.push(t);var E,I;u=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],B=["1234","34","4","41"],G=["1234","41","1","12"];for(n=0,p=j.length;n<p;n++)r=d[n],t=s+n,r instanceof THREE.Face3?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.a),b(t,k[v],r.b,k[w],r,u),b(t,k[w],r.c,k[E],r,q),b(t,k[E],r.a,k[v],
|
|
r,A)):r instanceof THREE.Face4?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.d),I=c(r.d,r.a),b(t,k[v],r.b,k[w],r,F),b(t,k[w],r.c,k[E],r,J),b(t,k[E],r.d,k[I],r,B),b(t,k[I],r.a,k[v],r,G)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,p=h.length;n<p;n++)if(void 0!==z[n]){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);t=0;for(m in x[n])i.addSelf(j[m]),t++;v=0;s=z[n].length;for(m=0;m<s;m++)o[c(z[n][m][0],z[n][m][1])]&&v++;if(2!=v){i.divideScalar(t);for(m=0;m<
|
|
r,A)):r instanceof THREE.Face4?(v=c(r.a,r.b),w=c(r.b,r.c),E=c(r.c,r.d),I=c(r.d,r.a),b(t,k[v],r.b,k[w],r,F),b(t,k[w],r.c,k[E],r,J),b(t,k[E],r.d,k[I],r,B),b(t,k[I],r.a,k[v],r,G)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,p=h.length;n<p;n++)if(void 0!==z[n]){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);t=0;for(m in x[n])i.addSelf(j[m]),t++;v=0;s=z[n].length;for(m=0;m<s;m++)o[c(z[n][m][0],z[n][m][1])]&&v++;if(2!=v){i.divideScalar(t);for(m=0;m<
|
|
@@ -371,6 +371,11 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:d})};
|
|
THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:d})};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
|
|
+THREE.VisibleCamera=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
|
|
|
|
+"n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
|
|
|
|
+this.update(a);this.add(new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces))};THREE.VisibleCamera.prototype=new THREE.Object3D;THREE.VisibleCamera.prototype.constructor=THREE.VisibleCamera;
|
|
|
|
+THREE.VisibleCamera.prototype.update=function(a){function b(a,b,g,e){THREE.VisibleCamera.__v.set(b,g,e);THREE.VisibleCamera.__projector.unprojectVector(THREE.VisibleCamera.__v,THREE.VisibleCamera.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(g=a.length;b<g;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.VisibleCamera.__v)}}var c=this;THREE.VisibleCamera.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,0);b("t",0,0,1);b("n1",-1,-1,0);b("n2",1,-1,0);b("n3",-1,1,0);b("n4",1,1,0);b("f1",-1,
|
|
|
|
+-1,1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,0);b("u2",-0.7,1.1,0);b("u3",0,2,0);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,0);b("cn2",1,0,0);b("cn3",0,-1,0);b("cn4",0,1,0);this.lineGeometry.__dirtyVertices=!0};THREE.VisibleCamera.__projector=new THREE.Projector;THREE.VisibleCamera.__v=new THREE.Vector3;THREE.VisibleCamera.__c=new THREE.Camera;
|
|
THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,g,e,h,i,j,k,o,l,n;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);f=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
|
|
THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,g,e,h,i,j,k,o,l,n;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);f=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
|
|
0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;f[p++]=0;f[p++]=1;f[p++]=2;f[p++]=0;f[p++]=2;f[p++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;f[p++]=0;f[p++]=1;f[p++]=2;f[p++]=0;f[p++]=2;f[p++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
@@ -378,8 +383,8 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b
|
|
"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=!1};this.render=function(a,d,f,r){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,v=r/f,u=0.5*f,w=0.5*r,z=16/r,x=new THREE.Vector2(z*v,z),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(k);n||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),n=!0);b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
|
|
"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=!1};this.render=function(a,d,f,r){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,v=r/f,u=0.5*f,w=0.5*r,z=16/r,x=new THREE.Vector2(z*v,z),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(k);n||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),n=!0);b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
|
|
1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.disable(b.CULL_FACE);b.depthMask(!1);var I,J,B,G,D;for(I=0;I<s;I++)if(z=16/r,x.set(z*v,z),G=a[I],t.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),F.x=A.x*u+u,F.y=A.y*w+w,j||0<F.x&&F.x<f&&0<F.y&&F.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.disable(b.CULL_FACE);b.depthMask(!1);var I,J,B,G,D;for(I=0;I<s;I++)if(z=16/r,x.set(z*v,z),G=a[I],t.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),F.x=A.x*u+u,F.y=A.y*w+w,j||0<F.x&&F.x<f&&0<F.y&&F.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
-6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(A);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);for(J=0,B=G.lensFlares.length;J<B;J++)if(D=G.lensFlares[J],0.001<D.opacity&&0.001<D.scale)A.x=D.x,A.y=D.y,A.z=D.z,z=D.size*D.scale/r,x.x=z*v,x.y=z,b.uniform3f(E.screenPosition,A.x,A.y,A.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,D.rotation),b.uniform1f(E.opacity,D.opacity),b.uniform3f(E.color,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending),
|
|
|
|
-c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
|
|
|
+6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(A);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);for(J=0,B=G.lensFlares.length;J<B;J++)if(D=G.lensFlares[J],0.0010<D.opacity&&0.0010<D.scale)A.x=D.x,A.y=D.y,A.z=D.z,z=D.size*D.scale/r,x.x=z*v,x.y=z,b.uniform3f(E.screenPosition,A.x,A.y,A.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,D.rotation),b.uniform1f(E.opacity,D.opacity),b.uniform3f(E.color,D.color.r,D.color.g,D.color.b),
|
|
|
|
+c.setBlending(D.blending),c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,f,g=new THREE.Frustum,e=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(c){a=c.context;b=c;var c=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(c.uniforms);d=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:e});f=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:e,morphTargets:!0});d._shadowPass=!0;f._shadowPass=!0};this.render=
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,f,g=new THREE.Frustum,e=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(c){a=c.context;b=c;var c=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(c.uniforms);d=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:e});f=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:e,morphTargets:!0});d._shadowPass=!0;f._shadowPass=!0};this.render=
|
|
function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,j,k,o,l,n,p,m,q=0,r=h.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,j=r.length;i<j;i++)if(p=r[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
|
|
function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,j,k,o,l,n,p,m,q=0,r=h.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,j=r.length;i<j;i++)if(p=r[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
|
|
b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);k=this.shadowMap[q];o=this.shadowMatrix[q];c.position.copy(p.position);c.lookAt(p.target.position);null==c.parent&&(h.add(c),b.autoUpdateScene&&h.updateMatrixWorld());c.matrixWorldInverse.getInverse(c.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(c.projectionMatrix);o.multiplySelf(c.matrixWorldInverse);if(!c._viewMatrixArray)c._viewMatrixArray=
|
|
b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);k=this.shadowMap[q];o=this.shadowMatrix[q];c.position.copy(p.position);c.lookAt(p.target.position);null==c.parent&&(h.add(c),b.autoUpdateScene&&h.updateMatrixWorld());c.matrixWorldInverse.getInverse(c.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(c.projectionMatrix);o.multiplySelf(c.matrixWorldInverse);if(!c._viewMatrixArray)c._viewMatrixArray=
|