提交 bcc825cc 编写于 作者: M Mr.doob

Updated builds.

上级 2c174fea
...@@ -5681,33 +5681,33 @@ THREE.Clock = function ( autoStart ) { ...@@ -5681,33 +5681,33 @@ THREE.Clock = function ( autoStart ) {
}; };
THREE.Clock.prototype.start = function () { THREE.extend( THREE.Clock.prototype, {
this.startTime = Date.now(); start: function () {
this.oldTime = this.startTime;
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;
}; },
THREE.Clock.prototype.getElapsedTime = function () { getElapsedTime: function () {
this.getDelta(); this.getDelta();
return this.elapsedTime; return this.elapsedTime;
}; },
THREE.Clock.prototype.getDelta = function () { getDelta: function () {
var diff = 0; var diff = 0;
...@@ -5719,7 +5719,10 @@ THREE.Clock.prototype.getDelta = function () { ...@@ -5719,7 +5719,10 @@ THREE.Clock.prototype.getDelta = function () {
if ( this.running ) { if ( this.running ) {
var newTime = Date.now(); var newTime = window.performance !== undefined && window.performance.now !== undefined
? window.performance.now()
: Date.now();
diff = 0.001 * ( newTime - this.oldTime ); diff = 0.001 * ( newTime - this.oldTime );
this.oldTime = newTime; this.oldTime = newTime;
...@@ -5729,7 +5732,10 @@ THREE.Clock.prototype.getDelta = function () { ...@@ -5729,7 +5732,10 @@ THREE.Clock.prototype.getDelta = function () {
return diff; return diff;
};/** }
} );
/**
* https://github.com/mrdoob/eventdispatcher.js/ * https://github.com/mrdoob/eventdispatcher.js/
*/ */
......
...@@ -116,8 +116,9 @@ THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE ...@@ -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.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()}}(), 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)&& 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}; 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.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;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.length()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Matrix4,g=function(a,b){return a.distance-b.distance},h=function(g,h,i){if(g instanceof a.Particle){h=h.ray.distanceToPoint(g.matrixWorld.getPosition());if(h>g.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(), 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;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.length()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Matrix4,g=function(a,b){return a.distance-b.distance},h=function(g,h,i){if(g instanceof a.Particle){h=h.ray.distanceToPoint(g.matrixWorld.getPosition());if(h>g.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;H<F;H++){var A=m.faces[H],p=!0===q?r[A.materialIndex]:g.material;if(void 0!==p){d.setFromNormalAndCoplanarPoint(A.normal, 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;H<F;H++){var A=m.faces[H],p=!0===q?r[A.materialIndex]:g.material;if(void 0!==p){d.setFromNormalAndCoplanarPoint(A.normal,
s[A.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<v)&&!(0>z)){p=p.side;if(p!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(p===a.FrontSide?0>t:0<t)))continue;if(!(z<h.near||z>h.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, s[A.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<v)&&!(0>z)){p=p.side;if(p!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(p===a.FrontSide?0>t:0<t)))continue;if(!(z<h.near||z>h.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<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&i(a,this,c);h(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d], 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<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&i(a,this,c);h(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册