From 731aaf3c461f76decd92103d97b554459c876724 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 16 Dec 2014 01:14:36 +0100 Subject: [PATCH] Updated builds. --- build/three.js | 25 ++++++++++++++++++++++++- build/three.min.js | 5 +++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/build/three.js b/build/three.js index 141da69b91..d33d3d334c 100644 --- a/build/three.js +++ b/build/three.js @@ -7211,9 +7211,32 @@ THREE.EventDispatcher.prototype = { set: function ( origin, direction ) { - this.ray.set( origin, direction ); // direction is assumed to be normalized (for accurate distance calculations) + this.ray.set( origin, direction ); + + }, + + setFromCamera: function ( coords, camera ) { + + // camera is assumed _not_ to be a child of a transformed object + + if ( camera instanceof THREE.PerspectiveCamera ) { + + this.ray.origin.copy( camera.position ); + this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( camera.position ).normalize(); + + } else if ( camera instanceof THREE.OrthographicCamera ) { + + this.ray.origin.set( coords.x, coords.y, - 1 ).unproject( camera ); + this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ); + + } else { + + console.error( 'THREE.Raycaster: Unsupported camera type.' ); + + } + }, intersectObject: function ( object, recursive ) { diff --git a/build/three.min.js b/build/three.min.js index e5f05c58ce..31cf314926 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -151,8 +151,9 @@ THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=thi a=.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){}; THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&& c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],d=b.length,e=0;e