diff --git a/build/three.js b/build/three.js index 7d27d5d33e2063aabd26dc56101b855f371d901e..7de655958f2f0a1a65cfe200a5d3805e1afa2c62 100644 --- a/build/three.js +++ b/build/three.js @@ -5681,55 +5681,61 @@ THREE.Clock = function ( autoStart ) { }; -THREE.Clock.prototype.start = function () { +THREE.extend( THREE.Clock.prototype, { - this.startTime = Date.now(); - this.oldTime = this.startTime; + start: function () { - this.running = true; + this.startTime = window.performance !== undefined && window.performance.now !== undefined + ? window.performance.now() + : Date.now(); -}; + this.oldTime = this.startTime; + this.running = true; + }, -THREE.Clock.prototype.stop = function () { + stop: function () { - this.getElapsedTime(); + this.getElapsedTime(); + this.running = false; - this.running = false; + }, -}; + getElapsedTime: function () { -THREE.Clock.prototype.getElapsedTime = function () { + this.getDelta(); + return this.elapsedTime; - this.getDelta(); + }, - return this.elapsedTime; + getDelta: function () { -}; + var diff = 0; + if ( this.autoStart && ! this.running ) { -THREE.Clock.prototype.getDelta = function () { + this.start(); - var diff = 0; + } - if ( this.autoStart && ! this.running ) { + if ( this.running ) { - this.start(); + var newTime = window.performance !== undefined && window.performance.now !== undefined + ? window.performance.now() + : Date.now(); - } + diff = 0.001 * ( newTime - this.oldTime ); + this.oldTime = newTime; - if ( this.running ) { + this.elapsedTime += diff; - var newTime = Date.now(); - diff = 0.001 * ( newTime - this.oldTime ); - this.oldTime = newTime; + } - this.elapsedTime += diff; + return diff; } - return diff; - -};/** +} ); +/** * https://github.com/mrdoob/eventdispatcher.js/ */ diff --git a/build/three.min.js b/build/three.min.js index af83564e624adc575ee01ceab00f0eccc5902b52..79d859ddf3cd50d8bf31ba1fd1a7f462465c6872 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -116,8 +116,9 @@ THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}(); THREE.extend(THREE.Triangle.prototype,{constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(), midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&& -a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.getDelta();return this.elapsedTime}; -THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;dg.scale.x)return i;i.push({distance:h,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(), +a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}; +THREE.extend(THREE.Clock.prototype,{start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(), +a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;dg.scale.x)return i;i.push({distance:h,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(), g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return i;var m=g.geometry,s=m.vertices,q=g.material instanceof a.MeshFaceMaterial,r=!0===q?g.material.materials:null,p=g.material.side,t,x,w,v=h.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(h.ray).transform(f);for(var H=0,F=m.faces.length;Hz)){p=p.side;if(p!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(p===a.FrontSide?0>t:0h.far)){e=c.at(z,e);if(A instanceof a.Face3){if(p=s[A.a],t=s[A.b],x=s[A.c],!a.Triangle.containsPoint(e,p,t,x))continue}else if(A instanceof a.Face4){if(p=s[A.a],t=s[A.b],x=s[A.c],w=s[A.d],!a.Triangle.containsPoint(e,p,t,w)&&!a.Triangle.containsPoint(e,t,x,w))continue}else throw Error("face type not supported");i.push({distance:z, point:h.ray.at(z),face:A,faceIndex:H,object:g})}}}}}},i=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d