Socket
Socket
Sign inDemoInstall

three

Package Overview
Dependencies
Maintainers
1
Versions
290
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three - npm Package Compare versions

Comparing version 0.56.4 to 0.58.1

examples/fonts/droid/droid_sans_bold.typeface.js

8

examples/js/AudioObject.js

@@ -41,3 +41,3 @@ /**

this.context = new webkitAudioContext();
THREE.AudioObject.prototype.context = new webkitAudioContext();

@@ -123,4 +123,3 @@ } catch( error ) {

cameraFront.set( 0, 0, -1 );
camera.matrixWorld.rotateAxis( cameraFront );
cameraFront.normalize();
cameraFront.transformDirection( camera.matrixWorld );

@@ -137,4 +136,3 @@ this.listener.setPosition( cameraPosition.x, cameraPosition.y, cameraPosition.z );

soundFront.set( 0, 0, -1 );
this.matrixWorld.rotateAxis( soundFront );
soundFront.normalize();
soundFront.transformDirection( this.matrixWorld );

@@ -141,0 +139,0 @@ soundUp.copy( this.up );

@@ -133,7 +133,9 @@ /**

case 0: this.object.moveForward = true; break;
case 2: this.object.moveBackward = true; break;
case 0: this.moveState.forward = 1; break;
case 2: this.moveState.back = 1; break;
}
this.updateMovementVector();
}

@@ -175,7 +177,9 @@

case 0: this.moveForward = false; break;
case 2: this.moveBackward = false; break;
case 0: this.moveState.forward = 0; break;
case 2: this.moveState.back = 0; break;
}
this.updateMovementVector();
}

@@ -257,2 +261,4 @@

this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
this.domElement.addEventListener( 'mousemove', bind( this, this.mousemove ), false );

@@ -259,0 +265,0 @@ this.domElement.addEventListener( 'mousedown', bind( this, this.mousedown ), false );

@@ -5,3 +5,3 @@ /**

* @author alteredq / http://alteredqualia.com/
* @author WestLangley / https://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
*/

@@ -11,4 +11,2 @@

THREE.EventDispatcher.call( this );
this.object = object;

@@ -19,2 +17,4 @@ this.domElement = ( domElement !== undefined ) ? domElement : document;

this.enabled = true;
this.center = new THREE.Vector3();

@@ -28,2 +28,5 @@

this.userPan = true;
this.userPanSpeed = 2.0;
this.autoRotate = false;

@@ -38,2 +41,4 @@ this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60

this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
// internals

@@ -60,3 +65,3 @@

var STATE = { NONE : -1, ROTATE : 0, ZOOM : 1 };
var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2 };
var state = STATE.NONE;

@@ -141,6 +146,16 @@

this.pan = function ( distance ) {
distance.transformDirection( this.object.matrix );
distance.multiplyScalar( scope.userPanSpeed );
this.object.position.add( distance );
this.center.add( distance );
};
this.update = function () {
var position = this.object.position;
var offset = position.clone().sub( this.center )
var offset = position.clone().sub( this.center );

@@ -212,7 +227,8 @@ // angle from z-axis around y-axis

if ( !scope.userRotate ) return;
if ( scope.enabled === false ) return;
if ( scope.userRotate === false ) return;
event.preventDefault();
if ( event.button === 0 || event.button === 2 ) {
if ( event.button === 0 ) {

@@ -229,2 +245,6 @@ state = STATE.ROTATE;

} else if ( event.button === 2 ) {
state = STATE.PAN;
}

@@ -239,2 +259,4 @@

if ( scope.enabled === false ) return;
event.preventDefault();

@@ -269,2 +291,9 @@

} else if ( state === STATE.PAN ) {
var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
scope.pan( new THREE.Vector3( - movementX, movementY, 0 ) );
}

@@ -276,3 +305,4 @@

if ( ! scope.userRotate ) return;
if ( scope.enabled === false ) return;
if ( scope.userRotate === false ) return;

@@ -288,3 +318,4 @@ document.removeEventListener( 'mousemove', onMouseMove, false );

if ( ! scope.userZoom ) return;
if ( scope.enabled === false ) return;
if ( scope.userZoom === false ) return;

@@ -315,2 +346,25 @@ var delta = 0;

function onKeyDown( event ) {
if ( scope.enabled === false ) return;
if ( scope.userPan === false ) return;
switch ( event.keyCode ) {
case scope.keys.UP:
scope.pan( new THREE.Vector3( 0, 1, 0 ) );
break;
case scope.keys.BOTTOM:
scope.pan( new THREE.Vector3( 0, - 1, 0 ) );
break;
case scope.keys.LEFT:
scope.pan( new THREE.Vector3( - 1, 0, 0 ) );
break;
case scope.keys.RIGHT:
scope.pan( new THREE.Vector3( 1, 0, 0 ) );
break;
}
}
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );

@@ -320,3 +374,6 @@ this.domElement.addEventListener( 'mousedown', onMouseDown, false );

this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
this.domElement.addEventListener( 'keydown', onKeyDown, false );
};
THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );

@@ -7,4 +7,2 @@ /**

THREE.EventDispatcher.call( this );
var _this = this;

@@ -434,3 +432,3 @@ var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5 };

_zoomStart.y += ( 1 / delta ) * 0.05;
_zoomStart.y += delta * 0.01;

@@ -540,1 +538,3 @@ }

};
THREE.TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype );

@@ -9,23 +9,28 @@ /**

THREE.OculusRiftEffect = function ( renderer ) {
THREE.OculusRiftEffect = function ( renderer, options ) {
// worldFactor indicates how many units is 1 meter
var worldFactor = (options && options.worldFactor) ? options.worldFactor: 1.0;
// Configuration
this.separation = 10;
this.distortion = 0.1;
this.aspectFactor = 1;
this.fov = null; // use original camera FOV
// Specific HMD parameters
var HMD = (options && options.HMD) ? options.HMD: {
// Parameters from the Oculus Rift DK1
hResolution: 1280,
vResolution: 800,
hScreenSize: 0.14976,
vScreenSize: 0.0936,
interpupillaryDistance: 0.064,
lensSeparationDistance: 0.064,
eyeToScreenDistance: 0.041,
distortionK : [1.0, 0.22, 0.24, 0.0]
};
// initialization
var _width, _height;
// Perspective camera
var pCamera = new THREE.PerspectiveCamera();
pCamera.matrixAutoUpdate = false;
pCamera.target = new THREE.Vector3();
var _pCamera = new THREE.PerspectiveCamera();
_pCamera.matrixAutoUpdate = false;
_pCamera.target = new THREE.Vector3();
// Orthographic camera
var oCamera = new THREE.OrthographicCamera( -1, 1, 1, -1, 1, 1000 );
oCamera.position.z = 1;
var _scene = new THREE.Scene();
var _oCamera = new THREE.OrthographicCamera( -1, 1, 1, -1, 1, 1000 );
_oCamera.position.z = 1;
_scene.add( _oCamera );
// pre-render hooks

@@ -36,9 +41,14 @@ this.preLeftRender = function() {};

renderer.autoClear = false;
var emptyColor = new THREE.Color("black");
var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
var _renderTarget = new THREE.WebGLRenderTarget( 800, 600, _params );
var _material = new THREE.ShaderMaterial( {
// Render target
var RTParams = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
var renderTarget = new THREE.WebGLRenderTarget( 640, 800, RTParams );
var RTMaterial = new THREE.ShaderMaterial( {
uniforms: {
"tex": { type: "t", value: _renderTarget },
"c": { type: "f", value: this.distortion }
"texid": { type: "t", value: renderTarget },
"scale": { type: "v2", value: new THREE.Vector2(1.0,1.0) },
"scaleIn": { type: "v2", value: new THREE.Vector2(1.0,1.0) },
"lensCenter": { type: "v2", value: new THREE.Vector2(0.0,0.0) },
"hmdWarpParam": { type: "v4", value: new THREE.Vector4(1.0,0.0,0.0,0.0) }
},

@@ -53,49 +63,95 @@ vertexShader: [

// Formula used from the paper: "Applying and removing lens distortion in post production"
// by Gergely Vass , Tamás Perlaki
// http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.136.3745
fragmentShader: [
"uniform float c;",
"uniform sampler2D tex;",
"uniform vec2 scale;",
"uniform vec2 scaleIn;",
"uniform vec2 lensCenter;",
"uniform vec4 hmdWarpParam;",
"uniform sampler2D texid;",
"varying vec2 vUv;",
"void main()",
"{",
" vec2 uv = vUv;",
" vec2 vector = uv * 2.0 - 1.0;",
" float factor = 1.0/(1.0+c);",
" float vectorLen = length(vector);",
" vec2 direction = vector / vectorLen;",
" float newLen = vectorLen + c * pow(vectorLen,3.0);",
" vec2 newVector = direction * newLen * factor;",
" newVector = (newVector + 1.0) / 2.0;",
" if (newVector.x < 0.0 || newVector.x > 1.0 || newVector.y < 0.0 || newVector.y > 1.0)",
" gl_FragColor = vec4(0.0,0.0,0.0,1.0);",
" else",
" gl_FragColor = texture2D(tex, newVector);",
" vec2 uv = (vUv*2.0)-1.0;", // range from [0,1] to [-1,1]
" vec2 theta = (uv-lensCenter)*scaleIn;",
" float rSq = theta.x*theta.x + theta.y*theta.y;",
" vec2 rvector = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq);",
" vec2 tc = (lensCenter + scale * rvector);",
" tc = (tc+1.0)/2.0;", // range from [-1,1] to [0,1]
" if (any(bvec2(clamp(tc, vec2(0.0,0.0), vec2(1.0,1.0))-tc)))",
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
" else",
" gl_FragColor = texture2D(texid, tc);",
"}"
].join("\n")
} );
var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material );
_scene.add( mesh );
var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), RTMaterial );
// Final scene
var finalScene = new THREE.Scene();
finalScene.add( oCamera );
finalScene.add( mesh );
var left = {}, right = {};
var distScale = 1.0;
this.setHMD = function(v) {
HMD = v;
// Compute aspect ratio and FOV
var aspect = HMD.hResolution / (2*HMD.vResolution);
// Fov is normally computed with:
// THREE.Math.radToDeg( 2*Math.atan2(HMD.vScreenSize,2*HMD.eyeToScreenDistance) );
// But with lens distortion it is increased (see Oculus SDK Documentation)
var r = -1.0 - (4 * (HMD.hScreenSize/4 - HMD.lensSeparationDistance/2) / HMD.hScreenSize);
distScale = (HMD.distortionK[0] + HMD.distortionK[1] * Math.pow(r,2) + HMD.distortionK[2] * Math.pow(r,4) + HMD.distortionK[3] * Math.pow(r,6));
var fov = THREE.Math.radToDeg(2*Math.atan2(HMD.vScreenSize*distScale, 2*HMD.eyeToScreenDistance));
// Compute camera projection matrices
var proj = (new THREE.Matrix4()).makePerspective( fov, aspect, 0.3, 10000 );
var h = 4 * (HMD.hScreenSize/4 - HMD.interpupillaryDistance/2) / HMD.hScreenSize;
left.proj = ((new THREE.Matrix4()).makeTranslation( h, 0.0, 0.0 )).multiply(proj);
right.proj = ((new THREE.Matrix4()).makeTranslation( -h, 0.0, 0.0 )).multiply(proj);
// Compute camera transformation matrices
left.tranform = (new THREE.Matrix4()).makeTranslation( -worldFactor * HMD.interpupillaryDistance/2, 0.0, 0.0 );
right.tranform = (new THREE.Matrix4()).makeTranslation( worldFactor * HMD.interpupillaryDistance/2, 0.0, 0.0 );
// Compute Viewport
left.viewport = [0, 0, HMD.hResolution/2, HMD.vResolution];
right.viewport = [HMD.hResolution/2, 0, HMD.hResolution/2, HMD.vResolution];
// Distortion shader parameters
var lensShift = 4 * (HMD.hScreenSize/4 - HMD.lensSeparationDistance/2) / HMD.hScreenSize;
left.lensCenter = new THREE.Vector2(lensShift, 0.0);
right.lensCenter = new THREE.Vector2(-lensShift, 0.0);
RTMaterial.uniforms['hmdWarpParam'].value = new THREE.Vector4(HMD.distortionK[0], HMD.distortionK[1], HMD.distortionK[2], HMD.distortionK[3]);
RTMaterial.uniforms['scaleIn'].value = new THREE.Vector2(1.0,1.0/aspect);
RTMaterial.uniforms['scale'].value = new THREE.Vector2(1.0/distScale, 1.0*aspect/distScale);
// Create render target
renderTarget = new THREE.WebGLRenderTarget( HMD.hResolution*distScale/2, HMD.vResolution*distScale, RTParams );
RTMaterial.uniforms[ "texid" ].value = renderTarget;
}
this.getHMD = function() {return HMD};
this.setHMD(HMD);
this.setSize = function ( width, height ) {
_width = width / 2;
_height = height;
_renderTarget = new THREE.WebGLRenderTarget( width, height, _params );
_material.uniforms[ "tex" ].value = _renderTarget;
left.viewport = [width/2 - HMD.hResolution/2, height/2 - HMD.vResolution/2, HMD.hResolution/2, HMD.vResolution];
right.viewport = [width/2, height/2 - HMD.vResolution/2, HMD.hResolution/2, HMD.vResolution];
renderer.setSize( width, height );
};
this.render = function ( scene, camera ) {
var cc = renderer.getClearColor().clone();
// Clear
renderer.setClearColor(emptyColor);
renderer.clear();
_material.uniforms['c'].value = this.distortion;
renderer.setClearColor(cc);
// camera parameters
if (camera.matrixAutoUpdate) camera.updateMatrix();
_pCamera.fov = this.fov ? this.fov : camera.fov;
_pCamera.aspect = camera.aspect / (2*this.aspectFactor);
_pCamera.near = camera.near;
_pCamera.far = camera.far;
_pCamera.updateProjectionMatrix();

@@ -105,25 +161,31 @@ // Render left

var offset = new THREE.Vector3(-this.separation,0,0);
_pCamera.matrix.copy(camera.matrix);
_pCamera.matrix.translate(offset);
_pCamera.matrixWorldNeedsUpdate = true;
pCamera.projectionMatrix.copy(left.proj);
renderer.setViewport( 0, 0, _width, _height );
renderer.render( scene, _pCamera, _renderTarget, true );
renderer.render( _scene, _oCamera );
pCamera.matrix.copy(camera.matrix).multiply(left.tranform);
pCamera.matrixWorldNeedsUpdate = true;
renderer.setViewport(left.viewport[0], left.viewport[1], left.viewport[2], left.viewport[3]);
RTMaterial.uniforms['lensCenter'].value = left.lensCenter;
renderer.render( scene, pCamera, renderTarget, true );
renderer.render( finalScene, oCamera );
// Render right
this.preRightRender();
offset.set(this.separation,0,0);
_pCamera.matrix.copy(camera.matrix);
_pCamera.matrix.translate(offset);
_pCamera.matrixWorldNeedsUpdate = true;
pCamera.projectionMatrix.copy(right.proj);
renderer.setViewport( _width, 0, _width, _height );
renderer.render( scene, _pCamera, _renderTarget, true );
pCamera.matrix.copy(camera.matrix).multiply(right.tranform);
pCamera.matrixWorldNeedsUpdate = true;
renderer.render( _scene, _oCamera );
renderer.setViewport(right.viewport[0], right.viewport[1], right.viewport[2], right.viewport[3]);
RTMaterial.uniforms['lensCenter'].value = right.lensCenter;
renderer.render( scene, pCamera, renderTarget, true );
renderer.render( finalScene, oCamera );
};
};

@@ -13,2 +13,10 @@ /**

var output = {
metadata: {
version: 4.0,
type: 'geometry',
generator: 'GeometryExporter'
}
};
var vertices = [];

@@ -33,9 +41,9 @@

var isTriangle = face instanceof THREE.Face3;
var hasMaterial = face.materialIndex !== undefined;
var hasFaceUv = geometry.faceUvs[ 0 ][ i ] !== undefined;
var hasFaceVertexUv = geometry.faceVertexUvs[ 0 ][ i ] !== undefined;
var hasMaterial = false; // face.materialIndex !== undefined;
var hasFaceUv = false; // geometry.faceUvs[ 0 ][ i ] !== undefined;
var hasFaceVertexUv = false; // geometry.faceVertexUvs[ 0 ][ i ] !== undefined;
var hasFaceNormal = face.normal.length() > 0;
var hasFaceVertexNormal = face.vertexNormals[ 0 ] !== undefined;
var hasFaceColor = face.color;
var hasFaceVertexColor = face.vertexColors[ 0 ] !== undefined;
var hasFaceColor = false; // face.color;
var hasFaceVertexColor = false; // face.vertexColors[ 0 ] !== undefined;

@@ -45,9 +53,9 @@ var faceType = 0;

faceType = setBit( faceType, 0, ! isTriangle );
// faceType = setBit( faceType, 1, hasMaterial );
// faceType = setBit( faceType, 2, hasFaceUv );
// faceType = setBit( faceType, 3, hasFaceVertexUv );
faceType = setBit( faceType, 1, hasMaterial );
faceType = setBit( faceType, 2, hasFaceUv );
faceType = setBit( faceType, 3, hasFaceVertexUv );
faceType = setBit( faceType, 4, hasFaceNormal );
faceType = setBit( faceType, 5, hasFaceVertexNormal );
// faceType = setBit( faceType, 6, hasFaceColor );
// faceType = setBit( faceType, 7, hasFaceVertexColor );
faceType = setBit( faceType, 6, hasFaceColor );
faceType = setBit( faceType, 7, hasFaceVertexColor );

@@ -150,32 +158,24 @@ faces.push( faceType );

var hash = x.toString() + y.toString() + z.toString();
var hash = x.toString() + y.toString() + z.toString();
if ( normalsHash[ hash ] !== undefined ) {
if ( normalsHash[ hash ] !== undefined ) {
return normalsHash[ hash ];
return normalsHash[ hash ];
}
}
normalsHash[ hash ] = normals.length / 3;
normals.push( x, y, z );
normalsHash[ hash ] = normals.length / 3;
normals.push( x, y, z );
return normalsHash[ hash ];
return normalsHash[ hash ];
}
output.vertices = vertices;
output.normals = normals;
output.uvs = uvs;
output.faces = faces;
//
var output = JSON.stringify( {
metadata: {
formatVersion: 3.1,
generatedBy: "GeometryExporter",
},
vertices: vertices,
normals: normals,
uvs: uvs,
faces: faces
}, null, '\t' );
// output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
return output;

@@ -185,2 +185,2 @@

}
};

@@ -146,3 +146,3 @@ /**

if ( node instanceof THREE.Camera && node.properties.active ) {
if ( node instanceof THREE.Camera && node.userData.active ) {

@@ -751,3 +751,3 @@ activeCamera = node;

return output;
return JSON.parse( output );

@@ -754,0 +754,0 @@ }

@@ -9,4 +9,2 @@ /**

THREE.EventDispatcher.call( this );
this.baseUrl = baseUrl;

@@ -19,2 +17,9 @@ this.options = options;

constructor: THREE.MTLLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
/**

@@ -155,4 +160,2 @@ * Loads a MTL file

THREE.EventDispatcher.call( this );
this.baseUrl = baseUrl;

@@ -172,2 +175,4 @@ this.options = options;

constructor: THREE.MTLLoader.MaterialCreator,
setMaterials: function( materialsInfo ) {

@@ -174,0 +179,0 @@

@@ -5,8 +5,4 @@ /**

THREE.OBJLoader = function () {
THREE.OBJLoader = function () {};
THREE.EventDispatcher.call( this );
};
THREE.OBJLoader.prototype = {

@@ -16,2 +12,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function ( url, callback ) {

@@ -24,7 +25,7 @@

var hierarchy = scope.parse( event.target.responseText );
var response = scope.parse( event.target.responseText );
scope.dispatchEvent( { type: 'load', content: hierarchy } );
scope.dispatchEvent( { type: 'load', content: response } );
if ( callback ) callback( hierarchy );
if ( callback ) callback( response );

@@ -126,27 +127,27 @@ }, false );

var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vn float float float
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vt float float
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/
// f vertex vertex vertex ...
var face_pattern1 = /f( +[\d]+)( [\d]+)( [\d]+)( [\d]+)?/;
var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/
// f vertex/uv vertex/uv vertex/uv ...
var face_pattern2 = /f( +([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))?/;
var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/;
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
var face_pattern3 = /f( +([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))?/;
var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/;
// f vertex//normal vertex//normal vertex//normal ...
var face_pattern4 = /f( +([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))?/;
var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/;

@@ -432,2 +433,2 @@ //

}
};

@@ -8,8 +8,4 @@ /**

THREE.OBJMTLLoader = function () {
THREE.OBJMTLLoader = function () {};
THREE.EventDispatcher.call( this );
};
THREE.OBJMTLLoader.prototype = {

@@ -19,2 +15,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
/**

@@ -259,27 +260,27 @@ * Load a Wavefront OBJ file with materials (MTL file)

var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vn float float float
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vt float float
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( [\d|\.|\+|\-|e]+)/;
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/
// f vertex vertex vertex ...
var face_pattern1 = /f( +[\d]+)( [\d]+)( [\d]+)( [\d]+)?/;
var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/
// f vertex/uv vertex/uv vertex/uv ...
var face_pattern2 = /f( +([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))( ([\d]+)\/([\d]+))?/;
var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/;
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
var face_pattern3 = /f( +([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))( ([\d]+)\/([\d]+)\/([\d]+))?/;
var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/;
// f vertex//normal vertex//normal vertex//normal ...
var face_pattern4 = /f( +([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))( ([\d]+)\/\/([\d]+))?/;
var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/;

@@ -567,6 +568,6 @@ //

}
//Add last object
meshN(undefined, undefined);
return group;

@@ -573,0 +574,0 @@

/**
* @author aleeper / http://adamleeper.com/
* @author mrdoob / http://mrdoob.com/
* @author gero3 / https://github.com/gero3
*

@@ -25,172 +26,305 @@ * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs.

THREE.STLLoader = function () {
THREE.STLLoader = function () {};
THREE.EventDispatcher.call( this );
THREE.STLLoader.prototype = {
constructor: THREE.STLLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent
};
THREE.STLLoader.prototype = {
THREE.STLLoader.prototype.load = function (url, callback) {
constructor: THREE.STLLoader,
var scope = this;
load: function ( url, callback ) {
var xhr = new XMLHttpRequest();
var scope = this;
var request = new XMLHttpRequest();
function onloaded( event ) {
request.addEventListener( 'load', function ( event ) {
if ( event.target.status === 200 || event.target.status === 0 ) {
var geometry;
geometry = scope.parse( event.target.response );
var geometry = scope.parse( event.target.responseText );
scope.dispatchEvent( { type: 'load', content: geometry } );
scope.dispatchEvent( { type: 'load', content: geometry } );
if ( callback ) callback( geometry );
if ( callback ) callback( geometry );
}, false );
} else {
request.addEventListener( 'progress', function ( event ) {
scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']',
response: event.target.responseText } );
scope.dispatchEvent( { type: 'progress', loaded: event.loaded, total: event.total } );
}
}, false );
}
request.addEventListener( 'error', function () {
xhr.addEventListener( 'load', onloaded, false );
scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } );
xhr.addEventListener( 'progress', function ( event ) {
}, false );
scope.dispatchEvent( { type: 'progress', loaded: event.loaded, total: event.total } );
request.open( 'GET', url, true );
request.responseType = "arraybuffer";
request.send( null );
}, false );
},
xhr.addEventListener( 'error', function () {
bin2str: function (buf) {
scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } );
var array_buffer = new Uint8Array(buf);
var str = '';
for(var i = 0; i < buf.byteLength; i++) {
str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian
}, false );
xhr.overrideMimeType('text/plain; charset=x-user-defined');
xhr.open( 'GET', url, true );
xhr.send( null );
};
THREE.STLLoader.prototype.parse = function (data) {
var isBinary = function (data) {
var expect, face_size, n_faces, reader;
reader = new THREE.STLLoader.BinaryReader(data);
reader.seek(80);
face_size = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);
n_faces = reader.readUInt32();
expect = 80 + (32 / 8) + (n_faces * face_size);
return expect === reader.getSize();
};
if (isBinary(data)) {
return this.parseBinary(data);
} else {
return this.parseASCII(data);
}
};
THREE.STLLoader.prototype.parseBinary = function (data) {
var face, geometry, n_faces, reader, length, normal, i;
reader = new THREE.STLLoader.BinaryReader(data);
reader.seek(80);
n_faces = reader.readUInt32();
geometry = new THREE.Geometry();
for (face = 0; face < n_faces; face++) {
normal = new THREE.Vector3(reader.readFloat(),reader.readFloat(),reader.readFloat());
for (i = 1; i <= 3; i++) {
geometry.vertices.push(new THREE.Vector3(reader.readFloat(),reader.readFloat(),reader.readFloat()));
}
return str
},
reader.readUInt16(); // attr doesn't get used yet.
length = geometry.vertices.length;
geometry.faces.push(new THREE.Face3(length - 3, length - 2, length - 1, normal));
isASCII: function(buf){
}
var dv = new DataView(buf);
var str = '';
for(var i = 0; i < 5; i++) {
str += String.fromCharCode(dv.getUint8(i, true)); // assume little-endian
geometry.computeCentroids();
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
return geometry;
};
THREE.STLLoader.prototype.parseASCII = function (data) {
var geometry, length, normal, patternFace, patternNormal, patternVertex, result, text;
geometry = new THREE.Geometry();
patternFace = /facet([\s\S]*?)endfacet/g;
while (((result = patternFace.exec(data)) != null)) {
text = result[0];
patternNormal = /normal[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
while (((result = patternNormal.exec(text)) != null)) {
normal = new THREE.Vector3(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5]));
}
return (str.toLowerCase() === 'solid'); // All ASCII stl files begin with 'solid'
},
patternVertex = /vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
parse: function (buf) {
while (((result = patternVertex.exec(text)) != null)) {
if( this.isASCII(buf) )
{
var str = this.bin2str(buf);
return this.parseASCII(str);
geometry.vertices.push(new THREE.Vector3(parseFloat(result[1]), parseFloat(result[3]), parseFloat(result[5])));
}
else
{
return this.parseBinary(buf);
}
},
length = geometry.vertices.length;
geometry.faces.push(new THREE.Face3(length - 3, length - 2, length - 1, normal));
parseASCII: function ( data ) {
}
var geometry = new THREE.Geometry();
geometry.computeCentroids();
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
var patternFace = /facet([\s\S]*?)endfacet/g;
var result;
return geometry;
while ( ( result = patternFace.exec( data ) ) != null ) {
};
var text = result[ 0 ];
// Normal
var patternNormal = /normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g;
THREE.STLLoader.BinaryReader = function (data) {
while ( ( result = patternNormal.exec( text ) ) != null ) {
this._buffer = data;
this._pos = 0;
var normal = new THREE.Vector3( parseFloat( result[ 1 ] ), parseFloat( result[ 3 ] ), parseFloat( result[ 5 ] ) );
};
}
THREE.STLLoader.BinaryReader.prototype = {
// Vertex
var patternVertex = /vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g;
/* Public */
while ( ( result = patternVertex.exec( text ) ) != null ) {
readInt8: function (){ return this._decodeInt(8, true); },
readUInt8: function (){ return this._decodeInt(8, false); },
readInt16: function (){ return this._decodeInt(16, true); },
readUInt16: function (){ return this._decodeInt(16, false); },
readInt32: function (){ return this._decodeInt(32, true); },
readUInt32: function (){ return this._decodeInt(32, false); },
geometry.vertices.push( new THREE.Vector3( parseFloat( result[ 1 ] ), parseFloat( result[ 3 ] ), parseFloat( result[ 5 ] ) ) );
readFloat: function (){ return this._decodeFloat(23, 8); },
readDouble: function (){ return this._decodeFloat(52, 11); },
readChar: function () { return this.readString(1); },
readString: function (length) {
this._checkSize(length * 8);
var result = this._buffer.substr(this._pos, length);
this._pos += length;
return result;
},
seek: function (pos) {
this._pos = pos;
this._checkSize(0);
},
getPosition: function () {
return this._pos;
},
getSize: function () {
return this._buffer.length;
},
/* Private */
_decodeFloat: function(precisionBits, exponentBits){
var length = precisionBits + exponentBits + 1;
var size = length >> 3;
this._checkSize(length);
var bias = Math.pow(2, exponentBits - 1) - 1;
var signal = this._readBits(precisionBits + exponentBits, 1, size);
var exponent = this._readBits(precisionBits, exponentBits, size);
var significand = 0;
var divisor = 2;
// var curByte = length + (-precisionBits >> 3) - 1;
var curByte = 0;
do {
var byteValue = this._readByte(++curByte, size);
var startBit = precisionBits % 8 || 8;
var mask = 1 << startBit;
while (mask >>= 1) {
if (byteValue & mask) {
significand += 1 / divisor;
}
divisor *= 2;
}
} while (precisionBits -= startBit);
var len = geometry.vertices.length;
geometry.faces.push( new THREE.Face3( len - 3, len - 2, len - 1, normal ) );
this._pos += size;
}
return exponent == (bias << 1) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity
: (1 + signal * -2) * (exponent || significand ? !exponent ? Math.pow(2, -bias + 1) * significand
: Math.pow(2, exponent - bias) * (1 + significand) : 0);
geometry.computeCentroids();
geometry.computeBoundingSphere();
},
return geometry;
_decodeInt: function(bits, signed){
var x = this._readBits(0, bits, bits / 8), max = Math.pow(2, bits);
var result = signed && x >= max / 2 ? x - max : x;
this._pos += bits / 8;
return result;
},
parseBinary: function (buf) {
//shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni)
_shl: function (a, b){
// STL binary format specification, as per http://en.wikipedia.org/wiki/STL_(file_format)
//
// UINT8[80] – Header
// UINT32 – Number of triangles
//
// foreach triangle
// REAL32[3] – Normal vector
// REAL32[3] – Vertex 1
// REAL32[3] – Vertex 2
// REAL32[3] – Vertex 3
// UINT16 – Attribute byte count
// end
//
for (++b; --b; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1);
return a;
var geometry = new THREE.Geometry();
},
var headerLength = 80;
var dataOffset = 84;
var faceLength = 12*4 + 2;
_readByte: function (i, size) {
var le = true; // is little-endian // This might be processor dependent...
return this._buffer.charCodeAt(this._pos + size - i - 1) & 0xff;
// var header = new Uint8Array(buf, 0, headerLength); // not presently used
var dvTriangleCount = new DataView(buf, headerLength, 4);
var numTriangles = dvTriangleCount.getUint32(0, le);
},
for (var i = 0; i < numTriangles; i++) {
_readBits: function (start, length, size) {
var dv = new DataView(buf, dataOffset + i*faceLength, faceLength);
var offsetLeft = (start + length) % 8;
var offsetRight = start % 8;
var curByte = size - (start >> 3) - 1;
var lastByte = size + (-(start + length) >> 3);
var diff = curByte - lastByte;
var normal = new THREE.Vector3( dv.getFloat32(0, le), dv.getFloat32(4, le), dv.getFloat32(8, le) );
var sum = (this._readByte(curByte, size) >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1);
for(var v = 3; v < 12; v+=3) {
if (diff && offsetLeft) {
geometry.vertices.push( new THREE.Vector3( dv.getFloat32(v*4, le), dv.getFloat32((v+1)*4, le), dv.getFloat32( (v+2)*4, le ) ) );
sum += (this._readByte(lastByte++, size) & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight;
}
var len = geometry.vertices.length;
geometry.faces.push( new THREE.Face3( len - 3, len - 2, len - 1, normal ) );
}
geometry.computeCentroids();
geometry.computeBoundingSphere();
while (diff) {
return geometry;
sum += this._shl(this._readByte(lastByte++, size), (diff-- << 3) - offsetRight);
}
return sum;
},
_checkSize: function (neededBits) {
if (!(this._pos + Math.ceil(neededBits / 8) < this._buffer.length)) {
throw new Error("Index out of bound");
}
}
};

@@ -5,8 +5,4 @@ /**

THREE.VTKLoader = function () {
THREE.VTKLoader = function () {};
THREE.EventDispatcher.call( this );
};
THREE.VTKLoader.prototype = {

@@ -16,2 +12,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function ( url, callback ) {

@@ -118,2 +119,2 @@

}
};

@@ -172,3 +172,3 @@ /**

_tmpMatrix.transpose();
_tmpMatrix.extractPosition( object.matrixWorld );
_tmpMatrix.copyPosition( object.matrixWorld );
_tmpMatrix.scale( object.scale );

@@ -175,0 +175,0 @@

@@ -50,2 +50,8 @@ /**

this.setClearColor = function ( color, alpha ) {
// TODO
};
this.setSize = function ( width, height ) {

@@ -96,2 +102,7 @@

rectx1 = Infinity;
recty1 = Infinity;
rectx2 = 0;
recty2 = 0;
for ( var i = 0; i < numBlocks; i ++ ) {

@@ -108,9 +119,4 @@

rectx1 = Infinity;
recty1 = Infinity;
rectx2 = 0;
recty2 = 0;
if ( this.autoClear === true ) this.clear();
if ( this.autoClear ) this.clear();
var renderData = projector.projectScene( scene, camera );

@@ -122,3 +128,4 @@ var elements = renderData.elements;

var element = elements[ e ];
var shader = getMaterialShader( element.material );
var material = element.material;
var shader = getMaterialShader( material );

@@ -131,3 +138,3 @@ if ( element instanceof THREE.RenderableFace3 ) {

element.v3.positionScreen,
shader
shader, element, material
)

@@ -141,3 +148,3 @@

element.v4.positionScreen,
shader
shader, element, material
);

@@ -149,3 +156,3 @@

element.v4.positionScreen,
shader
shader, element, material
);

@@ -196,38 +203,41 @@

if ( material instanceof THREE.MeshBasicMaterial ) {
if ( material instanceof THREE.MeshBasicMaterial ||
material instanceof THREE.MeshLambertMaterial ||
material instanceof THREE.MeshPhongMaterial ) {
shader = new Function(
'buffer, offset, u, v',
[
'buffer[ offset ] = ' + ( material.color.r * 255 ) + ';',
'buffer[ offset + 1 ] = ' + ( material.color.g * 255 ) + ';',
'buffer[ offset + 2 ] = ' + ( material.color.b * 255 ) + ';',
'buffer[ offset + 3 ] = ' + ( material.opacity * 255 ) + ';',
].join('\n')
);
var string;
} else if ( material instanceof THREE.MeshLambertMaterial ) {
if ( material.vertexColors === THREE.FaceColors ) {
shader = new Function(
'buffer, offset, u, v',
[
'buffer[ offset ] = ' + ( material.color.r * 255 ) + ';',
'buffer[ offset + 1 ] = ' + ( material.color.g * 255 ) + ';',
'buffer[ offset + 2 ] = ' + ( material.color.b * 255 ) + ';',
'buffer[ offset + 3 ] = ' + ( material.opacity * 255 ) + ';',
].join('\n')
);
string = [
'buffer[ offset ] = face.color.r * 255;',
'buffer[ offset + 1 ] = face.color.g * 255;',
'buffer[ offset + 2 ] = face.color.b * 255;',
'buffer[ offset + 3 ] = material.opacity * 255;',
].join('\n');
} else {
string = [
'buffer[ offset ] = material.color.r * 255;',
'buffer[ offset + 1 ] = material.color.g * 255;',
'buffer[ offset + 2 ] = material.color.b * 255;',
'buffer[ offset + 3 ] = material.opacity * 255;',
].join('\n');
}
shader = new Function( 'buffer, offset, u, v, face, material', string );
} else {
shader = new Function(
'buffer, offset, u, v',
[
'buffer[ offset ] = u * 255;',
'buffer[ offset + 1 ] = v * 255;',
'buffer[ offset + 2 ] = 0;',
'buffer[ offset + 3 ] = 255;'
].join('\n')
);
var string = [
'buffer[ offset ] = u * 255;',
'buffer[ offset + 1 ] = v * 255;',
'buffer[ offset + 2 ] = 0;',
'buffer[ offset + 3 ] = 255;'
].join('\n');
shader = new Function( 'buffer, offset, u, v', string );
}

@@ -250,3 +260,3 @@

var offset = ( xmin + ymin * canvasWidth - 1 ) * 4 + 3;
var offset = ( xmin + ymin * canvasWidth ) * 4 + 3;
var linestep = ( canvasWidth - ( xmax - xmin ) ) * 4;

@@ -268,3 +278,3 @@

function drawTriangle( v1, v2, v3, shader ) {
function drawTriangle( v1, v2, v3, shader, face, material ) {

@@ -464,3 +474,3 @@ // TODO: Implement per-pixel z-clipping

var v = cx2 * scale;
shader( data, offset * 4, u, v );
shader( data, offset * 4, u, v, face, material );
}

@@ -507,3 +517,3 @@

zbuffer[ offset ] = z;
shader( data, offset * 4, u, v );
shader( data, offset * 4, u, v, face, material );

@@ -510,0 +520,0 @@ }

@@ -20,6 +20,4 @@ /**

_enableLighting = false,
_color = new THREE.Color(),
_diffuseColor = new THREE.Color(),
_emissiveColor = new THREE.Color(),
_ambientLight = new THREE.Color(),

@@ -69,2 +67,8 @@ _directionalLights = new THREE.Color(),

this.setClearColor = function ( color, alpha ) {
// TODO
};
this.setSize = function( width, height ) {

@@ -86,2 +90,6 @@

_pathCount = 0;
_circleCount = 0;
_lineCount = 0;
while ( _svg.childNodes.length > 0 ) {

@@ -104,6 +112,4 @@

var e, el, element, material;
if ( this.autoClear === true ) this.clear();
this.autoClear && this.clear();
_this.info.render.vertices = 0;

@@ -116,18 +122,9 @@ _this.info.render.faces = 0;

_pathCount = 0; _circleCount = 0; _lineCount = 0;
calculateLights( _lights );
_enableLighting = _lights.length > 0;
for ( var e = 0, el = _elements.length; e < el; e ++ ) {
if ( _enableLighting ) {
var element = _elements[ e ];
var material = element.material;
calculateLights( _lights );
}
for ( e = 0, el = _elements.length; e < el; e ++ ) {
element = _elements[ e ];
material = element.material;
if ( material === undefined || material.visible === false ) continue;

@@ -142,3 +139,3 @@

renderParticle( _v1, element, material, scene );
renderParticle( _v1, element, material );

@@ -156,3 +153,3 @@ } else if ( element instanceof THREE.RenderableLine ) {

renderLine( _v1, _v2, element, material, scene );
renderLine( _v1, _v2, element, material );

@@ -173,6 +170,14 @@ }

_elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen ] );
_elemBox.setFromPoints( [
_v1.positionScreen,
_v2.positionScreen,
_v3.positionScreen
] );
renderFace3( _v1, _v2, _v3, element, material, scene );
if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
renderFace3( _v1, _v2, _v3, element, material );
}
} else if ( element instanceof THREE.RenderableFace4 ) {

@@ -192,6 +197,15 @@

_elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen, _v4.positionScreen ] );
_elemBox.setFromPoints( [
_v1.positionScreen,
_v2.positionScreen,
_v3.positionScreen,
_v4.positionScreen
] );
renderFace4( _v1, _v2, _v3, _v4, element, material, scene );
if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
renderFace4( _v1, _v2, _v3, _v4, element, material );
}
}

@@ -205,4 +219,2 @@

var l, ll, light, lightColor;
_ambientLight.setRGB( 0, 0, 0 );

@@ -212,6 +224,6 @@ _directionalLights.setRGB( 0, 0, 0 );

for ( l = 0, ll = lights.length; l < ll; l++ ) {
for ( var l = 0, ll = lights.length; l < ll; l++ ) {
light = lights[ l ];
lightColor = light.color;
var light = lights[ l ];
var lightColor = light.color;

@@ -287,3 +299,3 @@ if ( light instanceof THREE.AmbientLight ) {

function renderParticle( v1, element, material, scene ) {
function renderParticle( v1, element, material ) {

@@ -298,20 +310,12 @@ /*

if ( _enableLighting ) {
_color.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
_color.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
_color.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
_color.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
_color.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
_color.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
_color.r = material.color.r * _color.r;
_color.g = material.color.g * _color.g;
_color.b = material.color.b * _color.b;
_color.r = material.color.r * _color.r;
_color.g = material.color.g * _color.g;
_color.b = material.color.b * _color.b;
_color.updateStyleString();
_color.updateStyleString();
} else {
_color = material.color;
}
_svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString );

@@ -326,3 +330,3 @@

function renderLine ( v1, v2, element, material, scene ) {
function renderLine ( v1, v2, element, material ) {

@@ -346,3 +350,3 @@ _svgNode = getLineNode( _lineCount ++ );

function renderFace3( v1, v2, v3, element, material, scene ) {
function renderFace3( v1, v2, v3, element, material ) {

@@ -365,6 +369,5 @@ _this.info.render.vertices += 3;

} else if ( material instanceof THREE.MeshLambertMaterial ) {
} else if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) {
_diffuseColor.copy( material.color );
_emissiveColor.copy( material.emissive );

@@ -377,16 +380,8 @@ if ( material.vertexColors === THREE.FaceColors ) {

if ( _enableLighting ) {
_color.copy( _ambientLight );
_color.copy( _ambientLight );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( material.emissive );
_color.multiply( _diffuseColor ).add( _emissiveColor );
} else {
_color.copy( _diffuseColor );
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {

@@ -419,3 +414,3 @@

function renderFace4( v1, v2, v3, v4, element, material, scene ) {
function renderFace4( v1, v2, v3, v4, element, material ) {

@@ -438,6 +433,5 @@ _this.info.render.vertices += 4;

} else if ( material instanceof THREE.MeshLambertMaterial ) {
} else if ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) {
_diffuseColor.copy( material.color );
_emissiveColor.copy( material.emissive );

@@ -450,16 +444,8 @@ if ( material.vertexColors === THREE.FaceColors ) {

if ( _enableLighting ) {
_color.copy( _ambientLight );
_color.copy( _ambientLight );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( material.emissive );
_color.multiply( _diffuseColor ).add( _emissiveColor );
} else {
_color.copy( _diffuseColor );
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {

@@ -466,0 +452,0 @@

@@ -129,4 +129,4 @@ /**

object.properties.colorMaterial = new THREE.MeshFaceMaterial( colorMaterials );
object.properties.normalDepthMaterial = new THREE.MeshFaceMaterial( normalDepthMaterials );
object.userData.colorMaterial = new THREE.MeshFaceMaterial( colorMaterials );
object.userData.normalDepthMaterial = new THREE.MeshFaceMaterial( normalDepthMaterials );

@@ -137,5 +137,5 @@ } else {

object.properties.colorMaterial = deferredMaterials.colorMaterial;
object.properties.normalDepthMaterial = deferredMaterials.normalDepthMaterial;
object.properties.transparent = deferredMaterials.transparent;
object.userData.colorMaterial = deferredMaterials.colorMaterial;
object.userData.normalDepthMaterial = deferredMaterials.normalDepthMaterial;
object.userData.transparent = deferredMaterials.transparent;

@@ -322,3 +322,3 @@ }

var light = lightProxy.properties.originalLight;
var light = lightProxy.userData.originalLight;
var uniforms = lightProxy.material.uniforms;

@@ -407,3 +407,3 @@

meshLight.properties.originalLight = light;
meshLight.userData.originalLight = light;

@@ -424,3 +424,3 @@ // keep reference for size reset

var light = lightProxy.properties.originalLight;
var light = lightProxy.userData.originalLight;
var uniforms = lightProxy.material.uniforms;

@@ -438,3 +438,3 @@

directionVS.normalize();
viewMatrix.rotateAxis( directionVS );
directionVS.transformDirection( viewMatrix );

@@ -487,3 +487,3 @@ uniforms[ "lightPositionVS" ].value.copy( positionVS );

meshLight.properties.originalLight = light;
meshLight.userData.originalLight = light;

@@ -504,3 +504,3 @@ // keep reference for size reset

var light = lightProxy.properties.originalLight;
var light = lightProxy.userData.originalLight;
var uniforms = lightProxy.material.uniforms;

@@ -512,3 +512,3 @@

directionVS.normalize();
camera.matrixWorldInverse.rotateAxis( directionVS );
directionVS.transformDirection( camera.matrixWorldInverse );

@@ -557,3 +557,3 @@ uniforms[ "lightDirectionVS" ].value.copy( directionVS );

meshLight.properties.originalLight = light;
meshLight.userData.originalLight = light;

@@ -574,3 +574,3 @@ // keep reference for size reset

var light = lightProxy.properties.originalLight;
var light = lightProxy.userData.originalLight;
var uniforms = lightProxy.material.uniforms;

@@ -580,3 +580,3 @@

directionVS.normalize();
camera.matrixWorldInverse.rotateAxis( directionVS );
directionVS.transformDirection( camera.matrixWorldInverse );

@@ -626,3 +626,3 @@ uniforms[ "lightDirectionVS" ].value.copy( directionVS );

meshLight.properties.originalLight = light;
meshLight.userData.originalLight = light;

@@ -643,3 +643,3 @@ // keep reference for size reset

var light = lightProxy.properties.originalLight;
var light = lightProxy.userData.originalLight;
var uniforms = lightProxy.material.uniforms;

@@ -656,9 +656,9 @@

rightVS.copy( light.right );
rightVS.transformDirection( modelMatrix );
rightVS.transformDirection( viewMatrix );
normalVS.copy( light.normal );
modelMatrix.rotateAxis( rightVS );
modelMatrix.rotateAxis( normalVS );
normalVS.transformDirection( modelMatrix );
normalVS.transformDirection( viewMatrix );
viewMatrix.rotateAxis( rightVS );
viewMatrix.rotateAxis( normalVS );
upVS.crossVectors( rightVS, normalVS );

@@ -718,3 +718,3 @@ upVS.normalize();

meshLight.properties.originalLight = light;
meshLight.userData.originalLight = light;

@@ -767,3 +767,3 @@ // keep reference for size reset

if ( object.properties.deferredInitialized ) return;
if ( object.userData.deferredInitialized ) return;

@@ -808,3 +808,3 @@ if ( object.material ) initDeferredMaterials( object );

object.properties.deferredInitialized = true;
object.userData.deferredInitialized = true;

@@ -819,3 +819,3 @@ };

if ( object.properties.transparent ) {
if ( object.userData.transparent ) {

@@ -826,3 +826,3 @@ object.material = invisibleMaterial;

object.material = object.properties.colorMaterial;
object.material = object.userData.colorMaterial;

@@ -839,3 +839,3 @@ }

if ( object.properties.transparent ) {
if ( object.userData.transparent ) {

@@ -846,3 +846,3 @@ object.material = invisibleMaterial;

object.material = object.properties.normalDepthMaterial;
object.material = object.userData.normalDepthMaterial;

@@ -958,3 +958,3 @@ }

var originalLight = proxy.properties.originalLight;
var originalLight = proxy.userData.originalLight;

@@ -995,14 +995,14 @@ if ( originalLight ) {

if ( ! scene.properties.lightSceneProxy ) {
if ( ! scene.userData.lightSceneProxy ) {
scene.properties.lightSceneProxy = new THREE.Scene();
scene.properties.lightSceneFullscreen = new THREE.Scene();
scene.userData.lightSceneProxy = new THREE.Scene();
scene.userData.lightSceneFullscreen = new THREE.Scene();
var meshLight = createDeferredEmissiveLight();
scene.properties.lightSceneFullscreen.add( meshLight );
scene.userData.lightSceneFullscreen.add( meshLight );
}
lightSceneProxy = scene.properties.lightSceneProxy;
lightSceneFullscreen = scene.properties.lightSceneFullscreen;
lightSceneProxy = scene.userData.lightSceneProxy;
lightSceneFullscreen = scene.userData.lightSceneFullscreen;

@@ -1024,3 +1024,3 @@ passColor.camera = camera;

this.renderer.autoUpdateScene = false;
scene.autoUpdate = false;
scene.updateMatrixWorld();

@@ -1074,4 +1074,5 @@

this.renderer.autoClearDepth = false;
this.renderer.autoUpdateScene = true;
scene.autoUpdate = true;
gl.depthFunc( gl.GEQUAL );

@@ -1078,0 +1079,0 @@

/*
* @author gyuque / https://github.com/gyuque
* @author gyuque / http://github.com/gyuque
*

@@ -84,3 +84,4 @@ * Cylinder Mapping for ExtrudeGeometry

/*
* @author zz85 / https://github.com/zz85
* @author zz85 / http://github.com/zz85
* @author WestLangley / http://github.com/WestLangley
*

@@ -97,80 +98,106 @@ * tool for "unwrapping" and debugging three.js

THREE.UVsDebug = function(geometry) {
var verts = geometry.vertices,
faces = geometry.faces,
uvs = geometry.faceVertexUvs[0];
console.log('debugging geometry', geometry);
var canvas = document.createElement('canvas');
var width = 1024;
var height = 1024;
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
ctx.lineWidth = 1;
ctx.strokeStyle = 'rgba(0,0,0,0.8)';
THREE.UVsDebug = function( geometry, size ) {
// paint background white
ctx.fillStyle = 'rgba(255,255,255, 1.0)';
ctx.fillRect(0, 0, width, height);
// handles wrapping of uv.x > 1 only
var abc = 'abcd';
var uv, u, ax, ay;
var i, il, j, jl;
var vnum;
var a = new THREE.Vector2();
var b = new THREE.Vector2();
for (i = 0, il = uvs.length; i < il; i++) {
uv = uvs[i];
var faces = geometry.faces;
var uvs = geometry.faceVertexUvs[ 0 ];
var canvas = document.createElement( 'canvas' );
var width = size || 1024; // power of 2 required for wrapping
var height = size || 1024;
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext( '2d' );
ctx.lineWidth = 2;
ctx.strokeStyle = 'rgba( 0, 0, 0, 1.0 )';
ctx.textAlign = 'center';
// paint background white
ctx.fillStyle = 'rgba( 255, 255, 255, 1.0 )';
ctx.fillRect( 0, 0, width, height );
for ( i = 0, il = uvs.length; i < il; i++ ) {
uv = uvs[ i ];
// draw lines
ctx.beginPath();
a.set(0, 0);
for (j = 0, jl = uv.length; j < jl; j++) {
u = uv[j];
a.set( 0, 0 );
for ( j = 0, jl = uv.length; j < jl; j++ ) {
u = uv[ j ];
a.x += u.x;
a.y += u.y;
if (j == 0) {
ctx.moveTo(u.x * width, u.y * height);
if ( j == 0 ) {
ctx.moveTo( u.x * width, ( 1 - u.y ) * height );
} else {
ctx.lineTo(u.x * width, u.y * height);
ctx.lineTo( u.x * width, ( 1 - u.y ) * height );
}
}
ctx.closePath();
ctx.stroke();
a.divideScalar(jl);
a.divideScalar( jl );
// label the face number
ctx.font = "12pt Arial bold";
ctx.fillStyle = 'rgba(0,0,0,0.8)';
ctx.fillText(i, a.x * width, a.y * height);
ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )';
ctx.fillText( i, a.x * width, ( 1 - a.y ) * height );
if ( a.x > 0.95 ) { // wrap x // 0.95 is arbitrary
ctx.fillText( i, ( a.x % 1 ) * width, ( 1 - a.y ) * height );
}
ctx.font = "8pt Arial bold";
ctx.fillStyle = 'rgba(30,30,0,0.8)';
ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )';
// label uv edge orders
for (j = 0, jl = uv.length; j < jl; j++) {
u = uv[j];
b.set(u.x, u.y).sub(a).divideScalar(4);
b.x = u.x - b.x;
b.y = u.y - b.y;
ctx.fillText(abc[j]
+ ':' + faces[i][abc[j]], b.x * width, b.y * height);
for ( j = 0, jl = uv.length; j < jl; j++ ) {
u = uv[ j ];
b.addVectors( a, u ).divideScalar( 2 );
vnum = faces[ i ][ abc[ j ] ];
ctx.fillText( abc[ j ] + vnum, b.x * width, ( 1 - b.y ) * height );
if ( b.x > 0.95 ) { // wrap x
ctx.fillText( abc[ j ] + vnum, ( b.x % 1 ) * width, ( 1 - b.y ) * height );
}
}
}
return canvas;
}

@@ -5,3 +5,3 @@ {

"version" : "0.56.4",
"version" : "0.58.1",

@@ -22,3 +22,3 @@ "description" : "JavaScript 3D library",

"homepage" : "http://mrdoob.github.com/three.js/",
"homepage" : "http://threejs.org/",

@@ -51,2 +51,2 @@ "bugs" : {

}
}

@@ -8,3 +8,3 @@ three.js

[Examples](http://mrdoob.github.com/three.js/) — [Documentation](http://mrdoob.github.com/three.js/docs/) — [Migrating](https://github.com/mrdoob/three.js/wiki/Migration) — [Help](http://stackoverflow.com/questions/tagged/three.js)
[Examples](http://threejs.org/) — [Documentation](http://threejs.org/docs/) — [Migrating](https://github.com/mrdoob/three.js/wiki/Migration) — [Help](http://stackoverflow.com/questions/tagged/three.js)

@@ -14,4 +14,4 @@

Download the [minified library](http://mrdoob.github.com/three.js/build/three.min.js) and include it in your html.
Alternatively see [how to build the library yourself](https://github.com/mrdoob/three.js/wiki/build.py,-or-how-to-generate-a-compressed-Three.js-file).
Download the [minified library](http://threejs.org/build/three.min.js) and include it in your html.
Alternatively see [how to build the library yourself](https://github.com/mrdoob/three.js/wiki/build.py,-or-how-to-generate-a-compressed-Three.js-file).

@@ -70,4 +70,71 @@ ```html

2013 02 15 - **r56** (407,609 KB, gzip: 96,870 KB)
2013 04 17 - **r58** (411,339 KB, gzip: 97,298 KB)
* Removed `Matrix4`'s ` translate()`, `rotateX()`, `rotateY()`, `rotateZ()` and `rotateByAxis()`. ([mrdoob](http://github.com/mrdoob))
* Documentation improvements. ([yurifury](http://github.com/yurifury), [tmcw](http://github.com/tmcw), [deepan2k5](http://github.com/deepan2k5), [cjshannon](http://github.com/cjshannon) and [sh0ot1e](http://github.com/sh0ot1e))
* Improvements to `WebGLRenderer` stable z sorting.([wereHamster](http://github.com/wereHamster) and [mrdoob](http://github.com/mrdoob))
* Lots of progress in `SceneLoader2` and `SceneExporter2`, now known as `ObjectLoader` and `ObjectExporter`. ([mrdoob](http://github.com/mrdoob))
* Added morphTargets support to `MeshNormalMaterial`. ([mrdoob](http://github.com/mrdoob))
* Renamed `Matrix4`'s `extractPosition()` to `copyPosition()`. ([mrdoob](http://github.com/mrdoob))
* Editor now using localStorage for keeping state. ([mrdoob](http://github.com/mrdoob) and [sole](http://github.com/sole))
* Added `MaterialLoader` and `MaterialExporter`. ([mrdoob](http://github.com/mrdoob))
* Renamed `Matrix4`'s `setRotationFrom*()` to `makeRotationFrom*()`. ([bhouston](http://github.com/bhouston))
* Added `setGeometry()` and `setMaterial()` to `Mesh`. ([mrdoob](http://github.com/mrdoob))
* Editor primitives can now have the parameters updated at any point. ([mrdoob](http://github.com/mrdoob))
* Renamed `Matrix4`'s `compose()` to `makeFromPositionQuaternionScale()` and added `makeFromPositionEulerScale()`. ([bhouston](http://github.com/bhouston))
* Added `rotateOnAxis()` and `translateOnAxis()` to `Object3D`. ([WestLangley](http://github.com/WestLangley))
* Removed `Matrix4`'s `crossVector()`. ([WestLangley](http://github.com/WestLangley))
* Added `PLYLoader` (ASCII files). ([menway](http://github.com/menway))
* Added new `BokehShader2`. ([zz85](http://github.com/zz85))
* Replaced recursive calls in `PolyhedronGeometry` with an analytical construction of the geometry. ([bhickey](http://github.com/bhickey))
* Renamed `Object3D`'s `getChildByName()` to `getObjectByName()` and added `getObjectById()`. ([mrdoob](http://github.com/mrdoob))
* Add `materialOffset` parameter to `GeometryUtils`'s `merge()`. ([tapio](http://github.com/tapio))
* Now using prototype based `EventDispatcher`. ([mrdoob](http://github.com/mrdoob))
* Added `linewidth` to `ShaderMaterial`. ([mrdoob](http://github.com/mrdoob))
* `LOD` support in `Raycaster`. ([mrdoob](http://github.com/mrdoob))
* Added lights support to `ColladaLoader`. ([mrdoob](http://github.com/mrdoob))
* Started `WebGLRenderer3`. Aiming to find better solutions for the WebGL layer. ([mrdoob](http://github.com/mrdoob))
* Optimized the PCF shadow map filtering to use vector comparisons. ([MiiBond](http://github.com/MiiBond))
* `SoftwareRenderer` now handles color changes at runtime. ([mrdoob](http://github.com/mrdoob))
* Added `BoxHelper`. ([mrdoob](http://github.com/mrdoob))
* Removed `setClearColorHex()`, `parameters.clearColor` and `parameters.clearAlpha`. ([mrdoob](http://github.com/mrdoob))
* Refactored `CameraHelper`. ([mrdoob](http://github.com/mrdoob))
* Fixed bug in `DirectionalLightHelper` and `SpotLightHelper`. ([mrdoob](http://github.com/mrdoob))
* Fixed bug in Phong shader when using normal maps with derivative tangents. ([WestLangley](http://github.com/WestLangley))
* Added support for `FaceColors` to `SoftwareRenderer`.
* Updated `convert_obj_three.py` docstring with current loader interface. ([wilsaj](http://github.com/wilsaj))
* Updated OculusRiftEffect. Now it should work with the original OculusRift. ([troffmo5](http://github.com/troffmo5))
* Fixed vertex normals and UVs for CircleGeometry. ([WestLangley](http://github.com/WestLangley))
* Added snapping to the editor. ([arodic](http://github.com/arodic))
* Fixed `SpotLight`'s `angle` and `SpotlightHelper`'s cone size bug. ([WestLangley](http://github.com/WestLangley))
* Using `CanvasRenderer` in the editor when there is no WebGL support. ([mrdoob](http://github.com/mrdoob))
* Update `STLLoader` with [github improvements](https://github.com/blog/1465-stl-file-viewing). ([gero3](http://github.com/gero3))
* Fixed UVs for faces that straddle the seam in `PolyhedronGeometry`. ([WestLangley](http://github.com/WestLangley))
* Cleaned up `ArrowHelper`. ([WestLangley](http://github.com/WestLangley))
* Added `VertexColors` support for `Line` in `CanvasRenderer`. ([gero3](http://github.com/gero3))
* Fixed `TrackballControls` zoom increment to normalize responsiveness across various inputs. ([protometa](http://github.com/protometa))
2013 03 15 - **r57** (403,818 KB, gzip: 96,416 KB)
* Added Renderer panel to the editor. ([mrdoob](http://github.com/mrdoob))
* Added support for custom attributes to `BufferGeometry`. ([zz85](http://github.com/zz85))
* `CanvasRenderer` and `SVGRenderer` behave like `WebGLRenderer` with `MeshLambertMaterial` and no lights. ([mrdoob](http://github.com/mrdoob))
* Added `ColorConverter` in examples folder. ([bhouston](http://github.com/bhouston) and [zz85](http://github.com/zz85))
* Fixed `SVGRenderer` when autoClear false. ([mrdoob](http://github.com/mrdoob))
* Made `WebGLRenderer` sorting truly stable. ([wereHamster](http://github.com/wereHamster) and [mrdoob](http://github.com/mrdoob))
* Improved `Object3D` and `Camera` `lookAt()`. ([WestLangley](http://github.com/WestLangley))
* Added `RingGeometry`. ([merpnderp](http://github.com/merpnderp))
* Made `OBJLoader` and `OBJMTLLoader` more robust. ([mrdoob](http://github.com/mrdoob))
* Added pan to `OrbitControls`. ([WestLangley](http://github.com/WestLangley) and [mrdoob](http://github.com/mrdoob))
* Added `.getColumnFromMatrix()` to `Vector3`. ([WestLangley](http://github.com/WestLangley))
* Renamed `Object3D` `properties` to `userData`. ([mrdoob](http://github.com/mrdoob))
* Simplified `PointLightHelper`, `DirectionalLightHelper`, `SpotLightHelper` and `HemisphereLightHelper`. ([mrdoob](http://github.com/mrdoob))
* Added `GridHelper`. ([mrdoob](http://github.com/mrdoob))
* Added `.clone()` method to `AmbientLight`, `PointLight`, `DirectionalLight`, `SpotLight` and `HemisphereLight`. ([mrdoob](http://github.com/mrdoob))
2013 02 15 - **r56** (408,927 KB, gzip: 97,095 KB)
* Added `LineDashedMaterial` support to `CanvasRenderer`. ([sole](http://github.com/sole))

@@ -91,3 +158,3 @@ * Documentation improvements. ([gero3](http://github.com/gero3), [erich666](http://github.com/erich666), [Stompfrog](http://github.com/Stompfrog), [morenoh149](http://github.com/morenoh149), [chrmoritz](http://github.com/chrmoritz) and [mrdoob](http://github.com/mrdoob))

* Added `Line3`. ([bhouston](http://github.com/bhouston))
* Addded `linewidth` support to `BufferGeometry` lines. ([arodic](http://github.com/arodic))
* Added `linewidth` support to `BufferGeometry` lines. ([arodic](http://github.com/arodic))
* Renamed `Box3`/`Line3`/`Plane`/`Ray`/`Sphere`'s `.transform()` to `applyMatrix4()`. ([bhouston](http://github.com/bhouston))

@@ -167,3 +234,3 @@ * Added `smoothstep` and `smootherstep` to `Math`. ([bhouston](http://github.com/bhouston))

* Lots of improvements to [editor](http://mrdoob.github.com/three.js/editor/). Including possibility to export geometry and scene. ([alteredq](http://github.com/alteredq) and [mrdoob](http://github.com/mrdoob))
* Lots of improvements to [editor](http://threejs.org/editor/). Including possibility to export geometry and scene. ([alteredq](http://github.com/alteredq) and [mrdoob](http://github.com/mrdoob))
* `Sprite` no longer gets its size from the texture. ([alteredq](http://github.com/alteredq) and [mrdoob](http://github.com/mrdoob))

@@ -201,3 +268,3 @@ * Improved `CSS3DRenderer`. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))

* Added `PointerLockControls`. ([mrdoob](http://github.com/mrdoob))
* Completed more [documentation](http://mrdoob.github.com/three.js/docs/) pages. ([sole](http://github.com/sole))
* Completed more [documentation](http://threejs.org/docs/) pages. ([sole](http://github.com/sole))
* Split `SceneUtils.cloneObject` into `*.clone()`. ([mrdoob](http://github.com/mrdoob))

@@ -210,5 +277,5 @@ * Simplified `AxisHelper`. ([mrdoob](http://github.com/mrdoob))

* Fixed shadows getting animated when skinning / morphing was disabled. ([alteredq](http://github.com/alteredq))
* Added `Manual` section to the [documentation](http://mrdoob.github.com/three.js/docs/) pages. ([oal](http://github.com/oal))
* Added `Manual` section to the [documentation](http://threejs.org/docs/) pages. ([oal](http://github.com/oal))
* Added `.angleTo()` to `Vector3`. ([Wilt](http://github.com/Wilt))
* Many improvements to the [editor](http://mrdoob.github.com/three.js/editor/). ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
* Many improvements to the [editor](http://threejs.org/editor/). ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))

@@ -229,3 +296,3 @@

* Added support for compressed textures and cube maps to `WebGLRenderer`. ([alteredq](http://github.com/alteredq))
* Outliner and Material panel improvements to the [editor](http://mrdoob.github.com/three.js/editor/). ([mrdoob](http://github.com/mrdoob))
* Outliner and Material panel improvements to the [editor](http://threejs.org/editor/). ([mrdoob](http://github.com/mrdoob))
* Added material.emissive support to `CanvasRenderer` and `SVGRenderer`. ([mrdoob](http://github.com/mrdoob))

@@ -264,3 +331,3 @@ * Added handling of multiple UV layers and anisotropy to Blender exporter. ([alteredq](http://github.com/alteredq))

* Completed lots more documentation pages. ([sole](http://github.com/sole))
* Started reworking [GUI](http://mrdoob.github.com/three.js/gui/). ([mrdoob](http://github.com/mrdoob))
* Started reworking [GUI](http://threejs.org/gui/). ([mrdoob](http://github.com/mrdoob))
* Improved python build system. ([gero3](http://github.com/gero3))

@@ -267,0 +334,0 @@ * Made `VTKLoader` parsing more robust. ([mrdoob](http://github.com/mrdoob))

/**
* @author mrdoob / http://mrdoob.com/
* @author mikael emtinger / http://gomo.se/
*/
* @author WestLangley / http://github.com/WestLangley
*/

@@ -19,22 +20,24 @@ THREE.Camera = function () {

THREE.Camera.prototype.lookAt = function ( vector ) {
THREE.Camera.prototype.lookAt = function () {
// TODO: Add hierarchy support.
// This routine does not support cameras with rotated and/or translated parent(s)
this.matrix.lookAt( this.position, vector, this.up );
var m1 = new THREE.Matrix4();
if ( this.rotationAutoUpdate === true ) {
return function ( vector ) {
if ( this.useQuaternion === false ) {
m1.lookAt( this.position, vector, this.up );
this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
if ( this.useQuaternion === true ) {
this.quaternion.setFromRotationMatrix( m1 );
} else {
this.quaternion.copy( this.matrix.decompose()[ 1 ] );
this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
}
}
};
};
}();

@@ -7,4 +7,2 @@ /**

THREE.EventDispatcher.call( this );
this.id = THREE.GeometryIdCount ++;

@@ -39,4 +37,9 @@

constructor : THREE.BufferGeometry,
constructor: THREE.BufferGeometry,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
applyMatrix: function ( matrix ) {

@@ -59,4 +62,3 @@

var normalMatrix = new THREE.Matrix3();
normalMatrix.getInverse( matrix ).transpose();
var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );

@@ -517,3 +519,3 @@ normalMatrix.multiplyVector3Array( normalArray );

tangents[ v * 4 ] = tmp.x;
tangents[ v * 4 ] = tmp.x;
tangents[ v * 4 + 1 ] = tmp.y;

@@ -557,2 +559,1 @@ tangents[ v * 4 + 2 ] = tmp.z;

};

@@ -17,4 +17,6 @@ /**

THREE.extend( THREE.Clock.prototype, {
THREE.Clock.prototype = {
constructor: THREE.Clock,
start: function () {

@@ -71,2 +73,2 @@

} );
};

@@ -5,8 +5,14 @@ /**

THREE.EventDispatcher = function () {
THREE.EventDispatcher = function () {}
var listeners = {};
THREE.EventDispatcher.prototype = {
this.addEventListener = function ( type, listener ) {
constructor: THREE.EventDispatcher,
addEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) this._listeners = {};
var listeners = this._listeners;
if ( listeners[ type ] === undefined ) {

@@ -24,6 +30,25 @@

};
},
this.removeEventListener = function ( type, listener ) {
hasEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) return false;
var listeners = this._listeners;
if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) {
return true;
}
return false;
},
removeEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) return;
var listeners = this._listeners;
var index = listeners[ type ].indexOf( listener );

@@ -37,6 +62,9 @@

};
},
this.dispatchEvent = function ( event ) {
dispatchEvent: function ( event ) {
if ( this._listeners === undefined ) return;
var listeners = this._listeners;
var listenerArray = listeners[ event.type ];

@@ -56,4 +84,4 @@

};
}
};

@@ -12,4 +12,2 @@ /**

THREE.EventDispatcher.call( this );
this.id = THREE.GeometryIdCount ++;

@@ -62,5 +60,10 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
applyMatrix: function ( matrix ) {
var normalMatrix = new THREE.Matrix3().getInverse( matrix ).transpose();
var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );

@@ -67,0 +70,0 @@ for ( var i = 0, il = this.vertices.length; i < il; i ++ ) {

@@ -5,2 +5,3 @@ /**

* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
*/

@@ -13,3 +14,2 @@

this.name = '';
this.properties = {};

@@ -32,3 +32,2 @@ this.parent = undefined;

this.matrixWorld = new THREE.Matrix4();
this.matrixRotationWorld = new THREE.Matrix4();

@@ -48,3 +47,3 @@ this.matrixAutoUpdate = true;

this._vector = new THREE.Vector3();
this.userData = {};

@@ -58,40 +57,133 @@ };

applyMatrix: function ( matrix ) {
applyMatrix: function () {
this.matrix.multiplyMatrices( matrix, this.matrix );
var m1 = new THREE.Matrix4();
this.scale.getScaleFromMatrix( this.matrix );
return function ( matrix ) {
var mat = new THREE.Matrix4().extractRotation( this.matrix );
this.rotation.setEulerFromRotationMatrix( mat, this.eulerOrder );
this.matrix.multiplyMatrices( matrix, this.matrix );
this.position.getPositionFromMatrix( this.matrix );
this.position.getPositionFromMatrix( this.matrix );
},
this.scale.getScaleFromMatrix( this.matrix );
m1.extractRotation( this.matrix );
if ( this.useQuaternion === true ) {
this.quaternion.setFromRotationMatrix( m1 );
} else {
this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
}
}
}(),
rotateOnAxis: function() {
// rotate object on axis in object space
// axis is assumed to be normalized
var q1 = new THREE.Quaternion();
var q2 = new THREE.Quaternion();
return function ( axis, angle ) {
q1.setFromAxisAngle( axis, angle );
if ( this.useQuaternion === true ) {
this.quaternion.multiply( q1 );
} else {
q2.setFromEuler( this.rotation, this.eulerOrder );
q2.multiply( q1 );
this.rotation.setEulerFromQuaternion( q2, this.eulerOrder );
}
return this;
}
}(),
translateOnAxis: function () {
// translate object by distance along axis in object space
// axis is assumed to be normalized
var v1 = new THREE.Vector3();
return function ( axis, distance ) {
v1.copy( axis );
if ( this.useQuaternion === true ) {
v1.applyQuaternion( this.quaternion );
} else {
v1.applyEuler( this.rotation, this.eulerOrder );
}
this.position.add( v1.multiplyScalar( distance ) );
return this;
}
}(),
translate: function ( distance, axis ) {
this.matrix.rotateAxis( axis );
this.position.add( axis.multiplyScalar( distance ) );
console.warn( 'DEPRECATED: Object3D\'s .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed.' );
return this.translateOnAxis( axis, distance );
},
translateX: function ( distance ) {
translateX: function () {
this.translate( distance, this._vector.set( 1, 0, 0 ) );
var v1 = new THREE.Vector3( 1, 0, 0 );
},
return function ( distance ) {
translateY: function ( distance ) {
return this.translateOnAxis( v1, distance );
this.translate( distance, this._vector.set( 0, 1, 0 ) );
};
},
}(),
translateZ: function ( distance ) {
translateY: function () {
this.translate( distance, this._vector.set( 0, 0, 1 ) );
var v1 = new THREE.Vector3( 0, 1, 0 );
},
return function ( distance ) {
return this.translateOnAxis( v1, distance );
};
}(),
translateZ: function () {
var v1 = new THREE.Vector3( 0, 0, 1 );
return function ( distance ) {
return this.translateOnAxis( v1, distance );
};
}(),
localToWorld: function ( vector ) {

@@ -103,29 +195,37 @@

worldToLocal: function ( vector ) {
worldToLocal: function () {
return vector.applyMatrix4( THREE.Object3D.__m1.getInverse( this.matrixWorld ) );
var m1 = new THREE.Matrix4();
},
return function ( vector ) {
lookAt: function ( vector ) {
return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );
// TODO: Add hierarchy support.
};
this.matrix.lookAt( vector, this.position, this.up );
}(),
if ( this.rotationAutoUpdate ) {
lookAt: function () {
if ( this.useQuaternion === false ) {
// This routine does not support objects with rotated and/or translated parent(s)
this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
var m1 = new THREE.Matrix4();
return function ( vector ) {
m1.lookAt( vector, this.position, this.up );
if ( this.useQuaternion === true ) {
this.quaternion.setFromRotationMatrix( m1 );
} else {
this.quaternion.copy( this.matrix.decompose()[ 1 ] );
this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
}
}
};
},
}(),

@@ -213,3 +313,3 @@ add: function ( object ) {

getChildByName: function ( name, recursive ) {
getObjectById: function ( id, recursive ) {

@@ -220,2 +320,32 @@ for ( var i = 0, l = this.children.length; i < l; i ++ ) {

if ( child.id === id ) {
return child;
}
if ( recursive === true ) {
child = child.getObjectById( id, recursive );
if ( child !== undefined ) {
return child;
}
}
}
return undefined;
},
getObjectByName: function ( name, recursive ) {
for ( var i = 0, l = this.children.length; i < l; i ++ ) {
var child = this.children[ i ];
if ( child.name === name ) {

@@ -229,3 +359,3 @@

child = child.getChildByName( name, recursive );
child = child.getObjectByName( name, recursive );

@@ -246,2 +376,9 @@ if ( child !== undefined ) {

getChildByName: function ( name, recursive ) {
console.warn( 'DEPRECATED: Object3D\'s .getChildByName() has been renamed to .getObjectByName().' );
return this.getObjectByName( name, recursive );
},
getDescendants: function ( array ) {

@@ -265,20 +402,14 @@

this.matrix.setPosition( this.position );
// if we are not using a quaternion directly, convert Euler rotation to this.quaternion.
if ( this.useQuaternion === false ) {
this.matrix.setRotationFromEuler( this.rotation, this.eulerOrder );
this.matrix.makeFromPositionEulerScale( this.position, this.rotation, this.eulerOrder, this.scale );
} else {
this.matrix.setRotationFromQuaternion( this.quaternion );
this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
}
if ( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {
this.matrix.scale( this.scale );
}
this.matrixWorldNeedsUpdate = true;

@@ -339,3 +470,2 @@

object.matrixWorld.copy( this.matrixWorld );
object.matrixRotationWorld.copy( this.matrixRotationWorld );

@@ -355,2 +485,4 @@ object.matrixAutoUpdate = this.matrixAutoUpdate;

object.userData = JSON.parse( JSON.stringify( this.userData ) );
for ( var i = 0; i < this.children.length; i ++ ) {

@@ -369,5 +501,4 @@

THREE.Object3D.__m1 = new THREE.Matrix4();
THREE.Object3D.defaultEulerOrder = 'XYZ',
THREE.Object3DIdCount = 0;

@@ -191,4 +191,3 @@ /**

scene.updateMatrixWorld();
if ( scene.autoUpdate === true ) scene.updateMatrixWorld();
if ( camera.parent === undefined ) camera.updateMatrixWorld();

@@ -199,4 +198,3 @@

_normalViewMatrix.getInverse( _viewMatrix );
_normalViewMatrix.transpose();
_normalViewMatrix.getNormalMatrix( _viewMatrix );

@@ -223,4 +221,3 @@ _frustum.setFromMatrix( _viewProjectionMatrix );

_normalMatrix.getInverse( _modelMatrix );
_normalMatrix.transpose();
_normalMatrix.getNormalMatrix( _modelMatrix );

@@ -438,2 +435,9 @@ isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial;

if ( object.material.vertexColors === THREE.VertexColors ) {
_line.vertexColors[ 0 ].copy( object.geometry.colors[ v ] );
_line.vertexColors[ 1 ].copy( object.geometry.colors[ v - 1 ] );
}
_renderData.elements.push( _line );

@@ -440,0 +444,0 @@

@@ -13,3 +13,3 @@ /**

// normalized ray.direction required for accurate distance calculations
if( this.ray.direction.lengthSq() > 0 ) {
if ( this.ray.direction.lengthSq() > 0 ) {

@@ -61,2 +61,9 @@ this.ray.direction.normalize();

} else if ( object instanceof THREE.LOD ) {
matrixPosition.getPositionFromMatrix( object.matrixWorld );
var distance = raycaster.ray.origin.distanceTo( matrixPosition );
intersectObject( object.getObjectForDistance( distance ), raycaster, intersects );
} else if ( object instanceof THREE.Mesh ) {

@@ -89,4 +96,2 @@

object.matrixRotationWorld.extractRotation( object.matrixWorld );
inverseMatrix.getInverse( object.matrixWorld );

@@ -116,7 +121,7 @@

side = material.side;
if( side !== THREE.DoubleSide ) {
if ( side !== THREE.DoubleSide ) {
var planeSign = localRay.direction.dot( facePlane.normal );
if( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue;
if ( ! ( side === THREE.FrontSide ? planeSign < 0 : planeSign > 0 ) ) continue;

@@ -192,3 +197,3 @@ }

// normalized ray.direction required for accurate distance calculations
if( this.ray.direction.length() > 0 ) {
if ( this.ray.direction.length() > 0 ) {

@@ -195,0 +200,0 @@ this.ray.direction.normalize();

@@ -28,3 +28,3 @@ /**

this.matrixWorld.compose( this.translationWorld, this.rotationObject, this.scaleWorld );
this.matrixWorld.makeFromPositionQuaternionScale( this.translationWorld, this.rotationObject, this.scaleWorld );

@@ -31,0 +31,0 @@

@@ -459,2 +459,3 @@ /**

// To use the typeface.js face files, hook up the API
self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
THREE.typeface_js = self._typeface_js;

@@ -7,45 +7,46 @@ /**

THREE.Geometry.call( this );
THREE.Geometry.call( this );
radius = radius || 50;
radius = radius || 50;
thetaStart = thetaStart !== undefined ? thetaStart : 0;
thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
segments = segments !== undefined ? Math.max( 3, segments ) : 8;
thetaStart = thetaStart !== undefined ? thetaStart : 0;
thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
segments = segments !== undefined ? Math.max( 3, segments ) : 8;
var i, uvs = [],
center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );
var i, uvs = [],
center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );
this.vertices.push(center);
uvs.push( centerUV );
this.vertices.push(center);
uvs.push( centerUV );
for ( i = 0; i <= segments; i ++ ) {
for ( i = 0; i <= segments; i ++ ) {
var vertex = new THREE.Vector3();
var vertex = new THREE.Vector3();
var segment = thetaStart + i / segments * thetaLength;
vertex.x = radius * Math.cos( thetaStart + i / segments * thetaLength );
vertex.y = radius * Math.sin( thetaStart + i / segments * thetaLength );
vertex.x = radius * Math.cos( segment );
vertex.y = radius * Math.sin( segment );
this.vertices.push( vertex );
uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, - ( vertex.y / radius + 1 ) / 2 + 1 ) );
this.vertices.push( vertex );
uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) );
}
}
var n = new THREE.Vector3( 0, 0, -1 );
var n = new THREE.Vector3( 0, 0, 1 );
for ( i = 1; i <= segments; i ++ ) {
for ( i = 1; i <= segments; i ++ ) {
var v1 = i;
var v2 = i + 1 ;
var v3 = 0;
var v1 = i;
var v2 = i + 1 ;
var v3 = 0;
this.faces.push( new THREE.Face3( v1, v2, v3, [ n, n, n ] ) );
this.faceVertexUvs[ 0 ].push( [ uvs[ i ], uvs[ i + 1 ], centerUV ] );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n, n, n ] ) );
this.faceVertexUvs[ 0 ].push( [ uvs[ i ], uvs[ i + 1 ], centerUV ] );
}
}
this.computeCentroids();
this.computeFaceNormals();
this.computeCentroids();
this.computeFaceNormals();
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );

@@ -52,0 +53,0 @@ };

@@ -9,13 +9,16 @@ /**

radiusTop = radiusTop !== undefined ? radiusTop : 20;
radiusBottom = radiusBottom !== undefined ? radiusBottom : 20;
height = height !== undefined ? height : 100;
this.radiusTop = radiusTop = radiusTop !== undefined ? radiusTop : 20;
this.radiusBottom = radiusBottom = radiusBottom !== undefined ? radiusBottom : 20;
this.height = height = height !== undefined ? height : 100;
this.radiusSegments = radiusSegments = radiusSegments || 8;
this.heightSegments = heightSegments = heightSegments || 1;
this.openEnded = openEnded = openEnded !== undefined ? openEnded : false;
var heightHalf = height / 2;
var segmentsX = radiusSegments || 8;
var segmentsY = heightSegments || 1;
var x, y, vertices = [], uvs = [];
for ( y = 0; y <= segmentsY; y ++ ) {
for ( y = 0; y <= heightSegments; y ++ ) {

@@ -25,8 +28,8 @@ var verticesRow = [];

var v = y / segmentsY;
var v = y / heightSegments;
var radius = v * ( radiusBottom - radiusTop ) + radiusTop;
for ( x = 0; x <= segmentsX; x ++ ) {
for ( x = 0; x <= radiusSegments; x ++ ) {
var u = x / segmentsX;
var u = x / radiusSegments;

@@ -53,3 +56,3 @@ var vertex = new THREE.Vector3();

for ( x = 0; x < segmentsX; x ++ ) {
for ( x = 0; x < radiusSegments; x ++ ) {

@@ -71,3 +74,3 @@ if ( radiusTop !== 0 ) {

for ( y = 0; y < segmentsY; y ++ ) {
for ( y = 0; y < heightSegments; y ++ ) {

@@ -98,7 +101,7 @@ var v1 = vertices[ y ][ x ];

if ( !openEnded && radiusTop > 0 ) {
if ( openEnded === false && radiusTop > 0 ) {
this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) );
for ( x = 0; x < segmentsX; x ++ ) {
for ( x = 0; x < radiusSegments; x ++ ) {

@@ -126,7 +129,7 @@ var v1 = vertices[ 0 ][ x ];

if ( !openEnded && radiusBottom > 0 ) {
if ( openEnded === false && radiusBottom > 0 ) {
this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) );
for ( x = 0; x < segmentsX; x ++ ) {
for ( x = 0; x < radiusSegments; x ++ ) {

@@ -133,0 +136,0 @@ var v1 = vertices[ y ][ x + 1 ];

@@ -7,2 +7,5 @@ /**

this.radius = radius;
this.detail = detail;
var t = ( 1 + Math.sqrt( 5 ) ) / 2;

@@ -9,0 +12,0 @@

/**
* @author clockworkgeek / https://github.com/clockworkgeek
* @author timothypratley / https://github.com/timothypratley
*/
* @author WestLangley / http://github.com/WestLangley
*/

@@ -23,10 +24,49 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {

var f = [];
for ( var i = 0, l = faces.length; i < l; i ++ ) {
make( p[ faces[ i ][ 0 ] ], p[ faces[ i ][ 1 ] ], p[ faces[ i ][ 2 ] ], detail );
var v1 = p[ faces[ i ][ 0 ] ];
var v2 = p[ faces[ i ][ 1 ] ];
var v3 = p[ faces[ i ][ 2 ] ];
f[ i ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
}
for ( var i = 0, l = f.length; i < l; i ++ ) {
subdivide(f[ i ], detail);
}
// Handle case when face straddles the seam
for ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) {
var uvs = this.faceVertexUvs[ 0 ][ i ];
var x0 = uvs[ 0 ].x;
var x1 = uvs[ 1 ].x;
var x2 = uvs[ 2 ].x;
var max = Math.max( x0, Math.max( x1, x2 ) );
var min = Math.min( x0, Math.min( x1, x2 ) );
if ( max > 0.9 && min < 0.1 ) { // 0.9 is somewhat arbitrary
if ( x0 < 0.2 ) uvs[ 0 ].x += 1;
if ( x1 < 0.2 ) uvs[ 1 ].x += 1;
if ( x2 < 0.2 ) uvs[ 2 ].x += 1;
}
}
// Merge vertices
this.mergeVertices();
// Apply radius

@@ -61,51 +101,87 @@

function make( v1, v2, v3, detail ) {
function make( v1, v2, v3 ) {
if ( detail < 1 ) {
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
face.normal.copy( face.centroid ).normalize();
that.faces.push( face );
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
face.normal = face.centroid.clone().normalize();
that.faces.push( face );
var azi = azimuth( face.centroid );
var azi = azimuth( face.centroid );
that.faceVertexUvs[ 0 ].push( [
correctUV( v1.uv, v1, azi ),
correctUV( v2.uv, v2, azi ),
correctUV( v3.uv, v3, azi )
] );
that.faceVertexUvs[ 0 ].push( [
correctUV( v1.uv, v1, azi ),
correctUV( v2.uv, v2, azi ),
correctUV( v3.uv, v3, azi )
] );
} else {
}
detail -= 1;
// split triangle into 4 smaller triangles
// Analytically subdivide a face to the required detail level.
make( v1, midpoint( v1, v2 ), midpoint( v1, v3 ), detail ); // top quadrant
make( midpoint( v1, v2 ), v2, midpoint( v2, v3 ), detail ); // left quadrant
make( midpoint( v1, v3 ), midpoint( v2, v3 ), v3, detail ); // right quadrant
make( midpoint( v1, v2 ), midpoint( v2, v3 ), midpoint( v1, v3 ), detail ); // center quadrant
function subdivide(face, detail ) {
var cols = Math.pow(2, detail);
var cells = Math.pow(4, detail);
var a = prepare( that.vertices[ face.a ] );
var b = prepare( that.vertices[ face.b ] );
var c = prepare( that.vertices[ face.c ] );
var v = [];
// Construct all of the vertices for this subdivision.
for ( var i = 0 ; i <= cols; i ++ ) {
v[ i ] = [];
var aj = prepare( a.clone().lerp( c, i / cols ) );
var bj = prepare( b.clone().lerp( c, i / cols ) );
var rows = cols - i;
for ( var j = 0; j <= rows; j ++) {
if ( j == 0 && i == cols ) {
v[ i ][ j ] = aj;
} else {
v[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) );
}
}
}
}
// Construct all of the faces.
function midpoint( v1, v2 ) {
for ( var i = 0; i < cols ; i ++ ) {
if ( !midpoints[ v1.index ] ) midpoints[ v1.index ] = [];
if ( !midpoints[ v2.index ] ) midpoints[ v2.index ] = [];
for ( var j = 0; j < 2 * (cols - i) - 1; j ++ ) {
var mid = midpoints[ v1.index ][ v2.index ];
var k = Math.floor( j / 2 );
if ( mid === undefined ) {
if ( j % 2 == 0 ) {
// generate mean point and project to surface with prepare()
make(
v[ i ][ k + 1],
v[ i + 1 ][ k ],
v[ i ][ k ]
);
midpoints[ v1.index ][ v2.index ] = midpoints[ v2.index ][ v1.index ] = mid = prepare(
new THREE.Vector3().addVectors( v1, v2 ).divideScalar( 2 )
);
} else {
make(
v[ i ][ k + 1 ],
v[ i + 1][ k + 1],
v[ i + 1 ][ k ]
);
}
}
}
return mid;
}

@@ -138,3 +214,3 @@

if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y );
return uv;
return uv.clone();

@@ -145,3 +221,3 @@ }

this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );

@@ -148,0 +224,0 @@ };

@@ -9,16 +9,16 @@ /**

this.radius = radius || 50;
this.radius = radius = radius || 50;
this.widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
this.heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );
this.widthSegments = widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
this.heightSegments = heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );
phiStart = phiStart !== undefined ? phiStart : 0;
phiLength = phiLength !== undefined ? phiLength : Math.PI * 2;
this.phiStart = phiStart = phiStart !== undefined ? phiStart : 0;
this.phiLength = phiLength = phiLength !== undefined ? phiLength : Math.PI * 2;
thetaStart = thetaStart !== undefined ? thetaStart : 0;
thetaLength = thetaLength !== undefined ? thetaLength : Math.PI;
this.thetaStart = thetaStart = thetaStart !== undefined ? thetaStart : 0;
this.thetaLength = thetaLength = thetaLength !== undefined ? thetaLength : Math.PI;
var x, y, vertices = [], uvs = [];
for ( y = 0; y <= this.heightSegments; y ++ ) {
for ( y = 0; y <= heightSegments; y ++ ) {

@@ -28,11 +28,11 @@ var verticesRow = [];

for ( x = 0; x <= this.widthSegments; x ++ ) {
for ( x = 0; x <= widthSegments; x ++ ) {
var u = x / this.widthSegments;
var v = y / this.heightSegments;
var u = x / widthSegments;
var v = y / heightSegments;
var vertex = new THREE.Vector3();
vertex.x = - this.radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.y = this.radius * Math.cos( thetaStart + v * thetaLength );
vertex.z = this.radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );

@@ -94,3 +94,3 @@ this.vertices.push( vertex );

this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );

@@ -97,0 +97,0 @@ };

@@ -41,2 +41,4 @@ /**

parameters = parameters || {};
var textShapes = THREE.FontUtils.generateShapes( text, parameters );

@@ -43,0 +45,0 @@

@@ -10,3 +10,3 @@ /**

merge: function ( geometry1, object2 /* mesh | geometry */ ) {
merge: function ( geometry1, object2 /* mesh | geometry */, materialIndexOffset ) {

@@ -24,2 +24,4 @@ var matrix, normalMatrix,

if ( materialIndexOffset === undefined ) materialIndexOffset = 0;
if ( object2 instanceof THREE.Mesh ) {

@@ -31,5 +33,3 @@

normalMatrix = new THREE.Matrix3();
normalMatrix.getInverse( matrix );
normalMatrix.transpose();
normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );

@@ -101,3 +101,3 @@ }

faceCopy.materialIndex = face.materialIndex;
faceCopy.materialIndex = face.materialIndex + materialIndexOffset;

@@ -104,0 +104,0 @@ faceCopy.centroid.copy( face.centroid );

/**
* @author WestLangley / http://github.com/WestLangley
* @author zz85 / https://github.com/zz85
* @author bhouston / https://exocortex.com
* @author zz85 / http://github.com/zz85
* @author bhouston / http://exocortex.com
*

@@ -17,7 +17,13 @@ * Creates an arrow for visualizing directions

// dir is assumed to be normalized
THREE.Object3D.call( this );
if ( length === undefined ) length = 20;
if ( hex === undefined ) hex = 0xffff00;
if ( length === undefined ) length = 1;
this.position = origin;
this.useQuaternion = true;
var lineGeometry = new THREE.Geometry();

@@ -28,12 +34,12 @@ lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) );

this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: hex } ) );
this.line.matrixAutoUpdate = false;
this.add( this.line );
var coneGeometry = new THREE.CylinderGeometry( 0, 0.05, 0.25, 5, 1 );
coneGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0.875, 0 ) );
this.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: hex } ) );
this.cone.position.set( 0, 1, 0 );
this.cone.matrixAutoUpdate = false;
this.add( this.cone );
if ( origin instanceof THREE.Vector3 ) this.position = origin;
this.setDirection( dir );

@@ -46,26 +52,33 @@ this.setLength( length );

THREE.ArrowHelper.prototype.setDirection = function ( dir ) {
THREE.ArrowHelper.prototype.setDirection = function () {
var d = THREE.ArrowHelper.__v1.copy( dir ).normalize();
var axis = new THREE.Vector3();
var radians;
if ( d.y > 0.999 ) {
return function ( dir ) {
this.rotation.set( 0, 0, 0 );
} else if ( d.y < - 0.999 ) {
// dir is assumed to be normalized
this.rotation.set( Math.PI, 0, 0 );
if ( dir.y > 0.999 ) {
} else {
this.quaternion.set( 0, 0, 0, 1 );
var axis = THREE.ArrowHelper.__v2.set( d.z, 0, - d.x ).normalize();
var radians = Math.acos( d.y );
var quaternion = THREE.ArrowHelper.__q1.setFromAxisAngle( axis, radians );
} else if ( dir.y < - 0.999 ) {
this.rotation.setEulerFromQuaternion( quaternion, this.eulerOrder );
this.quaternion.set( 1, 0, 0, 0 );
}
} else {
};
axis.set( dir.z, 0, - dir.x ).normalize();
radians = Math.acos( dir.y );
this.quaternion.setFromAxisAngle( axis, radians );
}
};
}();
THREE.ArrowHelper.prototype.setLength = function ( length ) {

@@ -83,5 +96,1 @@

};
THREE.ArrowHelper.__v1 = new THREE.Vector3();
THREE.ArrowHelper.__v2 = new THREE.Vector3();
THREE.ArrowHelper.__q1 = new THREE.Quaternion();

@@ -8,8 +8,10 @@ /**

size = size || 1;
var geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3(), new THREE.Vector3( size || 1, 0, 0 ),
new THREE.Vector3(), new THREE.Vector3( 0, size || 1, 0 ),
new THREE.Vector3(), new THREE.Vector3( 0, 0, size || 1 )
new THREE.Vector3(), new THREE.Vector3( size, 0, 0 ),
new THREE.Vector3(), new THREE.Vector3( 0, size, 0 ),
new THREE.Vector3(), new THREE.Vector3( 0, 0, size )
);

@@ -16,0 +18,0 @@

@@ -14,13 +14,7 @@ /**

var scope = this;
var geometry = new THREE.Geometry();
var material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } );
this.geometry = new THREE.Geometry();
this.material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } );
this.type = THREE.LinePieces;
var pointMap = {};
this.matrixWorld = camera.matrixWorld;
this.matrixAutoUpdate = false;
this.pointMap = {};
// colors

@@ -81,4 +75,2 @@

this.camera = camera;
function addLine( a, b, hex ) {

@@ -93,13 +85,23 @@

scope.geometry.vertices.push( new THREE.Vector3() );
scope.geometry.colors.push( new THREE.Color( hex ) );
geometry.vertices.push( new THREE.Vector3() );
geometry.colors.push( new THREE.Color( hex ) );
if ( scope.pointMap[ id ] === undefined ) scope.pointMap[ id ] = [];
if ( pointMap[ id ] === undefined ) {
scope.pointMap[ id ].push( scope.geometry.vertices.length - 1 );
pointMap[ id ] = [];
}
pointMap[ id ].push( geometry.vertices.length - 1 );
}
this.update( camera );
THREE.Line.call( this, geometry, material, THREE.LinePieces );
this.camera = camera;
this.matrixWorld = camera.matrixWorld;
this.matrixAutoUpdate = false;
this.pointMap = pointMap;
};

@@ -111,61 +113,69 @@

var scope = this;
var vector = new THREE.Vector3();
var camera = new THREE.Camera();
var projector = new THREE.Projector();
var w = 1, h = 1;
return function () {
// we need just camera projection matrix
// world matrix must be identity
var scope = this;
THREE.CameraHelper.__c.projectionMatrix.copy( this.camera.projectionMatrix );
var w = 1, h = 1;
// center / target
// we need just camera projection matrix
// world matrix must be identity
setPoint( "c", 0, 0, -1 );
setPoint( "t", 0, 0, 1 );
camera.projectionMatrix.copy( this.camera.projectionMatrix );
// near
// center / target
setPoint( "n1", -w, -h, -1 );
setPoint( "n2", w, -h, -1 );
setPoint( "n3", -w, h, -1 );
setPoint( "n4", w, h, -1 );
setPoint( "c", 0, 0, -1 );
setPoint( "t", 0, 0, 1 );
// far
// near
setPoint( "f1", -w, -h, 1 );
setPoint( "f2", w, -h, 1 );
setPoint( "f3", -w, h, 1 );
setPoint( "f4", w, h, 1 );
setPoint( "n1", -w, -h, -1 );
setPoint( "n2", w, -h, -1 );
setPoint( "n3", -w, h, -1 );
setPoint( "n4", w, h, -1 );
// up
// far
setPoint( "u1", w * 0.7, h * 1.1, -1 );
setPoint( "u2", -w * 0.7, h * 1.1, -1 );
setPoint( "u3", 0, h * 2, -1 );
setPoint( "f1", -w, -h, 1 );
setPoint( "f2", w, -h, 1 );
setPoint( "f3", -w, h, 1 );
setPoint( "f4", w, h, 1 );
// cross
// up
setPoint( "cf1", -w, 0, 1 );
setPoint( "cf2", w, 0, 1 );
setPoint( "cf3", 0, -h, 1 );
setPoint( "cf4", 0, h, 1 );
setPoint( "u1", w * 0.7, h * 1.1, -1 );
setPoint( "u2", -w * 0.7, h * 1.1, -1 );
setPoint( "u3", 0, h * 2, -1 );
setPoint( "cn1", -w, 0, -1 );
setPoint( "cn2", w, 0, -1 );
setPoint( "cn3", 0, -h, -1 );
setPoint( "cn4", 0, h, -1 );
// cross
function setPoint( point, x, y, z ) {
setPoint( "cf1", -w, 0, 1 );
setPoint( "cf2", w, 0, 1 );
setPoint( "cf3", 0, -h, 1 );
setPoint( "cf4", 0, h, 1 );
THREE.CameraHelper.__v.set( x, y, z );
THREE.CameraHelper.__projector.unprojectVector( THREE.CameraHelper.__v, THREE.CameraHelper.__c );
setPoint( "cn1", -w, 0, -1 );
setPoint( "cn2", w, 0, -1 );
setPoint( "cn3", 0, -h, -1 );
setPoint( "cn4", 0, h, -1 );
var points = scope.pointMap[ point ];
function setPoint( point, x, y, z ) {
if ( points !== undefined ) {
vector.set( x, y, z );
projector.unprojectVector( vector, camera );
for ( var i = 0, il = points.length; i < il; i ++ ) {
var points = scope.pointMap[ point ];
scope.geometry.vertices[ points[ i ] ].copy( THREE.CameraHelper.__v );
if ( points !== undefined ) {
for ( var i = 0, il = points.length; i < il; i ++ ) {
scope.geometry.vertices[ points[ i ] ].copy( vector );
}
}

@@ -175,11 +185,6 @@

}
this.geometry.verticesNeedUpdate = true;
this.geometry.verticesNeedUpdate = true;
};
};
THREE.CameraHelper.__projector = new THREE.Projector();
THREE.CameraHelper.__v = new THREE.Vector3();
THREE.CameraHelper.__c = new THREE.Camera();
}();
/**
* @author alteredq / http://alteredqualia.com/
*
* - shows directional light color, intensity, position, orientation and target
* @author mrdoob / http://mrdoob.com/
*/

@@ -11,72 +10,32 @@

this.matrixAutoUpdate = false;
this.light = light;
// position
var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } );
material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.position = light.position;
// direction
this.direction = new THREE.Vector3();
this.direction.subVectors( light.target.position, light.position );
// color
var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
this.color = light.color.clone();
this.color.multiplyScalar( intensity );
var hexColor = this.color.getHex();
// light helper
var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8 );
var raysGeometry = new THREE.AsteriskGeometry( sphereSize * 1.25, sphereSize * 2.25 );
var bulbMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
var raysMaterial = new THREE.LineBasicMaterial( { color: hexColor, fog: false } );
this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
this.lightRays = new THREE.Line( raysGeometry, raysMaterial, THREE.LinePieces );
this.lightSphere = new THREE.Mesh( geometry, material );
this.lightSphere.matrixWorld = this.light.matrixWorld;
this.lightSphere.matrixAutoUpdate = false;
this.add( this.lightSphere );
this.add( this.lightRays );
this.lightSphere.properties.isGizmo = true;
this.lightSphere.properties.gizmoSubject = light;
this.lightSphere.properties.gizmoRoot = this;
/*
this.targetSphere = new THREE.Mesh( geometry, material );
this.targetSphere.position = this.light.target.position;
this.add( this.targetSphere );
*/
// light target helper
geometry = new THREE.Geometry();
geometry.vertices.push( this.light.position );
geometry.vertices.push( this.light.target.position );
geometry.computeLineDistances();
this.targetSphere = null;
material = new THREE.LineDashedMaterial( { dashSize: 4, gapSize: 4, opacity: 0.75, transparent: true, fog: false } );
material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
if ( light.target.properties.targetInverse !== undefined ) {
this.targetLine = new THREE.Line( geometry, material );
this.add( this.targetLine );
var targetGeo = new THREE.SphereGeometry( sphereSize, 8, 4 );
var targetMaterial = new THREE.MeshBasicMaterial( { color: hexColor, wireframe: true, fog: false } );
this.targetSphere = new THREE.Mesh( targetGeo, targetMaterial );
this.targetSphere.position = light.target.position;
this.targetSphere.properties.isGizmo = true;
this.targetSphere.properties.gizmoSubject = light.target;
this.targetSphere.properties.gizmoRoot = this.targetSphere;
var lineMaterial = new THREE.LineDashedMaterial( { color: hexColor, dashSize: 4, gapSize: 4, opacity: 0.75, transparent: true, fog: false } );
var lineGeometry = new THREE.Geometry();
lineGeometry.vertices.push( this.position.clone() );
lineGeometry.vertices.push( this.targetSphere.position.clone() );
lineGeometry.computeLineDistances();
this.targetLine = new THREE.Line( lineGeometry, lineMaterial );
this.targetLine.properties.isGizmo = true;
}
//
this.properties.isGizmo = true;
}

@@ -88,34 +47,9 @@

// update arrow orientation
// pointing from light to target
this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.direction.subVectors( this.light.target.position, this.light.position );
this.targetLine.geometry.computeLineDistances();
this.targetLine.geometry.verticesNeedUpdate = true;
this.targetLine.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
// update arrow, spheres, rays and line colors to light color * light intensity
};
var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
this.color.copy( this.light.color );
this.color.multiplyScalar( intensity );
this.lightSphere.material.color.copy( this.color );
this.lightRays.material.color.copy( this.color );
// Only update targetSphere and targetLine if available
if ( this.targetSphere !== null ) {
this.targetSphere.material.color.copy( this.color );
this.targetLine.material.color.copy( this.color );
// update target line vertices
this.targetLine.geometry.vertices[ 0 ].copy( this.light.position );
this.targetLine.geometry.vertices[ 1 ].copy( this.light.target.position );
this.targetLine.geometry.computeLineDistances();
this.targetLine.geometry.verticesNeedUpdate = true;
}
}
/**
* @author alteredq / http://alteredqualia.com/
*
* - shows hemisphere light intensity, sky and ground colors and directions
* @author mrdoob / http://mrdoob.com/
*/

@@ -13,81 +12,24 @@

// position
var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
this.position = light.position;
for ( var i = 0, il = 8; i < il; i ++ ) {
//
geometry.faces[ i ].materialIndex = i < 4 ? 0 : 1;
var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
// sky color
this.color = light.color.clone();
this.color.multiplyScalar( intensity );
var hexColor = this.color.getHex();
// ground color
this.groundColor = light.groundColor.clone();
this.groundColor.multiplyScalar( intensity );
var hexColorGround = this.groundColor.getHex();
// double colored light bulb
var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8, 0, Math.PI * 2, 0, Math.PI * 0.5 );
var bulbGroundGeometry = new THREE.SphereGeometry( sphereSize, 16, 8, 0, Math.PI * 2, Math.PI * 0.5, Math.PI );
var bulbSkyMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
var bulbGroundMaterial = new THREE.MeshBasicMaterial( { color: hexColorGround, fog: false } );
for ( var i = 0, il = bulbGeometry.faces.length; i < il; i ++ ) {
bulbGeometry.faces[ i ].materialIndex = 0;
}
for ( var i = 0, il = bulbGroundGeometry.faces.length; i < il; i ++ ) {
var materialSky = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } );
materialSky.color.copy( light.color ).multiplyScalar( light.intensity );
bulbGroundGeometry.faces[ i ].materialIndex = 1;
var materialGround = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } );
materialGround.color.copy( light.groundColor ).multiplyScalar( light.intensity );
}
this.lightSphere = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( [ materialSky, materialGround ] ) );
this.lightSphere.position = light.position;
this.lightSphere.lookAt( new THREE.Vector3() );
this.add( this.lightSphere );
THREE.GeometryUtils.merge( bulbGeometry, bulbGroundGeometry );
};
this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial( [ bulbSkyMaterial, bulbGroundMaterial ] ) );
// arrows for sky and ground light directions
this.lightArrow = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, ( sphereSize + arrowLength ) * 1.1, 0 ), arrowLength, hexColor );
this.lightArrow.rotation.x = Math.PI;
this.lightArrowGround = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, ( sphereSize + arrowLength ) * -1.1, 0 ), arrowLength, hexColorGround );
var joint = new THREE.Object3D();
joint.rotation.x = -Math.PI * 0.5;
joint.add( this.lightSphere );
joint.add( this.lightArrow );
joint.add( this.lightArrowGround );
this.add( joint );
//
this.lightSphere.properties.isGizmo = true;
this.lightSphere.properties.gizmoSubject = light;
this.lightSphere.properties.gizmoRoot = this;
//
this.properties.isGizmo = true;
//
this.target = new THREE.Vector3();
this.lookAt( this.target );
}
THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype );

@@ -97,21 +39,8 @@

// update sphere sky and ground colors to light color * light intensity
this.lightSphere.lookAt( new THREE.Vector3() );
var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
this.lightSphere.material.materials[ 0 ].color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.lightSphere.material.materials[ 1 ].color.copy( this.light.groundColor ).multiplyScalar( this.light.intensity );
this.color.copy( this.light.color );
this.color.multiplyScalar( intensity );
};
this.groundColor.copy( this.light.groundColor );
this.groundColor.multiplyScalar( intensity );
this.lightSphere.material.materials[ 0 ].color.copy( this.color );
this.lightSphere.material.materials[ 1 ].color.copy( this.groundColor );
this.lightArrow.setColor( this.color.getHex() );
this.lightArrowGround.setColor( this.groundColor.getHex() );
this.lookAt( this.target );
}
/**
* @author alteredq / http://alteredqualia.com/
*
* - shows point light color, intensity, position and distance
* @author mrdoob / http://mrdoob.com/
*/

@@ -11,29 +10,20 @@

this.matrixAutoUpdate = false;
this.light = light;
// position
var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } );
material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.position = light.position;
this.lightSphere = new THREE.Mesh( geometry, material );
this.lightSphere.matrixWorld = this.light.matrixWorld;
this.lightSphere.matrixAutoUpdate = false;
this.add( this.lightSphere );
// color
var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
this.color = light.color.clone();
this.color.multiplyScalar( intensity );
var hexColor = this.color.getHex();
// light helper
var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8 );
var raysGeometry = new THREE.AsteriskGeometry( sphereSize * 1.25, sphereSize * 2.25 );
/*
var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
var bulbMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
var raysMaterial = new THREE.LineBasicMaterial( { color: hexColor, fog: false } );
var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
this.lightRays = new THREE.Line( raysGeometry, raysMaterial, THREE.LinePieces );
this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );

@@ -53,18 +43,7 @@

this.add( this.lightSphere );
this.add( this.lightRays );
this.add( this.lightDistance );
*/
//
};
this.lightSphere.properties.isGizmo = true;
this.lightSphere.properties.gizmoSubject = light;
this.lightSphere.properties.gizmoRoot = this;
//
this.properties.isGizmo = true;
}
THREE.PointLightHelper.prototype = Object.create( THREE.Object3D.prototype );

@@ -74,15 +53,7 @@

// update sphere and rays colors to light color * light intensity
this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
this.color.copy( this.light.color );
this.color.multiplyScalar( intensity );
this.lightSphere.material.color.copy( this.color );
this.lightRays.material.color.copy( this.color );
/*
this.lightDistance.material.color.copy( this.color );
//
var d = this.light.distance;

@@ -100,4 +71,5 @@

}
*/
}
};
/**
* @author alteredq / http://alteredqualia.com/
*
* - shows spot light color, intensity, position, orientation, light cone and target
*/
* @author mrdoob / http://mrdoob.com/
* @author WestLangley / http://github.com/WestLangley
*/

@@ -11,93 +11,35 @@ THREE.SpotLightHelper = function ( light, sphereSize ) {

this.matrixAutoUpdate = false;
this.light = light;
// position
var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
var material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true } );
material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.position = light.position;
this.lightSphere = new THREE.Mesh( geometry, material );
this.lightSphere.matrixWorld = this.light.matrixWorld;
this.lightSphere.matrixAutoUpdate = false;
this.add( this.lightSphere );
// direction
geometry = new THREE.CylinderGeometry( 0.0001, 1, 1, 8, 1, true );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, -0.5, 0 ) );
geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
this.direction = new THREE.Vector3();
this.direction.subVectors( light.target.position, light.position );
material = new THREE.MeshBasicMaterial( { fog: false, wireframe: true, opacity: 0.3, transparent: true } );
material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
// color
this.lightCone = new THREE.Mesh( geometry, material );
this.lightCone.position = this.light.position;
var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
var coneLength = light.distance ? light.distance : 10000;
var coneWidth = coneLength * Math.tan( light.angle );
this.color = light.color.clone();
this.color.multiplyScalar( intensity );
var hexColor = this.color.getHex();
// light helper
var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8 );
var raysGeometry = new THREE.AsteriskGeometry( sphereSize * 1.25, sphereSize * 2.25 );
var coneGeometry = new THREE.CylinderGeometry( 0.0001, 1, 1, 8, 1, true );
var coneMatrix = new THREE.Matrix4();
coneMatrix.rotateX( -Math.PI/2 );
coneMatrix.translate( new THREE.Vector3( 0, -0.5, 0 ) );
coneGeometry.applyMatrix( coneMatrix );
var bulbMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
var raysMaterial = new THREE.LineBasicMaterial( { color: hexColor, fog: false } );
var coneMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.3, transparent: true } );
this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
this.lightCone = new THREE.Mesh( coneGeometry, coneMaterial );
var coneLength = light.distance ? light.distance : 10000;
var coneWidth = coneLength * Math.tan( light.angle * 0.5 ) * 2;
this.lightCone.scale.set( coneWidth, coneWidth, coneLength );
this.lightCone.lookAt( this.light.target.position );
this.lightRays = new THREE.Line( raysGeometry, raysMaterial, THREE.LinePieces );
this.gyroscope = new THREE.Gyroscope();
this.gyroscope.add( this.lightSphere );
this.gyroscope.add( this.lightRays );
this.add( this.gyroscope );
this.add( this.lightCone );
this.lookAt( light.target.position );
};
this.lightSphere.properties.isGizmo = true;
this.lightSphere.properties.gizmoSubject = light;
this.lightSphere.properties.gizmoRoot = this;
// light target helper
this.targetSphere = null;
if ( light.target.properties.targetInverse !== undefined ) {
var targetGeo = new THREE.SphereGeometry( sphereSize, 8, 4 );
var targetMaterial = new THREE.MeshBasicMaterial( { color: hexColor, wireframe: true, fog: false } );
this.targetSphere = new THREE.Mesh( targetGeo, targetMaterial );
this.targetSphere.position = light.target.position;
this.targetSphere.properties.isGizmo = true;
this.targetSphere.properties.gizmoSubject = light.target;
this.targetSphere.properties.gizmoRoot = this.targetSphere;
var lineMaterial = new THREE.LineDashedMaterial( { color: hexColor, dashSize: 4, gapSize: 4, opacity: 0.75, transparent: true, fog: false } );
var lineGeometry = new THREE.Geometry();
lineGeometry.vertices.push( this.position.clone() );
lineGeometry.vertices.push( this.targetSphere.position.clone() );
lineGeometry.computeLineDistances();
this.targetLine = new THREE.Line( lineGeometry, lineMaterial );
this.targetLine.properties.isGizmo = true;
}
//
this.properties.isGizmo = true;
}
THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype );

@@ -107,42 +49,11 @@

// update arrow orientation
// pointing from light to target
var coneLength = this.light.distance ? this.light.distance : 10000;
var coneWidth = coneLength * Math.tan( this.light.angle );
this.direction.subVectors( this.light.target.position, this.light.position );
// update light cone orientation and size
this.lookAt( this.light.target.position );
var coneLength = this.light.distance ? this.light.distance : 10000;
var coneWidth = coneLength * Math.tan( this.light.angle * 0.5 ) * 2;
this.lightCone.scale.set( coneWidth, coneWidth, coneLength );
this.lightCone.lookAt( this.light.target.position );
// update arrow, spheres, rays and line colors to light color * light intensity
this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.lightCone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
this.color.copy( this.light.color );
this.color.multiplyScalar( intensity );
this.lightSphere.material.color.copy( this.color );
this.lightRays.material.color.copy( this.color );
this.lightCone.material.color.copy( this.color );
// Only update targetSphere and targetLine if available
if ( this.targetSphere !== null ) {
this.targetSphere.material.color.copy( this.color );
this.targetLine.material.color.copy( this.color );
// update target line vertices
this.targetLine.geometry.vertices[ 0 ].copy( this.light.position );
this.targetLine.geometry.vertices[ 1 ].copy( this.light.target.position );
this.targetLine.geometry.computeLineDistances();
this.targetLine.geometry.verticesNeedUpdate = true;
}
};

@@ -64,3 +64,3 @@ /**

if ( _renderer.autoUpdateScene ) scene.updateMatrixWorld();
if ( scene.autoUpdate === true ) scene.updateMatrixWorld();

@@ -67,0 +67,0 @@ // update camera matrices and frustum

@@ -180,3 +180,3 @@ /**

if ( _renderer.autoUpdateScene ) scene.updateMatrixWorld();
if ( scene.autoUpdate === true ) scene.updateMatrixWorld();

@@ -183,0 +183,0 @@ }

@@ -12,1 +12,11 @@ /**

THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );
THREE.AmbientLight.prototype.clone = function () {
var light = new THREE.AmbientLight();
THREE.Light.prototype.clone.call( this, light );
return light;
};

@@ -10,3 +10,3 @@ /**

this.position = new THREE.Vector3( 0, 1, 0 );
this.position.set( 0, 1, 0 );
this.target = new THREE.Object3D();

@@ -63,1 +63,18 @@

THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );
THREE.DirectionalLight.prototype.clone = function () {
var light = new THREE.DirectionalLight();
THREE.Light.prototype.clone.call( this, light );
light.target = this.target.clone();
light.intensity = this.intensity;
light.castShadow = this.castShadow;
light.onlyShadow = this.onlyShadow;
return light;
};

@@ -9,6 +9,5 @@ /**

this.position.set( 0, 100, 0 );
this.groundColor = new THREE.Color( groundColorHex );
this.position = new THREE.Vector3( 0, 100, 0 );
this.intensity = ( intensity !== undefined ) ? intensity : 1;

@@ -19,1 +18,14 @@

THREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype );
THREE.HemisphereLight.prototype.clone = function () {
var light = new THREE.PointLight();
THREE.Light.prototype.clone.call( this, light );
light.groundColor.copy( this.groundColor );
light.intensity = this.intensity;
return light;
};

@@ -15,1 +15,13 @@ /**

THREE.Light.prototype = Object.create( THREE.Object3D.prototype );
THREE.Light.prototype.clone = function ( light ) {
if ( light === undefined ) light = new THREE.Light();
THREE.Object3D.prototype.clone.call( this, light );
light.color.copy( this.color );
return light;
};

@@ -9,3 +9,2 @@ /**

this.position = new THREE.Vector3( 0, 0, 0 );
this.intensity = ( intensity !== undefined ) ? intensity : 1;

@@ -17,1 +16,14 @@ this.distance = ( distance !== undefined ) ? distance : 0;

THREE.PointLight.prototype = Object.create( THREE.Light.prototype );
THREE.PointLight.prototype.clone = function () {
var light = new THREE.PointLight();
THREE.Light.prototype.clone.call( this, light );
light.intensity = this.intensity;
light.distance = this.distance;
return light;
};

@@ -9,3 +9,3 @@ /**

this.position = new THREE.Vector3( 0, 1, 0 );
this.position.set( 0, 1, 0 );
this.target = new THREE.Object3D();

@@ -15,3 +15,3 @@

this.distance = ( distance !== undefined ) ? distance : 0;
this.angle = ( angle !== undefined ) ? angle : Math.PI / 2;
this.angle = ( angle !== undefined ) ? angle : Math.PI / 3;
this.exponent = ( exponent !== undefined ) ? exponent : 10;

@@ -46,1 +46,21 @@

THREE.SpotLight.prototype = Object.create( THREE.Light.prototype );
THREE.SpotLight.prototype.clone = function () {
var light = new THREE.SpotLight();
THREE.Light.prototype.clone.call( this, light );
light.target = this.target.clone();
light.intensity = this.intensity;
light.distance = this.distance;
light.angle = this.angle;
light.exponent = this.exponent;
light.castShadow = this.castShadow;
light.onlyShadow = this.onlyShadow;
return light;
};

@@ -7,4 +7,2 @@ /**

THREE.EventDispatcher.call( this );
this.crossOrigin = null;

@@ -18,2 +16,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function ( url, image ) {

@@ -20,0 +23,0 @@

@@ -44,3 +44,4 @@ /**

var json = JSON.parse( xhr.responseText );
context.createModel( json, callback, texturePath );
var result = context.parse( json, texturePath );
callback( result.geometry, result.materials );

@@ -81,4 +82,8 @@ } else {

length = xhr.getResponseHeader( "Content-Length" );
if ( callbackProgress !== undefined ) {
length = xhr.getResponseHeader( "Content-Length" );
}
}

@@ -94,3 +99,3 @@

THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath ) {
THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {

@@ -179,3 +184,3 @@ var scope = this,

isQuad = isBitSet( type, 0 );
isQuad = isBitSet( type, 0 );
hasMaterial = isBitSet( type, 1 );

@@ -425,8 +430,20 @@ hasFaceUv = isBitSet( type, 2 );

var materials = this.initMaterials( json.materials, texturePath );
if ( json.materials === undefined ) {
if ( this.needsTangents( materials ) ) geometry.computeTangents();
return { geometry: geometry };
callback( geometry, materials );
} else {
var materials = this.initMaterials( json.materials, texturePath );
if ( this.needsTangents( materials ) ) {
geometry.computeTangents();
}
return { geometry: geometry, materials: materials };
}
};

@@ -7,4 +7,2 @@ /**

THREE.EventDispatcher.call( this );
var scope = this;

@@ -38,1 +36,12 @@

};
THREE.LoadingMonitor.prototype = {
constructor: THREE.LoadingMonitor,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent
};

@@ -190,3 +190,3 @@ /**

"position": 1, "rotation": 1, "scale" : 1,
"visible": 1, "children": 1, "properties": 1,
"visible": 1, "children": 1, "userData": 1,
"skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1 };

@@ -411,2 +411,6 @@

pos = objJSON.position;
rot = objJSON.rotation;
quat = objJSON.quaternion;
if ( objJSON.type === "PerspectiveCamera" ) {

@@ -422,7 +426,18 @@

pos = objJSON.position;
camera.name = objID;
camera.position.set( pos[0], pos[1], pos[2] );
if ( quat !== undefined ) {
camera.quaternion.set( quat[0], quat[1], quat[2], quat[3] );
camera.useQuaternion = true;
} else if ( rot !== undefined ) {
camera.rotation.set( rot[0], rot[1], rot[2] );
}
parent.add( camera );
camera.name = objID;
result.cameras[ objID ] = camera;

@@ -467,8 +482,8 @@ result.objects[ objID ] = camera;

if ( objJSON.properties !== undefined ) {
if ( objJSON.userData !== undefined ) {
for ( var key in objJSON.properties ) {
for ( var key in objJSON.userData ) {
var value = objJSON.properties[ key ];
object.properties[ key ] = value;
var value = objJSON.userData[ key ];
object.userData[ key ] = value;

@@ -576,4 +591,6 @@ }

return function( geo, mat ) {
return function ( geo, mat ) {
geo.name = id;
handle_mesh( geo, mat, id );

@@ -593,3 +610,3 @@

return function( event ) {
return function ( event ) {

@@ -633,4 +650,6 @@ var result;

return function( geo, mat ) {
return function ( geo, mat ) {
geo.name = id;
result.geometries[ id ] = geo;

@@ -692,3 +711,3 @@ result.face_materials[ id ] = mat;

ta.object.target.properties.targetInverse = ta.object;
ta.object.target.userData.targetInverse = ta.object;

@@ -713,3 +732,3 @@ }

return function() {
return function () {

@@ -798,2 +817,3 @@ callbackTexture( count );

geometry = new THREE.CubeGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -804,2 +824,3 @@

geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -810,2 +831,3 @@

geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -816,2 +838,3 @@

geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -822,2 +845,3 @@

geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -828,2 +852,3 @@

geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions );
geometry.name = geoID;
result.geometries[ geoID ] = geometry;

@@ -860,3 +885,4 @@

var jsonLoader = this.geometryHandlerMap[ "ascii" ][ "loaderObject" ];
jsonLoader.createModel( modelJson, create_callback_embed( geoID ), texture_path );
var model = jsonLoader.parse( modelJson, texture_path );
create_callback_embed( geoID )( model.geometry, model.materials );

@@ -1144,2 +1170,4 @@ }

material.name = matID;
result.materials[ matID ] = material;

@@ -1146,0 +1174,0 @@

@@ -7,4 +7,2 @@ /**

THREE.EventDispatcher.call( this );
this.crossOrigin = null;

@@ -18,2 +16,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function ( url ) {

@@ -46,2 +49,2 @@

}
};

@@ -8,4 +8,2 @@ /**

THREE.EventDispatcher.call( this );
this.id = THREE.MaterialIdCount ++;

@@ -43,37 +41,44 @@

THREE.Material.prototype.setValues = function ( values ) {
THREE.Material.prototype = {
if ( values === undefined ) return;
constructor: THREE.Material,
for ( var key in values ) {
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
var newValue = values[ key ];
setValues: function ( values ) {
if ( newValue === undefined ) {
if ( values === undefined ) return;
console.warn( 'THREE.Material: \'' + key + '\' parameter is undefined.' );
continue;
for ( var key in values ) {
}
var newValue = values[ key ];
if ( key in this ) {
if ( newValue === undefined ) {
var currentValue = this[ key ];
console.warn( 'THREE.Material: \'' + key + '\' parameter is undefined.' );
continue;
if ( currentValue instanceof THREE.Color && newValue instanceof THREE.Color ) {
}
currentValue.copy( newValue );
if ( key in this ) {
} else if ( currentValue instanceof THREE.Color ) {
var currentValue = this[ key ];
currentValue.set( newValue );
if ( currentValue instanceof THREE.Color ) {
} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {
currentValue.set( newValue );
currentValue.copy( newValue );
} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {
} else {
currentValue.copy( newValue );
this[ key ] = newValue;
} else {
this[ key ] = newValue;
}
}

@@ -83,43 +88,43 @@

}
},
};
clone: function ( material ) {
THREE.Material.prototype.clone = function ( material ) {
if ( material === undefined ) material = new THREE.Material();
if ( material === undefined ) material = new THREE.Material();
material.name = this.name;
material.name = this.name;
material.side = this.side;
material.side = this.side;
material.opacity = this.opacity;
material.transparent = this.transparent;
material.opacity = this.opacity;
material.transparent = this.transparent;
material.blending = this.blending;
material.blending = this.blending;
material.blendSrc = this.blendSrc;
material.blendDst = this.blendDst;
material.blendEquation = this.blendEquation;
material.blendSrc = this.blendSrc;
material.blendDst = this.blendDst;
material.blendEquation = this.blendEquation;
material.depthTest = this.depthTest;
material.depthWrite = this.depthWrite;
material.depthTest = this.depthTest;
material.depthWrite = this.depthWrite;
material.polygonOffset = this.polygonOffset;
material.polygonOffsetFactor = this.polygonOffsetFactor;
material.polygonOffsetUnits = this.polygonOffsetUnits;
material.polygonOffset = this.polygonOffset;
material.polygonOffsetFactor = this.polygonOffsetFactor;
material.polygonOffsetUnits = this.polygonOffsetUnits;
material.alphaTest = this.alphaTest;
material.alphaTest = this.alphaTest;
material.overdraw = this.overdraw;
material.overdraw = this.overdraw;
material.visible = this.visible;
material.visible = this.visible;
return material;
return material;
},
};
dispose: function () {
THREE.Material.prototype.dispose = function () {
this.dispatchEvent( { type: 'dispose' } );
this.dispatchEvent( { type: 'dispose' } );
}

@@ -126,0 +131,0 @@ };

@@ -32,3 +32,3 @@ /**

var material = new THREE.LineBasicMaterial();
var material = new THREE.MeshDepthMaterial();

@@ -35,0 +35,0 @@ THREE.Material.prototype.clone.call( this, material );

@@ -26,2 +26,4 @@ /**

this.morphTargets = false;
this.setValues( parameters );

@@ -28,0 +30,0 @@

@@ -44,2 +44,4 @@ /**

this.linewidth = 1;
this.wireframe = false;

@@ -46,0 +48,0 @@ this.wireframeLinewidth = 1;

@@ -12,4 +12,6 @@ /**

THREE.extend( THREE.Box2.prototype, {
THREE.Box2.prototype = {
constructor: THREE.Box2,
set: function ( min, max ) {

@@ -69,3 +71,3 @@

setFromCenterAndSize: function() {
setFromCenterAndSize: function () {

@@ -210,3 +212,3 @@ var v1 = new THREE.Vector2();

distanceToPoint: function() {
distanceToPoint: function () {

@@ -263,2 +265,2 @@ var v1 = new THREE.Vector2();

} );
};

@@ -12,4 +12,6 @@ /**

THREE.extend( THREE.Box3.prototype, {
THREE.Box3.prototype = {
constructor: THREE.Box3,
set: function ( min, max ) {

@@ -286,3 +288,3 @@

new THREE.Vector3()
];
];

@@ -331,2 +333,2 @@ return function ( matrix ) {

} );
};

@@ -13,4 +13,6 @@ /**

THREE.extend( THREE.Color.prototype, {
THREE.Color.prototype = {
constructor: THREE.Color,
r: 1, g: 1, b: 1,

@@ -20,14 +22,18 @@

switch ( typeof value ) {
if ( value instanceof THREE.Color ) {
case "number":
this.setHex( value );
break;
this.copy( value );
case "string":
this.setStyle( value );
break;
} else if ( typeof value === 'number' ) {
this.setHex( value );
} else if ( typeof value === 'string' ) {
this.setStyle( value );
}
return this;
},

@@ -57,9 +63,2 @@

setHSV: function ( h, s, v ) {
console.log( 'DEPRECATED: Color\'s .setHSV() will be removed. Use .setHSL( h, s, l ) instead.' );
return this.setHSL(h,s*v/((h=(2-s)*v)<1?h:2-h),h/2); // https://gist.github.com/xpansive/1337890
},
setHSL: function ( h, s, l ) {

@@ -357,2 +356,8 @@

equals: function ( c ) {
return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );
},
clone: function () {

@@ -364,3 +369,3 @@

} );
};

@@ -367,0 +372,0 @@ THREE.ColorKeywords = { "aliceblue": 0xF0F8FF, "antiquewhite": 0xFAEBD7, "aqua": 0x00FFFF, "aquamarine": 0x7FFFD4, "azure": 0xF0FFFF,

@@ -22,4 +22,6 @@ /**

THREE.extend( THREE.Frustum.prototype, {
THREE.Frustum.prototype = {
constructor: THREE.Frustum,
set: function ( p0, p1, p2, p3, p4, p5 ) {

@@ -152,2 +154,2 @@

} );
};

@@ -12,4 +12,6 @@ /**

THREE.extend( THREE.Line3.prototype, {
THREE.Line3.prototype = {
constructor: THREE.Line3,
set: function ( start, end ) {

@@ -73,3 +75,3 @@

return function ( point, clampToLine ) {
startP.subVectors( point, this.start );

@@ -83,10 +85,10 @@ startEnd.subVectors( this.end, this.start );

if( clampToLine ) {
t = THREE.Math.clamp( t, 0, 1 );
if ( clampToLine ) {
}
t = THREE.Math.clamp( t, 0, 1 );
return t;
}
return t;
};

@@ -100,5 +102,5 @@

var result = optionalTarget || new THREE.Vector3();
var result = optionalTarget || new THREE.Vector3();
return this.delta( result ).multiplyScalar( t ).add( this.start );
return this.delta( result ).multiplyScalar( t ).add( this.start );

@@ -128,2 +130,2 @@ },

} );
};

@@ -20,4 +20,6 @@ /**

THREE.extend( THREE.Matrix3.prototype, {
THREE.Matrix3.prototype = {
constructor: THREE.Matrix3,
set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {

@@ -224,2 +226,2 @@

} );
};

@@ -11,2 +11,3 @@ /**

* @author bhouston / http://exocortex.com
* @author WestLangley / http://github.com/WestLangley
*/

@@ -29,4 +30,6 @@

THREE.extend( THREE.Matrix4.prototype, {
THREE.Matrix4.prototype = {
constructor: THREE.Matrix4,
set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {

@@ -77,4 +80,63 @@

extractPosition: function ( m ) {
console.warn( 'DEPRECATED: Matrix4\'s .extractPosition() has been renamed to .copyPosition().' );
return this.copyPosition( m );
},
copyPosition: function ( m ) {
var te = this.elements;
var me = m.elements;
te[12] = me[12];
te[13] = me[13];
te[14] = me[14];
return this;
},
extractRotation: function () {
var v1 = new THREE.Vector3();
return function ( m ) {
var te = this.elements;
var me = m.elements;
var scaleX = 1 / v1.set( me[0], me[1], me[2] ).length();
var scaleY = 1 / v1.set( me[4], me[5], me[6] ).length();
var scaleZ = 1 / v1.set( me[8], me[9], me[10] ).length();
te[0] = me[0] * scaleX;
te[1] = me[1] * scaleX;
te[2] = me[2] * scaleX;
te[4] = me[4] * scaleY;
te[5] = me[5] * scaleY;
te[6] = me[6] * scaleY;
te[8] = me[8] * scaleZ;
te[9] = me[9] * scaleZ;
te[10] = me[10] * scaleZ;
return this;
};
}(),
setRotationFromEuler: function ( v, order ) {
console.warn( 'DEPRECATED: Matrix4\'s .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.' );
return this.makeRotationFromEuler( v, order );
},
makeRotationFromEuler: function ( v, order ) {
var te = this.elements;

@@ -185,2 +247,13 @@

// last column
te[3] = 0;
te[7] = 0;
te[11] = 0;
// bottom row
te[12] = 0;
te[13] = 0;
te[14] = 0;
te[15] = 1;
return this;

@@ -192,2 +265,10 @@

console.warn( 'DEPRECATED: Matrix4\'s .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.' );
return this.makeRotationFromQuaternion( q );
},
makeRotationFromQuaternion: function ( q ) {
var te = this.elements;

@@ -213,2 +294,13 @@

// last column
te[3] = 0;
te[7] = 0;
te[11] = 0;
// bottom row
te[12] = 0;
te[13] = 0;
te[14] = 0;
te[15] = 1;
return this;

@@ -381,28 +473,13 @@

var te = this.elements;
var vx = v.x, vy = v.y, vz = v.z;
console.warn( 'DEPRECATED: Matrix4\'s .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
v.x = vx * te[0] + vy * te[4] + vz * te[8];
v.y = vx * te[1] + vy * te[5] + vz * te[9];
v.z = vx * te[2] + vy * te[6] + vz * te[10];
v.transformDirection( this );
v.normalize();
return v;
},
crossVector: function ( a ) {
crossVector: function ( vector ) {
var te = this.elements;
var v = new THREE.Vector4();
console.warn( 'DEPRECATED: Matrix4\'s .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
return vector.applyMatrix4( this );
v.x = te[0] * a.x + te[4] * a.y + te[8] * a.z + te[12] * a.w;
v.y = te[1] * a.x + te[5] * a.y + te[9] * a.z + te[13] * a.w;
v.z = te[2] * a.x + te[6] * a.y + te[10] * a.z + te[14] * a.w;
v.w = ( a.w ) ? te[3] * a.x + te[7] * a.y + te[11] * a.z + te[15] * a.w : 1;
return v;
},

@@ -598,136 +675,6 @@

compose: function() {
var mRotation = new THREE.Matrix4(),
mScale = new THREE.Matrix4();
return function ( translation, rotation, scale ) {
var te = this.elements;
mRotation.identity();
mRotation.setRotationFromQuaternion( rotation );
mScale.makeScale( scale.x, scale.y, scale.z );
this.multiplyMatrices( mRotation, mScale );
te[12] = translation.x;
te[13] = translation.y;
te[14] = translation.z;
return this;
};
}(),
decompose: function() {
var x = new THREE.Vector3(),
y = new THREE.Vector3(),
z = new THREE.Vector3(),
matrix = new THREE.Matrix4();
return function ( translation, rotation, scale ) {
var te = this.elements;
// grab the axis vectors
x.set( te[0], te[1], te[2] );
y.set( te[4], te[5], te[6] );
z.set( te[8], te[9], te[10] );
translation = ( translation instanceof THREE.Vector3 ) ? translation : new THREE.Vector3();
rotation = ( rotation instanceof THREE.Quaternion ) ? rotation : new THREE.Quaternion();
scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3();
scale.x = x.length();
scale.y = y.length();
scale.z = z.length();
translation.x = te[12];
translation.y = te[13];
translation.z = te[14];
// scale the rotation part
matrix.copy( this );
matrix.elements[0] /= scale.x;
matrix.elements[1] /= scale.x;
matrix.elements[2] /= scale.x;
matrix.elements[4] /= scale.y;
matrix.elements[5] /= scale.y;
matrix.elements[6] /= scale.y;
matrix.elements[8] /= scale.z;
matrix.elements[9] /= scale.z;
matrix.elements[10] /= scale.z;
rotation.setFromRotationMatrix( matrix );
return [ translation, rotation, scale ];
};
}(),
extractPosition: function ( m ) {
var te = this.elements;
var me = m.elements;
te[12] = me[12];
te[13] = me[13];
te[14] = me[14];
return this;
},
extractRotation: function() {
var v1 = new THREE.Vector3();
return function ( m ) {
var te = this.elements;
var me = m.elements;
var scaleX = 1 / v1.set( me[0], me[1], me[2] ).length();
var scaleY = 1 / v1.set( me[4], me[5], me[6] ).length();
var scaleZ = 1 / v1.set( me[8], me[9], me[10] ).length();
te[0] = me[0] * scaleX;
te[1] = me[1] * scaleX;
te[2] = me[2] * scaleX;
te[4] = me[4] * scaleY;
te[5] = me[5] * scaleY;
te[6] = me[6] * scaleY;
te[8] = me[8] * scaleZ;
te[9] = me[9] * scaleZ;
te[10] = me[10] * scaleZ;
return this;
};
}(),
translate: function ( v ) {
var te = this.elements;
var x = v.x, y = v.y, z = v.z;
console.warn( 'DEPRECATED: Matrix4\'s .translate() has been removed.');
te[12] = te[0] * x + te[4] * y + te[8] * z + te[12];
te[13] = te[1] * x + te[5] * y + te[9] * z + te[13];
te[14] = te[2] * x + te[6] * y + te[10] * z + te[14];
te[15] = te[3] * x + te[7] * y + te[11] * z + te[15];
return this;
},

@@ -737,26 +684,4 @@

var te = this.elements;
var m12 = te[4];
var m22 = te[5];
var m32 = te[6];
var m42 = te[7];
var m13 = te[8];
var m23 = te[9];
var m33 = te[10];
var m43 = te[11];
var c = Math.cos( angle );
var s = Math.sin( angle );
console.warn( 'DEPRECATED: Matrix4\'s .rotateX() has been removed.');
te[4] = c * m12 + s * m13;
te[5] = c * m22 + s * m23;
te[6] = c * m32 + s * m33;
te[7] = c * m42 + s * m43;
te[8] = c * m13 - s * m12;
te[9] = c * m23 - s * m22;
te[10] = c * m33 - s * m32;
te[11] = c * m43 - s * m42;
return this;
},

@@ -766,26 +691,4 @@

var te = this.elements;
var m11 = te[0];
var m21 = te[1];
var m31 = te[2];
var m41 = te[3];
var m13 = te[8];
var m23 = te[9];
var m33 = te[10];
var m43 = te[11];
var c = Math.cos( angle );
var s = Math.sin( angle );
console.warn( 'DEPRECATED: Matrix4\'s .rotateY() has been removed.');
te[0] = c * m11 - s * m13;
te[1] = c * m21 - s * m23;
te[2] = c * m31 - s * m33;
te[3] = c * m41 - s * m43;
te[8] = c * m13 + s * m11;
te[9] = c * m23 + s * m21;
te[10] = c * m33 + s * m31;
te[11] = c * m43 + s * m41;
return this;
},

@@ -795,26 +698,4 @@

var te = this.elements;
var m11 = te[0];
var m21 = te[1];
var m31 = te[2];
var m41 = te[3];
var m12 = te[4];
var m22 = te[5];
var m32 = te[6];
var m42 = te[7];
var c = Math.cos( angle );
var s = Math.sin( angle );
console.warn( 'DEPRECATED: Matrix4\'s .rotateZ() has been removed.');
te[0] = c * m11 + s * m12;
te[1] = c * m21 + s * m22;
te[2] = c * m31 + s * m32;
te[3] = c * m41 + s * m42;
te[4] = c * m12 - s * m11;
te[5] = c * m22 - s * m21;
te[6] = c * m32 - s * m31;
te[7] = c * m42 - s * m41;
return this;
},

@@ -824,69 +705,4 @@

var te = this.elements;
console.warn( 'DEPRECATED: Matrix4\'s .rotateByAxis() has been removed.');
// optimize by checking axis
if ( axis.x === 1 && axis.y === 0 && axis.z === 0 ) {
return this.rotateX( angle );
} else if ( axis.x === 0 && axis.y === 1 && axis.z === 0 ) {
return this.rotateY( angle );
} else if ( axis.x === 0 && axis.y === 0 && axis.z === 1 ) {
return this.rotateZ( angle );
}
var x = axis.x, y = axis.y, z = axis.z;
var n = Math.sqrt(x * x + y * y + z * z);
x /= n;
y /= n;
z /= n;
var xx = x * x, yy = y * y, zz = z * z;
var c = Math.cos( angle );
var s = Math.sin( angle );
var oneMinusCosine = 1 - c;
var xy = x * y * oneMinusCosine;
var xz = x * z * oneMinusCosine;
var yz = y * z * oneMinusCosine;
var xs = x * s;
var ys = y * s;
var zs = z * s;
var r11 = xx + (1 - xx) * c;
var r21 = xy + zs;
var r31 = xz - ys;
var r12 = xy - zs;
var r22 = yy + (1 - yy) * c;
var r32 = yz + xs;
var r13 = xz + ys;
var r23 = yz - xs;
var r33 = zz + (1 - zz) * c;
var m11 = te[0], m21 = te[1], m31 = te[2], m41 = te[3];
var m12 = te[4], m22 = te[5], m32 = te[6], m42 = te[7];
var m13 = te[8], m23 = te[9], m33 = te[10], m43 = te[11];
te[0] = r11 * m11 + r21 * m12 + r31 * m13;
te[1] = r11 * m21 + r21 * m22 + r31 * m23;
te[2] = r11 * m31 + r21 * m32 + r31 * m33;
te[3] = r11 * m41 + r21 * m42 + r31 * m43;
te[4] = r12 * m11 + r22 * m12 + r32 * m13;
te[5] = r12 * m21 + r22 * m22 + r32 * m23;
te[6] = r12 * m31 + r22 * m32 + r32 * m33;
te[7] = r12 * m41 + r22 * m42 + r32 * m43;
te[8] = r13 * m11 + r23 * m12 + r33 * m13;
te[9] = r13 * m21 + r23 * m22 + r33 * m23;
te[10] = r13 * m31 + r23 * m32 + r33 * m33;
te[11] = r13 * m41 + r23 * m42 + r33 * m43;
return this;
},

@@ -1024,2 +840,30 @@

compose: function ( position, quaternion, scale ) {
console.warn( 'DEPRECATED: Matrix4\'s .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code.' );
return this.makeFromPositionQuaternionScale( position, quaternion, scale );
},
makeFromPositionQuaternionScale: function ( position, quaternion, scale ) {
this.makeRotationFromQuaternion( quaternion );
this.scale( scale );
this.setPosition( position );
return this;
},
makeFromPositionEulerScale: function ( position, rotation, eulerOrder, scale ) {
this.makeRotationFromEuler( rotation, eulerOrder );
this.scale( scale );
this.setPosition( position );
return this;
},
makeFrustum: function ( left, right, bottom, top, near, far ) {

@@ -1091,2 +935,58 @@

};
THREE.extend( THREE.Matrix4.prototype, {
decompose: function() {
var x = new THREE.Vector3();
var y = new THREE.Vector3();
var z = new THREE.Vector3();
var matrix = new THREE.Matrix4();
return function ( position, quaternion, scale ) {
var te = this.elements;
// grab the axis vectors
x.set( te[0], te[1], te[2] );
y.set( te[4], te[5], te[6] );
z.set( te[8], te[9], te[10] );
position = ( position instanceof THREE.Vector3 ) ? position : new THREE.Vector3();
quaternion = ( quaternion instanceof THREE.Quaternion ) ? quaternion : new THREE.Quaternion();
scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3();
scale.x = x.length();
scale.y = y.length();
scale.z = z.length();
position.x = te[12];
position.y = te[13];
position.z = te[14];
// scale the rotation part
matrix.copy( this );
matrix.elements[0] /= scale.x;
matrix.elements[1] /= scale.x;
matrix.elements[2] /= scale.x;
matrix.elements[4] /= scale.y;
matrix.elements[5] /= scale.y;
matrix.elements[6] /= scale.y;
matrix.elements[8] /= scale.z;
matrix.elements[9] /= scale.z;
matrix.elements[10] /= scale.z;
quaternion.setFromRotationMatrix( matrix );
return [ position, quaternion, scale ];
};
}()
} );

@@ -12,4 +12,6 @@ /**

THREE.extend( THREE.Plane.prototype, {
THREE.Plane.prototype = {
constructor: THREE.Plane,
set: function ( normal, constant ) {

@@ -187,3 +189,3 @@

// http://www.songho.ca/opengl/gl_normaltransform.html
optionalNormalMatrix = optionalNormalMatrix || new THREE.Matrix3().getInverse( matrix ).transpose();
optionalNormalMatrix = optionalNormalMatrix || new THREE.Matrix3().getNormalMatrix( matrix );
var newNormal = v1.copy( this.normal ).applyMatrix3( optionalNormalMatrix );

@@ -222,2 +224,2 @@

} );
};

@@ -17,4 +17,6 @@ /**

THREE.extend( THREE.Quaternion.prototype, {
THREE.Quaternion.prototype = {
constructor: THREE.Quaternion,
set: function ( x, y, z, w ) {

@@ -335,2 +337,19 @@

fromArray: function ( array ) {
this.x = array[ 0 ];
this.y = array[ 1 ];
this.z = array[ 2 ];
this.w = array[ 3 ];
return this;
},
toArray: function () {
return [ this.x, this.y, this.z, this.w ];
},
clone: function () {

@@ -342,3 +361,3 @@

} );
};

@@ -345,0 +364,0 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {

@@ -12,4 +12,6 @@ /**

THREE.extend( THREE.Ray.prototype, {
THREE.Ray.prototype = {
constructor: THREE.Ray,
set: function ( origin, direction ) {

@@ -165,2 +167,2 @@

} );
};

@@ -13,4 +13,6 @@ /**

THREE.extend( THREE.Sphere.prototype, {
THREE.Sphere.prototype = {
constructor: THREE.Sphere,
set: function ( center, radius ) {

@@ -135,2 +137,2 @@

} );
};

@@ -18,3 +18,3 @@ /**

return function( a, b, c, optionalTarget ) {
return function ( a, b, c, optionalTarget ) {

@@ -44,5 +44,5 @@ var result = optionalTarget || new THREE.Vector3();

var v0 = new THREE.Vector3(),
v1 = new THREE.Vector3(),
v2 = new THREE.Vector3();
var v0 = new THREE.Vector3();
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3();

@@ -97,3 +97,3 @@ return function ( point, a, b, c, optionalTarget ) {

THREE.extend( THREE.Triangle.prototype, {
THREE.Triangle.prototype = {

@@ -193,2 +193,2 @@ constructor: THREE.Triangle,

} );
};

@@ -15,4 +15,6 @@ /**

THREE.extend( THREE.Vector2.prototype, {
THREE.Vector2.prototype = {
constructor: THREE.Vector2,
set: function ( x, y ) {

@@ -297,6 +299,15 @@

fromArray: function ( array ) {
this.x = array[ 0 ];
this.y = array[ 1 ];
return this;
},
toArray: function () {
return [ this.x, this.y ];
},

@@ -310,2 +321,2 @@

} );
};

@@ -18,4 +18,6 @@ /**

THREE.extend( THREE.Vector3.prototype, {
THREE.Vector3.prototype = {
constructor: THREE.Vector3,
set: function ( x, y, z ) {

@@ -269,34 +271,2 @@

applyEuler: function () {
var q1 = new THREE.Quaternion();
return function ( v, eulerOrder ) {
var quaternion = q1.setFromEuler( v, eulerOrder );
this.applyQuaternion( quaternion );
return this;
};
}(),
applyAxisAngle: function () {
var q1 = new THREE.Quaternion();
return function ( axis, angle ) {
var quaternion = q1.setFromAxisAngle( axis, angle );
this.applyQuaternion( quaternion );
return this;
};
}(),
transformDirection: function ( m ) {

@@ -525,44 +495,2 @@

projectOnVector: function () {
var v1 = new THREE.Vector3();
return function( vector ) {
v1.copy( vector ).normalize();
var d = this.dot( v1 );
return this.copy( v1 ).multiplyScalar( d );
};
}(),
projectOnPlane: function () {
var v1 = new THREE.Vector3();
return function( planeNormal ) {
v1.copy( this ).projectOnVector( planeNormal );
return this.sub( v1 );
}
}(),
reflect: function () {
var v1 = new THREE.Vector3();
return function ( vector ) {
v1.copy( this ).projectOnVector( vector ).multiplyScalar( 2 );
return this.subVectors( v1, this );
}
}(),
angleTo: function ( v ) {

@@ -594,12 +522,2 @@

getPositionFromMatrix: function ( m ) {
this.x = m.elements[12];
this.y = m.elements[13];
this.z = m.elements[14];
return this;
},
setEulerFromRotationMatrix: function ( m, order ) {

@@ -785,2 +703,12 @@

getPositionFromMatrix: function ( m ) {
this.x = m.elements[12];
this.y = m.elements[13];
this.z = m.elements[14];
return this;
},
getScaleFromMatrix: function ( m ) {

@@ -799,2 +727,16 @@

getColumnFromMatrix: function ( index, matrix ) {
var offset = index * 4;
var me = matrix.elements;
this.x = me[ offset ];
this.y = me[ offset + 1 ];
this.z = me[ offset + 2 ];
return this;
},
equals: function ( v ) {

@@ -806,6 +748,16 @@

fromArray: function ( array ) {
this.x = array[ 0 ];
this.y = array[ 1 ];
this.z = array[ 2 ];
return this;
},
toArray: function () {
return [ this.x, this.y, this.z ];
},

@@ -819,2 +771,80 @@

};
THREE.extend( THREE.Vector3.prototype, {
applyEuler: function () {
var q1 = new THREE.Quaternion();
return function ( v, eulerOrder ) {
var quaternion = q1.setFromEuler( v, eulerOrder );
this.applyQuaternion( quaternion );
return this;
};
}(),
applyAxisAngle: function () {
var q1 = new THREE.Quaternion();
return function ( axis, angle ) {
var quaternion = q1.setFromAxisAngle( axis, angle );
this.applyQuaternion( quaternion );
return this;
};
}(),
projectOnVector: function () {
var v1 = new THREE.Vector3();
return function ( vector ) {
v1.copy( vector ).normalize();
var d = this.dot( v1 );
return this.copy( v1 ).multiplyScalar( d );
};
}(),
projectOnPlane: function () {
var v1 = new THREE.Vector3();
return function ( planeNormal ) {
v1.copy( this ).projectOnVector( planeNormal );
return this.sub( v1 );
}
}(),
reflect: function () {
var v1 = new THREE.Vector3();
return function ( vector ) {
v1.copy( this ).projectOnVector( vector ).multiplyScalar( 2 );
return this.subVectors( v1, this );
}
}()
} );

@@ -18,4 +18,6 @@ /**

THREE.extend( THREE.Vector4.prototype, {
THREE.Vector4.prototype = {
constructor: THREE.Vector4,
set: function ( x, y, z, w ) {

@@ -549,6 +551,17 @@

fromArray: function ( array ) {
this.x = array[ 0 ];
this.y = array[ 1 ];
this.z = array[ 2 ];
this.w = array[ 3 ];
return this;
},
toArray: function () {
return [ this.x, this.y, this.z, this.w ];
},

@@ -562,2 +575,2 @@

} );
};

@@ -11,3 +11,3 @@ /**

this.LODs = [];
this.objects = [];

@@ -19,16 +19,29 @@ };

THREE.LOD.prototype.addLevel = function ( object3D, visibleAtDistance ) {
THREE.LOD.prototype.addLevel = function ( object, distance ) {
if ( visibleAtDistance === undefined ) {
if ( distance === undefined ) distance = 0;
visibleAtDistance = 0;
distance = Math.abs( distance );
for ( var l = 0; l < this.objects.length; l ++ ) {
if ( distance < this.objects[ l ].distance ) {
break;
}
}
visibleAtDistance = Math.abs( visibleAtDistance );
this.objects.splice( l, 0, { distance: distance, object: object } );
this.add( object );
for ( var l = 0; l < this.LODs.length; l ++ ) {
};
if ( visibleAtDistance < this.LODs[ l ].visibleAtDistance ) {
THREE.LOD.prototype.getObjectForDistance = function ( distance ) {
for ( var i = 1, l = this.objects.length; i < l; i ++ ) {
if ( distance < this.objects[ i ].distance ) {
break;

@@ -40,42 +53,48 @@

this.LODs.splice( l, 0, { visibleAtDistance: visibleAtDistance, object3D: object3D } );
this.add( object3D );
return this.objects[ i - 1 ].object;
};
THREE.LOD.prototype.update = function ( camera ) {
THREE.LOD.prototype.update = function () {
if ( this.LODs.length > 1 ) {
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3();
camera.matrixWorldInverse.getInverse( camera.matrixWorld );
return function ( camera ) {
var inverse = camera.matrixWorldInverse;
var distance = -( inverse.elements[2] * this.matrixWorld.elements[12] + inverse.elements[6] * this.matrixWorld.elements[13] + inverse.elements[10] * this.matrixWorld.elements[14] + inverse.elements[14] );
if ( this.objects.length > 1 ) {
this.LODs[ 0 ].object3D.visible = true;
v1.getPositionFromMatrix( camera.matrixWorld );
v2.getPositionFromMatrix( this.matrixWorld );
for ( var l = 1; l < this.LODs.length; l ++ ) {
var distance = v1.distanceTo( v2 );
if( distance >= this.LODs[ l ].visibleAtDistance ) {
this.objects[ 0 ].object.visible = true;
this.LODs[ l - 1 ].object3D.visible = false;
this.LODs[ l ].object3D.visible = true;
for ( var i = 1, l = this.objects.length; i < l; i ++ ) {
} else {
if ( distance >= this.objects[ i ].distance ) {
break;
this.objects[ i - 1 ].object.visible = false;
this.objects[ i ].object.visible = true;
} else {
break;
}
}
}
for( ; i < l; i ++ ) {
for( ; l < this.LODs.length; l ++ ) {
this.objects[ i ].object.visible = false;
this.LODs[ l ].object3D.visible = false;
}
}
}
};
};
}();

@@ -82,0 +101,0 @@ THREE.LOD.prototype.clone = function () {

@@ -12,7 +12,18 @@ /**

this.geometry = geometry;
this.material = ( material !== undefined ) ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
this.geometry = null;
this.material = null;
if ( this.geometry !== undefined ) {
this.setGeometry( geometry );
this.setMaterial( material );
};
THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
THREE.Mesh.prototype.setGeometry = function ( geometry ) {
if ( geometry !== undefined ) {
this.geometry = geometry;
if ( this.geometry.boundingSphere === null ) {

@@ -30,4 +41,16 @@

THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
THREE.Mesh.prototype.setMaterial = function ( material ) {
if ( material !== undefined ) {
this.material = material;
} else {
this.material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
}
};
THREE.Mesh.prototype.updateMorphTargets = function () {

@@ -34,0 +57,0 @@

@@ -25,13 +25,6 @@ /**

this.matrix.setPosition( this.position );
this.rotation3d.set( 0, 0, this.rotation );
this.matrix.setRotationFromEuler( this.rotation3d );
this.quaternion.setFromEuler( this.rotation3d, this.eulerOrder );
this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
if ( this.scale.x !== 1 || this.scale.y !== 1 ) {
this.matrix.scale( this.scale );
}
this.matrixWorldNeedsUpdate = true;

@@ -38,0 +31,0 @@

@@ -25,3 +25,3 @@ /**

_clearColor = new THREE.Color( 0x000000 ),
_clearOpacity = 0,
_clearAlpha = 0,

@@ -67,3 +67,2 @@ _contextGlobalAlpha = 1,

_enableLighting = false,
_ambientLight = new THREE.Color(),

@@ -145,3 +144,3 @@ _directionalLights = new THREE.Color(),

this.setSize = function ( width, height ) {
this.setSize = function ( width, height, updateStyle ) {

@@ -157,5 +156,9 @@ _canvasWidth = width * this.devicePixelRatio;

_canvas.style.width = width + 'px';
_canvas.style.height = height + 'px';
if ( this.devicePixelRatio !== 1 && updateStyle !== false ) {
_canvas.style.width = width + 'px';
_canvas.style.height = height + 'px';
}
_clipBox.set(

@@ -181,6 +184,6 @@ new THREE.Vector2( - _canvasWidthHalf, - _canvasHeightHalf ),

this.setClearColor = function ( color, opacity ) {
this.setClearColor = function ( color, alpha ) {
_clearColor.copy( color );
_clearOpacity = opacity !== undefined ? opacity : 1;
_clearColor.set( color );
_clearAlpha = alpha !== undefined ? alpha : 1;

@@ -194,15 +197,10 @@ _clearBox.set(

this.setClearColorHex = function ( hex, opacity ) {
this.setClearColorHex = function ( hex, alpha ) {
_clearColor.setHex( hex );
_clearOpacity = opacity !== undefined ? opacity : 1;
console.warn( 'DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
this.setClearColor( hex, alpha );
_clearBox.set(
new THREE.Vector2( - _canvasWidthHalf, - _canvasHeightHalf ),
new THREE.Vector2( _canvasWidthHalf, _canvasHeightHalf )
);
};
this.getMaxAnisotropy = function () {
this.getMaxAnisotropy = function () {

@@ -222,3 +220,3 @@ return 0;

if ( _clearOpacity < 1 ) {
if ( _clearAlpha < 1 ) {

@@ -234,3 +232,3 @@ _context.clearRect(

if ( _clearOpacity > 0 ) {
if ( _clearAlpha > 0 ) {

@@ -240,3 +238,3 @@ setBlending( THREE.NormalBlending );

setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clearOpacity + ')' );
setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clearAlpha + ')' );

@@ -268,8 +266,4 @@ _context.fillRect(

if ( this.autoClear === true ) {
if ( this.autoClear === true ) this.clear();
this.clear();
}
_context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );

@@ -289,10 +283,4 @@

_enableLighting = _lights.length > 0;
calculateLights();
if ( _enableLighting === true ) {
calculateLights();
}
for ( var e = 0, el = _elements.length; e < el; e++ ) {

@@ -322,3 +310,6 @@

_elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen ] );
_elemBox.setFromPoints( [
_v1.positionScreen,
_v2.positionScreen
] );

@@ -351,6 +342,14 @@ if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {

_elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen ] );
_elemBox.setFromPoints( [
_v1.positionScreen,
_v2.positionScreen,
_v3.positionScreen
] );
renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material );
if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material );
}
} else if ( element instanceof THREE.RenderableFace4 ) {

@@ -384,6 +383,15 @@

_elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen, _v4.positionScreen ] );
_elemBox.setFromPoints( [
_v1.positionScreen,
_v2.positionScreen,
_v3.positionScreen,
_v4.positionScreen
] );
renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material, scene );
if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material );
}
}

@@ -511,2 +519,3 @@

_elemBox.makeEmpty();
return;

@@ -544,2 +553,3 @@

_elemBox.makeEmpty();
return;

@@ -580,2 +590,3 @@

_elemBox.makeEmpty();
return;

@@ -615,5 +626,33 @@

setLineJoin( material.linejoin );
setStrokeStyle( material.color.getStyle() );
setDashAndGap( null, null );
if ( material.vertexColors !== THREE.VertexColors ) {
setStrokeStyle( material.color.getStyle() );
} else {
var colorStyle1 = element.vertexColors[0].getStyle();
var colorStyle2 = element.vertexColors[1].getStyle();
if ( colorStyle1 === colorStyle2 ) {
setStrokeStyle( colorStyle1 );
} else {
var grad = _context.createLinearGradient(
v1.positionScreen.x,
v1.positionScreen.y,
v2.positionScreen.x,
v2.positionScreen.y
);
grad.addColorStop( 0, colorStyle1 );
grad.addColorStop( 1, colorStyle2 );
setStrokeStyle( grad );
}
}
_context.stroke();

@@ -631,4 +670,7 @@ _elemBox.expandByScalar( material.linewidth * 2 );

_context.stroke();
_elemBox.expandByScalar( material.linewidth * 2 );
setDashAndGap( null, null );
}

@@ -663,42 +705,32 @@

if ( _enableLighting === true ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
_color1.copy( _ambientLight );
_color2.copy( _ambientLight );
_color3.copy( _ambientLight );
_color1.copy( _ambientLight );
_color2.copy( _ambientLight );
_color3.copy( _ambientLight );
calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 );
_color1.multiply( _diffuseColor ).add( _emissiveColor );
_color2.multiply( _diffuseColor ).add( _emissiveColor );
_color3.multiply( _diffuseColor ).add( _emissiveColor );
_color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
_color1.multiply( _diffuseColor ).add( _emissiveColor );
_color2.multiply( _diffuseColor ).add( _emissiveColor );
_color3.multiply( _diffuseColor ).add( _emissiveColor );
_color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 );
_image = getGradientTexture( _color1, _color2, _color3, _color4 );
_image = getGradientTexture( _color1, _color2, _color3, _color4 );
clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image );
} else {
} else {
_color.copy( _ambientLight );
_color.copy( _ambientLight );
calculateLight( element.centroidModel, element.normalModel, _color );
calculateLight( element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( _emissiveColor );
_color.multiply( _diffuseColor ).add( _emissiveColor );
material.wireframe === true
? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( _color );
}
} else {
material.wireframe === true
? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( material.color );
? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( _color );

@@ -848,51 +880,37 @@ }

if ( _enableLighting === true ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) {
_color1.copy( _ambientLight );
_color2.copy( _ambientLight );
_color3.copy( _ambientLight );
_color4.copy( _ambientLight );
_color1.copy( _ambientLight );
_color2.copy( _ambientLight );
_color3.copy( _ambientLight );
_color4.copy( _ambientLight );
calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 );
calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 );
calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 );
calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 );
calculateLight( element.v4.positionWorld, element.vertexNormalsModel[ 3 ], _color3 );
calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color4 );
_color1.multiply( _diffuseColor ).add( _emissiveColor );
_color2.multiply( _diffuseColor ).add( _emissiveColor );
_color3.multiply( _diffuseColor ).add( _emissiveColor );
_color4.multiply( _diffuseColor ).add( _emissiveColor );
_color1.multiply( _diffuseColor ).add( _emissiveColor );
_color2.multiply( _diffuseColor ).add( _emissiveColor );
_color3.multiply( _diffuseColor ).add( _emissiveColor );
_color4.multiply( _diffuseColor ).add( _emissiveColor );
_image = getGradientTexture( _color1, _color2, _color3, _color4 );
_image = getGradientTexture( _color1, _color2, _color3, _color4 );
// TODO: UVs are incorrect, v4->v3?
// TODO: UVs are incorrect, v4->v3?
drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y );
clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image );
drawTriangle( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y );
clipImage( _v1x, _v1y, _v2x, _v2y, _v4x, _v4y, 0, 0, 1, 0, 0, 1, _image );
drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y );
clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image );
drawTriangle( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y );
clipImage( _v5x, _v5y, _v3x, _v3y, _v6x, _v6y, 1, 0, 1, 1, 0, 1, _image );
} else {
} else {
_color.copy( _ambientLight );
_color.copy( _ambientLight );
calculateLight( element.centroidModel, element.normalModel, _color );
calculateLight( element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( _emissiveColor );
_color.multiply( _diffuseColor ).add( _emissiveColor );
drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
material.wireframe === true
? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( _color );
}
} else {
_color.addColors( _diffuseColor, _emissiveColor );
drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );

@@ -961,4 +979,2 @@

} else if ( material instanceof THREE.MeshDepthMaterial ) {

@@ -1194,3 +1210,3 @@

var x = v2.x - v1.x, y = v2.y - v1.y,
var x = v2.x - v1.x, y = v2.y - v1.y,
det = x * x + y * y, idet;

@@ -1197,0 +1213,0 @@

@@ -12,4 +12,5 @@ /**

this.vertexColors = [ new THREE.Color(), new THREE.Color() ];
this.material = null;
};

@@ -207,2 +207,3 @@

parameters.gammaOutput ? "#define GAMMA_OUTPUT" : "",
parameters.physicallyBasedShading ? "#define PHYSICALLY_BASED_SHADING" : "",

@@ -403,3 +404,3 @@ ( parameters.useFog && parameters.fog ) ? "#define USE_FOG" : "",

programs = newPrograms;
this.programs = newPrograms;

@@ -406,0 +407,0 @@ this.renderer.deleteProgram( program );

@@ -8,4 +8,2 @@ /**

THREE.EventDispatcher.call( this );
this.width = width;

@@ -39,35 +37,46 @@ this.height = height;

THREE.WebGLRenderTarget.prototype.clone = function() {
THREE.WebGLRenderTarget.prototype = {
var tmp = new THREE.WebGLRenderTarget( this.width, this.height );
constructor: THREE.WebGLRenderTarget,
tmp.wrapS = this.wrapS;
tmp.wrapT = this.wrapT;
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
tmp.magFilter = this.magFilter;
tmp.minFilter = this.minFilter;
clone: function () {
tmp.anisotropy = this.anisotropy;
var tmp = new THREE.WebGLRenderTarget( this.width, this.height );
tmp.offset.copy( this.offset );
tmp.repeat.copy( this.repeat );
tmp.wrapS = this.wrapS;
tmp.wrapT = this.wrapT;
tmp.format = this.format;
tmp.type = this.type;
tmp.magFilter = this.magFilter;
tmp.minFilter = this.minFilter;
tmp.depthBuffer = this.depthBuffer;
tmp.stencilBuffer = this.stencilBuffer;
tmp.anisotropy = this.anisotropy;
tmp.generateMipmaps = this.generateMipmaps;
tmp.offset.copy( this.offset );
tmp.repeat.copy( this.repeat );
tmp.shareDepthFrom = this.shareDepthFrom;
tmp.format = this.format;
tmp.type = this.type;
return tmp;
tmp.depthBuffer = this.depthBuffer;
tmp.stencilBuffer = this.stencilBuffer;
};
tmp.generateMipmaps = this.generateMipmaps;
THREE.WebGLRenderTarget.prototype.dispose = function () {
tmp.shareDepthFrom = this.shareDepthFrom;
this.dispatchEvent( { type: 'dispose' } );
return tmp;
},
dispose: function () {
this.dispatchEvent( { type: 'dispose' } );
}
};

@@ -12,2 +12,3 @@ /**

this.autoUpdate = true; // checked by the renderer
this.matrixAutoUpdate = false;

@@ -14,0 +15,0 @@

@@ -9,4 +9,2 @@ /**

THREE.EventDispatcher.call( this );
this.id = THREE.TextureIdCount ++;

@@ -49,2 +47,7 @@

addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
clone: function ( texture ) {

@@ -51,0 +54,0 @@

@@ -6,3 +6,3 @@ /**

var THREE = THREE || { REVISION: '56' };
var THREE = THREE || { REVISION: '58' };

@@ -9,0 +9,0 @@ self.console = self.console || {

@@ -14,12 +14,151 @@

window.performance.now = function () {
// check if we are in a Node.js environment
if( ( process !== undefined ) && ( process.hrtime !== undefined ) ) {
var time = process.hrtime();
return ( time[0] + time[1] / 1e9 ) * 1000;
window.performance.now = function () {
};
var time = process.hrtime();
return ( time[0] + time[1] / 1e9 ) * 1000;
};
}
// if not Node.js revert to using the Date class
else {
window.performance.now = function() {
return new Date().getTime();
};
}
}
var THREE=THREE||{REVISION:"56"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}},self.Int32Array=self.Int32Array||Array,self.Float32Array=self.Float32Array||Array,String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},THREE.extend=function(e,t){if(Object.keys)for(var i=Object.keys(t),r=0,o=i.length;o>r;r++){var n=i[r];Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}else{var a={}.hasOwnProperty;for(var n in t)a.call(t,n)&&(e[n]=t[n])}return e},function(){for(var e=0,t=["ms","moz","webkit","o"],i=0;t.length>i&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[t[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[i]+"CancelAnimationFrame"]||window[t[i]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(t){var i=Date.now(),r=Math.max(0,16-(i-e)),o=window.setTimeout(function(){t(i+r)},r);return e=i+r,o}),window.cancelAnimationFrame=window.cancelAnimationFrame||function(e){window.clearTimeout(e)}}(),THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.NoShading=0,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=function(){},THREE.CubeReflectionMapping=function(){},THREE.CubeRefractionMapping=function(){},THREE.SphericalReflectionMapping=function(){},THREE.SphericalRefractionMapping=function(){},THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.Color=function(e){return void 0!==e&&this.set(e),this},THREE.extend(THREE.Color.prototype,{r:1,g:1,b:1,set:function(e){switch(typeof e){case"number":this.setHex(e);break;case"string":this.setStyle(e)}},setHex:function(e){return e=Math.floor(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSV:function(e,t,i){return console.log("DEPRECATED: Color's .setHSV() will be removed. Use .setHSL( h, s, l ) instead."),this.setHSL(e,t*i/(1>(e=(2-t)*i)?e:2-e),e/2)},setHSL:function(e,t,i){if(0===t)this.r=this.g=this.b=i;else{var r=function(e,t,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?e+6*(t-e)*i:.5>i?t:2/3>i?e+6*(t-e)*(2/3-i):e},o=.5>=i?i*(1+t):i+t-i*t,n=2*i-o;this.r=r(n,o,e+1/3),this.g=r(n,o,e),this.b=r(n,o,e-1/3)}return this},setStyle:function(e){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(e)){var t=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(e)){var t=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){var t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){var t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}return/^(\w+)$/i.test(e)?(this.setHex(THREE.ColorKeywords[e]),this):void 0},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e){return this.r=e.r*e.r,this.g=e.g*e.g,this.b=e.b*e.b,this},copyLinearToGamma:function(e){return this.r=Math.sqrt(e.r),this.g=Math.sqrt(e.g),this.b=Math.sqrt(e.b),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(){var e={h:0,s:0,l:0};return function(){var t,i,r=this.r,o=this.g,n=this.b,a=Math.max(r,o,n),s=Math.min(r,o,n),h=(s+a)/2;if(s===a)t=0,i=0;else{var l=a-s;switch(i=.5>=h?l/(a+s):l/(2-a-s),a){case r:t=(o-n)/l+(n>o?6:0);break;case o:t=(n-r)/l+2;break;case n:t=(r-o)/l+4}t/=6}return e.h=t,e.s=i,e.l=h,e}}(),getStyle:function(){return"rgb("+(0|255*this.r)+","+(0|255*this.g)+","+(0|255*this.b)+")"},offsetHSL:function(e,t,i){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=i,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}),THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},THREE.Quaternion=function(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1},THREE.extend(THREE.Quaternion.prototype,{set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},setFromEuler:function(e,t){var i=Math.cos(e.x/2),r=Math.cos(e.y/2),o=Math.cos(e.z/2),n=Math.sin(e.x/2),a=Math.sin(e.y/2),s=Math.sin(e.z/2);return void 0===t||"XYZ"===t?(this.x=n*r*o+i*a*s,this.y=i*a*o-n*r*s,this.z=i*r*s+n*a*o,this.w=i*r*o-n*a*s):"YXZ"===t?(this.x=n*r*o+i*a*s,this.y=i*a*o-n*r*s,this.z=i*r*s-n*a*o,this.w=i*r*o+n*a*s):"ZXY"===t?(this.x=n*r*o-i*a*s,this.y=i*a*o+n*r*s,this.z=i*r*s+n*a*o,this.w=i*r*o-n*a*s):"ZYX"===t?(this.x=n*r*o-i*a*s,this.y=i*a*o+n*r*s,this.z=i*r*s-n*a*o,this.w=i*r*o+n*a*s):"YZX"===t?(this.x=n*r*o+i*a*s,this.y=i*a*o+n*r*s,this.z=i*r*s-n*a*o,this.w=i*r*o-n*a*s):"XZY"===t&&(this.x=n*r*o-i*a*s,this.y=i*a*o-n*r*s,this.z=i*r*s+n*a*o,this.w=i*r*o+n*a*s),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.w=Math.cos(i),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],o=i[4],n=i[8],a=i[1],s=i[5],h=i[9],l=i[2],c=i[6],u=i[10],p=r+s+u;return p>0?(t=.5/Math.sqrt(p+1),this.w=.25/t,this.x=(c-h)*t,this.y=(n-l)*t,this.z=(a-o)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this.w=(c-h)/t,this.x=.25*t,this.y=(o+a)/t,this.z=(n+l)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this.w=(n-l)/t,this.x=(o+a)/t,this.y=.25*t,this.z=(h+c)/t):(t=2*Math.sqrt(1+u-r-s),this.w=(a-o)/t,this.x=(n+l)/t,this.y=(h+c)/t,this.z=.25*t),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var e=this.length();return 0===e?(this.x=0,this.y=0,this.z=0,this.w=1):(e=1/e,this.x=this.x*e,this.y=this.y*e,this.z=this.z*e,this.w=this.w*e),this},multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var i=e.x,r=e.y,o=e.z,n=e.w,a=t.x,s=t.y,h=t.z,l=t.w;return this.x=i*l+n*a+r*h-o*s,this.y=r*l+n*s+o*a-i*h,this.z=o*l+n*h+i*s-r*a,this.w=n*l-i*a-r*s-o*h,this},multiplyVector3:function(e){return console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){var i=this.x,r=this.y,o=this.z,n=this.w,a=n*e.w+i*e.x+r*e.y+o*e.z;if(0>a?(this.w=-e.w,this.x=-e.x,this.y=-e.y,this.z=-e.z,a=-a):this.copy(e),a>=1)return this.w=n,this.x=i,this.y=r,this.z=o,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);if(.001>Math.abs(h))return this.w=.5*(n+this.w),this.x=.5*(i+this.x),this.y=.5*(r+this.y),this.z=.5*(o+this.z),this;var l=Math.sin((1-t)*s)/h,c=Math.sin(t*s)/h;return this.w=n*l+this.w*c,this.x=i*l+this.x*c,this.y=r*l+this.y*c,this.z=o*l+this.z*c,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}}),THREE.Quaternion.slerp=function(e,t,i,r){return i.copy(e).slerp(t,r)},THREE.Vector2=function(e,t){this.x=e||0,this.y=t||0},THREE.extend(THREE.Vector2.prototype,{set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScalar:function(e){return this.x+=e,this.y+=e,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divideScalar:function(e){return 0!==e?(this.x/=e,this.y/=e):this.set(0,0),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),this},clamp:function(e,t){return e.x>this.x?this.x=e.x:this.x>t.x&&(this.x=t.x),e.y>this.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}}),THREE.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},THREE.extend(THREE.Vector3.prototype,{set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[3]*i+o[6]*r,this.y=o[1]*t+o[4]*i+o[7]*r,this.z=o[2]*t+o[5]*i+o[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12],this.y=o[1]*t+o[5]*i+o[9]*r+o[13],this.z=o[2]*t+o[6]*i+o[10]*r+o[14],this},applyProjection:function(e){var t=this.x,i=this.y,r=this.z,o=e.elements,n=1/(o[3]*t+o[7]*i+o[11]*r+o[15]);return this.x=(o[0]*t+o[4]*i+o[8]*r+o[12])*n,this.y=(o[1]*t+o[5]*i+o[9]*r+o[13])*n,this.z=(o[2]*t+o[6]*i+o[10]*r+o[14])*n,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,o=e.x,n=e.y,a=e.z,s=e.w,h=s*t+n*r-a*i,l=s*i+a*t-o*r,c=s*r+o*i-n*t,u=-o*t-n*i-a*r;return this.x=h*s+u*-o+l*-a-c*-n,this.y=l*s+u*-n+c*-o-h*-a,this.z=c*s+u*-a+h*-n-l*-o,this},applyEuler:function(){var e=new THREE.Quaternion;return function(t,i){var r=e.setFromEuler(t,i);return this.applyQuaternion(r),this}}(),applyAxisAngle:function(){var e=new THREE.Quaternion;return function(t,i){var r=e.setFromAxisAngle(t,i);return this.applyQuaternion(r),this}}(),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r,this.y=o[1]*t+o[5]*i+o[9]*r,this.z=o[2]*t+o[6]*i+o[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return 0!==e?(this.x/=e,this.y/=e,this.z/=e):(this.x=0,this.y=0,this.z=0),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),this},clamp:function(e,t){return e.x>this.x?this.x=e.x:this.x>t.x&&(this.x=t.x),e.y>this.y?this.y=e.y:this.y>t.y&&(this.y=t.y),e.z>this.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},cross:function(e,t){if(void 0!==t)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,r=this.y,o=this.z;return this.x=r*e.z-o*e.y,this.y=o*e.x-i*e.z,this.z=i*e.y-r*e.x,this},crossVectors:function(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this},projectOnVector:function(){var e=new THREE.Vector3;return function(t){e.copy(t).normalize();var i=this.dot(e);return this.copy(e).multiplyScalar(i)}}(),projectOnPlane:function(){var e=new THREE.Vector3;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new THREE.Vector3;return function(t){return e.copy(this).projectOnVector(t).multiplyScalar(2),this.subVectors(e,this)}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(THREE.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},getPositionFromMatrix:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setEulerFromRotationMatrix:function(e,t){function i(e){return Math.min(Math.max(e,-1),1)}var r=e.elements,o=r[0],n=r[4],a=r[8],s=r[1],h=r[5],l=r[9],c=r[2],u=r[6],p=r[10];return void 0===t||"XYZ"===t?(this.y=Math.asin(i(a)),.99999>Math.abs(a)?(this.x=Math.atan2(-l,p),this.z=Math.atan2(-n,o)):(this.x=Math.atan2(u,h),this.z=0)):"YXZ"===t?(this.x=Math.asin(-i(l)),.99999>Math.abs(l)?(this.y=Math.atan2(a,p),this.z=Math.atan2(s,h)):(this.y=Math.atan2(-c,o),this.z=0)):"ZXY"===t?(this.x=Math.asin(i(u)),.99999>Math.abs(u)?(this.y=Math.atan2(-c,p),this.z=Math.atan2(-n,h)):(this.y=0,this.z=Math.atan2(s,o))):"ZYX"===t?(this.y=Math.asin(-i(c)),.99999>Math.abs(c)?(this.x=Math.atan2(u,p),this.z=Math.atan2(s,o)):(this.x=0,this.z=Math.atan2(-n,h))):"YZX"===t?(this.z=Math.asin(i(s)),.99999>Math.abs(s)?(this.x=Math.atan2(-l,h),this.y=Math.atan2(-c,o)):(this.x=0,this.y=Math.atan2(a,p))):"XZY"===t&&(this.z=Math.asin(-i(n)),.99999>Math.abs(n)?(this.x=Math.atan2(u,h),this.y=Math.atan2(a,o)):(this.x=Math.atan2(-l,p),this.y=0)),this},setEulerFromQuaternion:function(e,t){function i(e){return Math.min(Math.max(e,-1),1)}var r=e.x*e.x,o=e.y*e.y,n=e.z*e.z,a=e.w*e.w;return void 0===t||"XYZ"===t?(this.x=Math.atan2(2*(e.x*e.w-e.y*e.z),a-r-o+n),this.y=Math.asin(i(2*(e.x*e.z+e.y*e.w))),this.z=Math.atan2(2*(e.z*e.w-e.x*e.y),a+r-o-n)):"YXZ"===t?(this.x=Math.asin(i(2*(e.x*e.w-e.y*e.z))),this.y=Math.atan2(2*(e.x*e.z+e.y*e.w),a-r-o+n),this.z=Math.atan2(2*(e.x*e.y+e.z*e.w),a-r+o-n)):"ZXY"===t?(this.x=Math.asin(i(2*(e.x*e.w+e.y*e.z))),this.y=Math.atan2(2*(e.y*e.w-e.z*e.x),a-r-o+n),this.z=Math.atan2(2*(e.z*e.w-e.x*e.y),a-r+o-n)):"ZYX"===t?(this.x=Math.atan2(2*(e.x*e.w+e.z*e.y),a-r-o+n),this.y=Math.asin(i(2*(e.y*e.w-e.x*e.z))),this.z=Math.atan2(2*(e.x*e.y+e.z*e.w),a+r-o-n)):"YZX"===t?(this.x=Math.atan2(2*(e.x*e.w-e.z*e.y),a-r+o-n),this.y=Math.atan2(2*(e.y*e.w-e.x*e.z),a+r-o-n),this.z=Math.asin(i(2*(e.x*e.y+e.z*e.w)))):"XZY"===t&&(this.x=Math.atan2(2*(e.x*e.w+e.y*e.z),a-r+o-n),this.y=Math.atan2(2*(e.x*e.z+e.y*e.w),a+r-o-n),this.z=Math.asin(i(2*(e.z*e.w-e.x*e.y)))),this},getScaleFromMatrix:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),i=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),r=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=i,this.z=r,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}}),THREE.Vector4=function(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1},THREE.extend(THREE.Vector4.prototype,{set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,o=this.w,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r+n[12]*o,this.y=n[1]*t+n[5]*i+n[9]*r+n[13]*o,this.z=n[2]*t+n[6]*i+n[10]*r+n[14]*o,this.w=n[3]*t+n[7]*i+n[11]*r+n[15]*o,this},divideScalar:function(e){return 0!==e?(this.x/=e,this.y/=e,this.z/=e,this.w/=e):(this.x=0,this.y=0,this.z=0,this.w=1),this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,o,n=.01,a=.1,s=e.elements,h=s[0],l=s[4],c=s[8],u=s[1],p=s[5],E=s[9],f=s[2],m=s[6],d=s[10];if(n>Math.abs(l-u)&&n>Math.abs(c-f)&&n>Math.abs(E-m)){if(a>Math.abs(l+u)&&a>Math.abs(c+f)&&a>Math.abs(E+m)&&a>Math.abs(h+p+d-3))return this.set(1,0,0,0),this;t=Math.PI;var g=(h+1)/2,y=(p+1)/2,v=(d+1)/2,T=(l+u)/4,R=(c+f)/4,x=(E+m)/4;return g>y&&g>v?n>g?(i=0,r=.707106781,o=.707106781):(i=Math.sqrt(g),r=T/i,o=R/i):y>v?n>y?(i=.707106781,r=0,o=.707106781):(r=Math.sqrt(y),i=T/r,o=x/r):n>v?(i=.707106781,r=.707106781,o=0):(o=Math.sqrt(v),i=R/o,r=x/o),this.set(i,r,o,t),this}var H=Math.sqrt((m-E)*(m-E)+(c-f)*(c-f)+(u-l)*(u-l));return.001>Math.abs(H)&&(H=1),this.x=(m-E)/H,this.y=(c-f)/H,this.z=(u-l)/H,this.w=Math.acos((h+p+d-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},clamp:function(e,t){return e.x>this.x?this.x=e.x:this.x>t.x&&(this.x=t.x),e.y>this.y?this.y=e.y:this.y>t.y&&(this.y=t.y),e.z>this.z?this.z=e.z:this.z>t.z&&(this.z=t.z),e.w>this.w?this.w=e.w:this.w>t.w&&(this.w=t.w),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}}),THREE.Line3=function(e,t){this.start=void 0!==e?e:new THREE.Vector3,this.end=void 0!==t?t:new THREE.Vector3},THREE.extend(THREE.Line3.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new THREE.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new THREE.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new THREE.Vector3;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(i,r){e.subVectors(i,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),n=t.dot(e),a=n/o;return r&&(a=THREE.Math.clamp(a,0,1)),a}}(),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),o=i||new THREE.Vector3;return this.delta(o).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}}),THREE.Box2=function(e,t){this.min=void 0!==e?e:new THREE.Vector2(1/0,1/0),this.max=void 0!==t?t:new THREE.Vector2(-1/0,-1/0)},THREE.extend(THREE.Box2.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){if(e.length>0){var t=e[0];this.min.copy(t),this.max.copy(t);for(var i=1,r=e.length;r>i;i++)t=e[i],this.min.x>t.x?this.min.x=t.x:t.x>this.max.x&&(this.max.x=t.x),this.min.y>t.y?this.min.y=t.y:t.y>this.max.y&&(this.max.y=t.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var e=new THREE.Vector2;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},empty:function(){return this.min.x>this.max.x||this.min.y>this.max.y},center:function(e){var t=e||new THREE.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new THREE.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return this.min.x>e.x||e.x>this.max.x||this.min.y>e.y||e.y>this.max.y?!1:!0},containsBox:function(e){return e.min.x>=this.min.x&&this.max.x>=e.max.x&&e.min.y>=this.min.y&&this.max.y>=e.max.y?!0:!1},getParameter:function(e){return new THREE.Vector2((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return this.min.x>e.max.x||e.min.x>this.max.x||this.min.y>e.max.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var i=t||new THREE.Vector2;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector2;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}}),THREE.Box3=function(e,t){this.min=void 0!==e?e:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new THREE.Vector3(-1/0,-1/0,-1/0)},THREE.extend(THREE.Box3.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){if(e.length>0){var t=e[0];this.min.copy(t),this.max.copy(t);for(var i=1,r=e.length;r>i;i++)t=e[i],this.min.x>t.x?this.min.x=t.x:t.x>this.max.x&&(this.max.x=t.x),this.min.y>t.y?this.min.y=t.y:t.y>this.max.y&&(this.max.y=t.y),this.min.z>t.z?this.min.z=t.z:t.z>this.max.z&&(this.max.z=t.z)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var e=new THREE.Vector3;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},empty:function(){return this.min.x>this.max.x||this.min.y>this.max.y||this.min.z>this.max.z},center:function(e){var t=e||new THREE.Vector3;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new THREE.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this
},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return this.min.x>e.x||e.x>this.max.x||this.min.y>e.y||e.y>this.max.y||this.min.z>e.z||e.z>this.max.z?!1:!0},containsBox:function(e){return e.min.x>=this.min.x&&this.max.x>=e.max.x&&e.min.y>=this.min.y&&this.max.y>=e.max.y&&e.min.z>=this.min.z&&this.max.z>=e.max.z?!0:!1},getParameter:function(e){return new THREE.Vector3((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return this.min.x>e.max.x||e.min.x>this.max.x||this.min.y>e.max.y||e.min.y>this.max.y||this.min.z>e.max.z||e.min.z>this.max.z?!1:!0},clampPoint:function(e,t){var i=t||new THREE.Vector3;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var e=new THREE.Vector3;return function(t){var i=t||new THREE.Sphere;return i.center=this.center(),i.radius=.5*this.size(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}}),THREE.Matrix3=function(e,t,i,r,o,n,a,s,h){this.elements=new Float32Array(9),this.set(void 0!==e?e:1,t||0,i||0,r||0,void 0!==o?o:1,n||0,a||0,s||0,void 0!==h?h:1)},THREE.extend(THREE.Matrix3.prototype,{set:function(e,t,i,r,o,n,a,s,h){var l=this.elements;return l[0]=e,l[3]=t,l[6]=i,l[1]=r,l[4]=o,l[7]=n,l[2]=a,l[5]=s,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){var e=new THREE.Vector3;return function(t){for(var i=0,r=t.length;r>i;i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyMatrix3(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=e.z;return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],r=e[2],o=e[3],n=e[4],a=e[5],s=e[6],h=e[7],l=e[8];return t*n*l-t*a*h-i*o*l+i*a*s+r*o*h-r*n*s},getInverse:function(e,t){var i=e.elements,r=this.elements;r[0]=i[10]*i[5]-i[6]*i[9],r[1]=-i[10]*i[1]+i[2]*i[9],r[2]=i[6]*i[1]-i[2]*i[5],r[3]=-i[10]*i[4]+i[6]*i[8],r[4]=i[10]*i[0]-i[2]*i[8],r[5]=-i[6]*i[0]+i[2]*i[4],r[6]=i[9]*i[4]-i[5]*i[8],r[7]=-i[9]*i[0]+i[1]*i[8],r[8]=i[5]*i[0]-i[1]*i[4];var o=i[0]*r[0]+i[1]*r[3]+i[2]*r[6];if(0===o){var n="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw Error(n);return console.warn(n),this.identity(),this}return this.multiplyScalar(1/o),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},clone:function(){var e=this.elements;return new THREE.Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])}}),THREE.Matrix4=function(e,t,i,r,o,n,a,s,h,l,c,u,p,E,f,m){var d=this.elements=new Float32Array(16);d[0]=void 0!==e?e:1,d[4]=t||0,d[8]=i||0,d[12]=r||0,d[1]=o||0,d[5]=void 0!==n?n:1,d[9]=a||0,d[13]=s||0,d[2]=h||0,d[6]=l||0,d[10]=void 0!==c?c:1,d[14]=u||0,d[3]=p||0,d[7]=E||0,d[11]=f||0,d[15]=void 0!==m?m:1},THREE.extend(THREE.Matrix4.prototype,{set:function(e,t,i,r,o,n,a,s,h,l,c,u,p,E,f,m){var d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=o,d[5]=n,d[9]=a,d[13]=s,d[2]=h,d[6]=l,d[10]=c,d[14]=u,d[3]=p,d[7]=E,d[11]=f,d[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this},setRotationFromEuler:function(e,t){var i=this.elements,r=e.x,o=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),h=Math.cos(o),l=Math.sin(o),c=Math.cos(n),u=Math.sin(n);if(void 0===t||"XYZ"===t){var p=a*c,E=a*u,f=s*c,m=s*u;i[0]=h*c,i[4]=-h*u,i[8]=l,i[1]=E+f*l,i[5]=p-m*l,i[9]=-s*h,i[2]=m-p*l,i[6]=f+E*l,i[10]=a*h}else if("YXZ"===t){var d=h*c,g=h*u,y=l*c,v=l*u;i[0]=d+v*s,i[4]=y*s-g,i[8]=a*l,i[1]=a*u,i[5]=a*c,i[9]=-s,i[2]=g*s-y,i[6]=v+d*s,i[10]=a*h}else if("ZXY"===t){var d=h*c,g=h*u,y=l*c,v=l*u;i[0]=d-v*s,i[4]=-a*u,i[8]=y+g*s,i[1]=g+y*s,i[5]=a*c,i[9]=v-d*s,i[2]=-a*l,i[6]=s,i[10]=a*h}else if("ZYX"===t){var p=a*c,E=a*u,f=s*c,m=s*u;i[0]=h*c,i[4]=f*l-E,i[8]=p*l+m,i[1]=h*u,i[5]=m*l+p,i[9]=E*l-f,i[2]=-l,i[6]=s*h,i[10]=a*h}else if("YZX"===t){var T=a*h,R=a*l,x=s*h,H=s*l;i[0]=h*c,i[4]=H-T*u,i[8]=x*u+R,i[1]=u,i[5]=a*c,i[9]=-s*c,i[2]=-l*c,i[6]=R*u+x,i[10]=T-H*u}else if("XZY"===t){var T=a*h,R=a*l,x=s*h,H=s*l;i[0]=h*c,i[4]=-u,i[8]=l*c,i[1]=T*u+H,i[5]=a*c,i[9]=R*u-x,i[2]=x*u-R,i[6]=s*c,i[10]=H*u+T}return this},setRotationFromQuaternion:function(e){var t=this.elements,i=e.x,r=e.y,o=e.z,n=e.w,a=i+i,s=r+r,h=o+o,l=i*a,c=i*s,u=i*h,p=r*s,E=r*h,f=o*h,m=n*a,d=n*s,g=n*h;return t[0]=1-(p+f),t[4]=c-g,t[8]=u+d,t[1]=c+g,t[5]=1-(l+f),t[9]=E-m,t[2]=u-d,t[6]=E+m,t[10]=1-(l+p),this},lookAt:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3;return function(r,o,n){var a=this.elements;return i.subVectors(r,o).normalize(),0===i.length()&&(i.z=1),e.crossVectors(n,i).normalize(),0===e.length()&&(i.x+=1e-4,e.crossVectors(n,i).normalize()),t.crossVectors(i,e),a[0]=e.x,a[4]=t.x,a[8]=i.x,a[1]=e.y,a[5]=t.y,a[9]=i.y,a[2]=e.z,a[6]=t.z,a[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,o=this.elements,n=i[0],a=i[4],s=i[8],h=i[12],l=i[1],c=i[5],u=i[9],p=i[13],E=i[2],f=i[6],m=i[10],d=i[14],g=i[3],y=i[7],v=i[11],T=i[15],R=r[0],x=r[4],H=r[8],w=r[12],b=r[1],M=r[5],S=r[9],_=r[13],C=r[2],A=r[6],z=r[10],P=r[14],L=r[3],F=r[7],D=r[11],V=r[15];return o[0]=n*R+a*b+s*C+h*L,o[4]=n*x+a*M+s*A+h*F,o[8]=n*H+a*S+s*z+h*D,o[12]=n*w+a*_+s*P+h*V,o[1]=l*R+c*b+u*C+p*L,o[5]=l*x+c*M+u*A+p*F,o[9]=l*H+c*S+u*z+p*D,o[13]=l*w+c*_+u*P+p*V,o[2]=E*R+f*b+m*C+d*L,o[6]=E*x+f*M+m*A+d*F,o[10]=E*H+f*S+m*z+d*D,o[14]=E*w+f*_+m*P+d*V,o[3]=g*R+y*b+v*C+T*L,o[7]=g*x+y*M+v*A+T*F,o[11]=g*H+y*S+v*z+T*D,o[15]=g*w+y*_+v*P+T*V,this},multiplyToArray:function(e,t,i){var r=this.elements;return this.multiplyMatrices(e,t),i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){var e=new THREE.Vector3;return function(t){for(var i=0,r=t.length;r>i;i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyProjection(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=e.z;return t}}(),rotateAxis:function(e){var t=this.elements,i=e.x,r=e.y,o=e.z;return e.x=i*t[0]+r*t[4]+o*t[8],e.y=i*t[1]+r*t[5]+o*t[9],e.z=i*t[2]+r*t[6]+o*t[10],e.normalize(),e},crossVector:function(e){var t=this.elements,i=new THREE.Vector4;return i.x=t[0]*e.x+t[4]*e.y+t[8]*e.z+t[12]*e.w,i.y=t[1]*e.x+t[5]*e.y+t[9]*e.z+t[13]*e.w,i.z=t[2]*e.x+t[6]*e.y+t[10]*e.z+t[14]*e.w,i.w=e.w?t[3]*e.x+t[7]*e.y+t[11]*e.z+t[15]*e.w:1,i},determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],o=e[12],n=e[1],a=e[5],s=e[9],h=e[13],l=e[2],c=e[6],u=e[10],p=e[14],E=e[3],f=e[7],m=e[11],d=e[15];return E*(+o*s*c-r*h*c-o*a*u+i*h*u+r*a*p-i*s*p)+f*(+t*s*p-t*h*u+o*n*u-r*n*p+r*h*l-o*s*l)+m*(+t*h*c-t*a*p-o*n*c+i*n*p+o*a*l-i*h*l)+d*(-r*a*l-t*s*c+t*a*u+r*n*c-i*n*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},flattenToArrayOffset:function(e,t){var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e},getPosition:function(){var e=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,r=e.elements,o=r[0],n=r[4],a=r[8],s=r[12],h=r[1],l=r[5],c=r[9],u=r[13],p=r[2],E=r[6],f=r[10],m=r[14],d=r[3],g=r[7],y=r[11],v=r[15];i[0]=c*m*g-u*f*g+u*E*y-l*m*y-c*E*v+l*f*v,i[4]=s*f*g-a*m*g-s*E*y+n*m*y+a*E*v-n*f*v,i[8]=a*u*g-s*c*g+s*l*y-n*u*y-a*l*v+n*c*v,i[12]=s*c*E-a*u*E-s*l*f+n*u*f+a*l*m-n*c*m,i[1]=u*f*d-c*m*d-u*p*y+h*m*y+c*p*v-h*f*v,i[5]=a*m*d-s*f*d+s*p*y-o*m*y-a*p*v+o*f*v,i[9]=s*c*d-a*u*d-s*h*y+o*u*y+a*h*v-o*c*v,i[13]=a*u*p-s*c*p+s*h*f-o*u*f-a*h*m+o*c*m,i[2]=l*m*d-u*E*d+u*p*g-h*m*g-l*p*v+h*E*v,i[6]=s*E*d-n*m*d-s*p*g+o*m*g+n*p*v-o*E*v,i[10]=n*u*d-s*l*d+s*h*g-o*u*g-n*h*v+o*l*v,i[14]=s*l*p-n*u*p-s*h*E+o*u*E+n*h*m-o*l*m,i[3]=c*E*d-l*f*d-c*p*g+h*f*g+l*p*y-h*E*y,i[7]=n*f*d-a*E*d+a*p*g-o*f*g-n*p*y+o*E*y,i[11]=a*l*d-n*c*d-a*h*g+o*c*g+n*h*y-o*l*y,i[15]=n*c*p-a*l*p+a*h*E-o*c*E-n*h*f+o*l*f;var T=r[0]*i[0]+r[1]*i[4]+r[2]*i[8]+r[3]*i[12];if(0==T){var R="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw Error(R);return console.warn(R),this.identity(),this}return this.multiplyScalar(1/T),this},compose:function(){var e=new THREE.Matrix4,t=new THREE.Matrix4;return function(i,r,o){var n=this.elements;return e.identity(),e.setRotationFromQuaternion(r),t.makeScale(o.x,o.y,o.z),this.multiplyMatrices(e,t),n[12]=i.x,n[13]=i.y,n[14]=i.z,this}}(),decompose:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3,r=new THREE.Matrix4;return function(o,n,a){var s=this.elements;return e.set(s[0],s[1],s[2]),t.set(s[4],s[5],s[6]),i.set(s[8],s[9],s[10]),o=o instanceof THREE.Vector3?o:new THREE.Vector3,n=n instanceof THREE.Quaternion?n:new THREE.Quaternion,a=a instanceof THREE.Vector3?a:new THREE.Vector3,a.x=e.length(),a.y=t.length(),a.z=i.length(),o.x=s[12],o.y=s[13],o.z=s[14],r.copy(this),r.elements[0]/=a.x,r.elements[1]/=a.x,r.elements[2]/=a.x,r.elements[4]/=a.y,r.elements[5]/=a.y,r.elements[6]/=a.y,r.elements[8]/=a.z,r.elements[9]/=a.z,r.elements[10]/=a.z,n.setFromRotationMatrix(r),[o,n,a]}}(),extractPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractRotation:function(){var e=new THREE.Vector3;return function(t){var i=this.elements,r=t.elements,o=1/e.set(r[0],r[1],r[2]).length(),n=1/e.set(r[4],r[5],r[6]).length(),a=1/e.set(r[8],r[9],r[10]).length();return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[4]=r[4]*n,i[5]=r[5]*n,i[6]=r[6]*n,i[8]=r[8]*a,i[9]=r[9]*a,i[10]=r[10]*a,this}}(),translate:function(e){var t=this.elements,i=e.x,r=e.y,o=e.z;return t[12]=t[0]*i+t[4]*r+t[8]*o+t[12],t[13]=t[1]*i+t[5]*r+t[9]*o+t[13],t[14]=t[2]*i+t[6]*r+t[10]*o+t[14],t[15]=t[3]*i+t[7]*r+t[11]*o+t[15],this},rotateX:function(e){var t=this.elements,i=t[4],r=t[5],o=t[6],n=t[7],a=t[8],s=t[9],h=t[10],l=t[11],c=Math.cos(e),u=Math.sin(e);return t[4]=c*i+u*a,t[5]=c*r+u*s,t[6]=c*o+u*h,t[7]=c*n+u*l,t[8]=c*a-u*i,t[9]=c*s-u*r,t[10]=c*h-u*o,t[11]=c*l-u*n,this},rotateY:function(e){var t=this.elements,i=t[0],r=t[1],o=t[2],n=t[3],a=t[8],s=t[9],h=t[10],l=t[11],c=Math.cos(e),u=Math.sin(e);return t[0]=c*i-u*a,t[1]=c*r-u*s,t[2]=c*o-u*h,t[3]=c*n-u*l,t[8]=c*a+u*i,t[9]=c*s+u*r,t[10]=c*h+u*o,t[11]=c*l+u*n,this},rotateZ:function(e){var t=this.elements,i=t[0],r=t[1],o=t[2],n=t[3],a=t[4],s=t[5],h=t[6],l=t[7],c=Math.cos(e),u=Math.sin(e);return t[0]=c*i+u*a,t[1]=c*r+u*s,t[2]=c*o+u*h,t[3]=c*n+u*l,t[4]=c*a-u*i,t[5]=c*s-u*r,t[6]=c*h-u*o,t[7]=c*l-u*n,this},rotateByAxis:function(e,t){var i=this.elements;if(1===e.x&&0===e.y&&0===e.z)return this.rotateX(t);if(0===e.x&&1===e.y&&0===e.z)return this.rotateY(t);if(0===e.x&&0===e.y&&1===e.z)return this.rotateZ(t);var r=e.x,o=e.y,n=e.z,a=Math.sqrt(r*r+o*o+n*n);r/=a,o/=a,n/=a;var s=r*r,h=o*o,l=n*n,c=Math.cos(t),u=Math.sin(t),p=1-c,E=r*o*p,f=r*n*p,m=o*n*p,d=r*u,g=o*u,y=n*u,v=s+(1-s)*c,T=E+y,R=f-g,x=E-y,H=h+(1-h)*c,w=m+d,b=f+g,M=m-d,S=l+(1-l)*c,_=i[0],C=i[1],A=i[2],z=i[3],P=i[4],L=i[5],F=i[6],D=i[7],V=i[8],U=i[9],B=i[10],N=i[11];return i[0]=v*_+T*P+R*V,i[1]=v*C+T*L+R*U,i[2]=v*A+T*F+R*B,i[3]=v*z+T*D+R*N,i[4]=x*_+H*P+w*V,i[5]=x*C+H*L+w*U,i[6]=x*A+H*F+w*B,i[7]=x*z+H*D+w*N,i[8]=b*_+M*P+S*V,i[9]=b*C+M*L+S*U,i[10]=b*A+M*F+S*B,i[11]=b*z+M*D+S*N,this},scale:function(e){var t=this.elements,i=e.x,r=e.y,o=e.z;return t[0]*=i,t[4]*=r,t[8]*=o,t[1]*=i,t[5]*=r,t[9]*=o,t[2]*=i,t[6]*=r,t[10]*=o,t[3]*=i,t[7]*=r,t[11]*=o,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(i,r)))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),o=1-i,n=e.x,a=e.y,s=e.z,h=o*n,l=o*a;return this.set(h*n+i,h*a-r*s,h*s+r*a,0,h*a+r*s,l*a+i,l*s-r*n,0,h*s-r*a,l*s+r*n,o*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeFrustum:function(e,t,i,r,o,n){var a=this.elements,s=2*o/(t-e),h=2*o/(r-i),l=(t+e)/(t-e),c=(r+i)/(r-i),u=-(n+o)/(n-o),p=-2*n*o/(n-o);return a[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=h,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,i,r){var o=i*Math.tan(THREE.Math.degToRad(.5*e)),n=-o,a=n*t,s=o*t;return this.makeFrustum(a,s,n,o,i,r)},makeOrthographic:function(e,t,i,r,o,n){var a=this.elements,s=t-e,h=i-r,l=n-o,c=(t+e)/s,u=(i+r)/h,p=(n+o)/l;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2/l,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},clone:function(){var e=this.elements;return new THREE.Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])}}),THREE.Ray=function(e,t){this.origin=void 0!==e?e:new THREE.Vector3,this.direction=void 0!==t?t:new THREE.Vector3},THREE.extend(THREE.Ray.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var i=t||new THREE.Vector3;return i.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new THREE.Vector3;i.subVectors(e,this.origin);var r=i.dot(this.direction);return i.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceTo(t)}}(),isIntersectionSphere:function(e){return e.radius>=this.distanceToPoint(e.center)},isIntersectionPlane:function(e){var t=e.normal.dot(this.direction);return 0!=t?!0:0==e.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:void 0;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return void 0===i?void 0:this.at(i,t)},applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}}),THREE.Frustum=function(e,t,i,r,o,n){this.planes=[void 0!==e?e:new THREE.Plane,void 0!==t?t:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==o?o:new THREE.Plane,void 0!==n?n:new THREE.Plane]},THREE.extend(THREE.Frustum.prototype,{set:function(e,t,i,r,o,n){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(o),a[5].copy(n),this},copy:function(e){for(var t=this.planes,i=0;6>i;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],o=i[1],n=i[2],a=i[3],s=i[4],h=i[5],l=i[6],c=i[7],u=i[8],p=i[9],E=i[10],f=i[11],m=i[12],d=i[13],g=i[14],y=i[15];return t[0].setComponents(a-r,c-s,f-u,y-m).normalize(),t[1].setComponents(a+r,c+s,f+u,y+m).normalize(),t[2].setComponents(a+o,c+h,f+p,y+d).normalize(),t[3].setComponents(a-o,c-h,f-p,y-d).normalize(),t[4].setComponents(a-n,c-l,f-E,y-g).normalize(),t[5].setComponents(a+n,c+l,f+E,y+g).normalize(),this},intersectsObject:function(){var e=new THREE.Vector3;return function(t){var i=t.matrixWorld,r=this.planes,o=-t.geometry.boundingSphere.radius*i.getMaxScaleOnAxis();e.getPositionFromMatrix(i);for(var n=0;6>n;n++){var a=r[n].distanceToPoint(e);if(o>a)return!1}return!0}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,o=0;6>o;o++){var n=t[o].distanceToPoint(i);if(r>n)return!1}return!0},containsPoint:function(e){for(var t=this.planes,i=0;6>i;i++)if(0>t[i].distanceToPoint(e))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}}),THREE.Plane=function(e,t){this.normal=void 0!==e?e:new THREE.Vector3(1,0,0),this.constant=void 0!==t?t:0},THREE.extend(THREE.Plane.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(i,r,o){var n=e.subVectors(o,r).cross(t.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(n,i),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e),r=t||new THREE.Vector3;return r.copy(this.normal).multiplyScalar(i)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return 0>t&&i>0||0>i&&t>0},intersectLine:function(){var e=new THREE.Vector3;return function(t,i){var r=i||new THREE.Vector3,o=t.delta(e),n=this.normal.dot(o);if(0==n)return 0==this.distanceToPoint(t.start)?r.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/n;return 0>a||a>1?void 0:r.copy(o).multiplyScalar(a).add(t.start)}}(),coplanarPoint:function(e){var t=e||new THREE.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(i,r){r=r||(new THREE.Matrix3).getInverse(i).transpose();var o=e.copy(this.normal).applyMatrix3(r),n=this.coplanarPoint(t);return n.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,n),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}}),THREE.Sphere=function(e,t){this.center=void 0!==e?e:new THREE.Vector3,this.radius=void 0!==t?t:0},THREE.extend(THREE.Sphere.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromCenterAndPoints:function(e,t){for(var i=0,r=0,o=t.length;o>r;r++){var n=e.distanceToSquared(t[r]);i=Math.max(i,n)}return this.center=e,this.radius=Math.sqrt(i),this},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(e){return this.radius*this.radius>=e.distanceToSquared(this.center)},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return t*t>=e.center.distanceToSquared(this.center)},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),r=t||new THREE.Vector3;return r.copy(e),i>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new THREE.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}}),THREE.Math={clamp:function(e,t,i){return t>e?t:e>i?i:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,i,r,o){return r+(e-t)*(o-r)/(i-t)},smoothstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))},smootherstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},sign:function(e){return 0>e?-1:e>0?1:0},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}()},THREE.Spline=function(e){function t(e,t,i,r,o,n,a){var s=.5*(i-e),h=.5*(r-t);return(2*(t-i)+s+h)*a+(-3*(t-i)-2*s-h)*n+s*o+t}this.points=e;var i,r,o,n,a,s,h,l,c,u=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;e.length>t;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return i=(this.points.length-1)*e,r=Math.floor(i),o=i-r,u[0]=0===r?r:r-1,u[1]=r,u[2]=r>this.points.length-2?this.points.length-1:r+1,u[3]=r>this.points.length-3?this.points.length-1:r+2,s=this.points[u[0]],h=this.points[u[1]],l=this.points[u[2]],c=this.points[u[3]],n=o*o,a=o*n,p.x=t(s.x,h.x,l.x,c.x,o,n,a),p.y=t(s.y,h.y,l.y,c.y,o,n,a),p.z=t(s.z,h.z,l.z,c.z,o,n,a),p},this.getControlPointsArray=function(){var e,t,i=this.points.length,r=[];for(e=0;i>e;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,i,r,o,n=0,a=0,s=0,h=new THREE.Vector3,l=new THREE.Vector3,c=[],u=0;for(c[0]=0,e||(e=100),r=this.points.length*e,h.copy(this.points[0]),t=1;r>t;t++)i=t/r,o=this.getPoint(i),l.copy(o),u+=l.distanceTo(h),h.copy(o),n=(this.points.length-1)*i,a=Math.floor(n),a!=s&&(c[a]=u,s=a);return c[c.length]=u,{chunks:c,total:u}},this.reparametrizeByArcLength=function(e){var t,i,r,o,n,a,s,h,l=[],c=new THREE.Vector3,u=this.getLength();for(l.push(c.copy(this.points[0]).clone()),t=1;this.points.length>t;t++){for(a=u.chunks[t]-u.chunks[t-1],s=Math.ceil(e*a/u.total),o=(t-1)/(this.points.length-1),n=t/(this.points.length-1),i=1;s-1>i;i++)r=o+i*(1/s)*(n-o),h=this.getPoint(r),l.push(c.copy(h).clone());l.push(c.copy(this.points[t]).clone())}this.points=l}},THREE.Triangle=function(e,t,i){this.a=void 0!==e?e:new THREE.Vector3,this.b=void 0!==t?t:new THREE.Vector3,this.c=void 0!==i?i:new THREE.Vector3},THREE.Triangle.normal=function(){var e=new THREE.Vector3;return function(t,i,r,o){var n=o||new THREE.Vector3;n.subVectors(r,i),e.subVectors(t,i),n.cross(e);var a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}}(),THREE.Triangle.barycoordFromPoint=function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3;return function(r,o,n,a,s){e.subVectors(a,o),t.subVectors(n,o),i.subVectors(r,o);var h=e.dot(e),l=e.dot(t),c=e.dot(i),u=t.dot(t),p=t.dot(i),E=h*u-l*l,f=s||new THREE.Vector3;if(0==E)return f.set(-2,-1,-1);var m=1/E,d=(u*c-l*p)*m,g=(h*p-l*c)*m;return f.set(1-d-g,g,d)}}(),THREE.Triangle.containsPoint=function(){var e=new THREE.Vector3;return function(t,i,r,o){var n=THREE.Triangle.barycoordFromPoint(t,i,r,o,e);return n.x>=0&&n.y>=0&&1>=n.x+n.y}}(),THREE.extend(THREE.Triangle.prototype,{constructor:THREE.Triangle,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new THREE.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return THREE.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new THREE.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return THREE.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return THREE.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});
// three.js - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{REVISION:"58"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var g=c[d];Object.defineProperty(a,g,Object.getOwnPropertyDescriptor(b,g))}else for(g in c={}.hasOwnProperty,b)c.call(b,g)&&(a[g]=b[g]);return a};
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),g=Math.max(0,16-(c-a)),f=window.setTimeout(function(){b(c+g)},g);a=c+g;return f});window.cancelAnimationFrame=window.cancelAnimationFrame||
function(a){window.clearTimeout(a)}})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;
THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;
THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;
THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;
THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*
c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},b=0.5>=c?c*(1+b):c+b-c*b,c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),this.r=Math.min(100,
parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g=a.g;this.b=
a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*
this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(){var a={h:0,s:0,l:0};return function(){var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),g=Math.min(b,c,d),f,h=(g+e)/2;if(g===e)g=f=0;else{var i=e-g,g=0.5>=h?i/(e+g):i/(2-e-g);switch(e){case b:f=(c-d)/i+(c<d?6:0);break;case c:f=(d-b)/i+2;break;case d:f=(b-c)/i+4}f/=6}a.h=f;a.s=g;a.l=h;return a}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,
b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;
this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,
darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,
grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,
lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,
palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,
tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),g=Math.sin(a.x/2),f=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=g*d*e+c*f*h,this.y=c*f*e-g*d*h,this.z=c*d*h+g*f*e,this.w=c*d*e-g*f*h):"YXZ"===b?(this.x=g*d*e+c*f*h,this.y=c*f*e-g*d*h,this.z=c*d*
h-g*f*e,this.w=c*d*e+g*f*h):"ZXY"===b?(this.x=g*d*e-c*f*h,this.y=c*f*e+g*d*h,this.z=c*d*h+g*f*e,this.w=c*d*e-g*f*h):"ZYX"===b?(this.x=g*d*e-c*f*h,this.y=c*f*e+g*d*h,this.z=c*d*h-g*f*e,this.w=c*d*e+g*f*h):"YZX"===b?(this.x=g*d*e+c*f*h,this.y=c*f*e+g*d*h,this.z=c*d*h-g*f*e,this.w=c*d*e-g*f*h):"XZY"===b&&(this.x=g*d*e-c*f*h,this.y=c*f*e-g*d*h,this.z=c*d*h+g*f*e,this.w=c*d*e+g*f*h);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],g=b[5],f=b[9],h=b[2],i=b[6],b=b[10],j=c+g+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-f)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>g&&c>b?(c=2*Math.sqrt(1+c-g-b),this.w=(i-f)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):g>b?(c=2*Math.sqrt(1+g-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(f+i)/c):(c=2*Math.sqrt(1+b-c-g),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(f+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,g=a.w,f=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+g*f+d*i-e*h;this.y=d*j+g*h+e*f-c*i;this.z=e*j+g*i+c*h-d*f;this.w=g*j-c*f-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
g=this.w,f=g*a.w+c*a.x+d*a.y+e*a.z;0>f?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,f=-f):this.copy(a);if(1<=f)return this.w=g,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(0.0010>Math.abs(i))return this.w=0.5*(g+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;f=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=g*f+this.w*h;this.x=c*f+this.x*h;this.y=d*f+this.y*h;this.z=e*f+this.z*h;return this},equals:function(a){return a.x===this.x&&a.y===
this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,
b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=
a.y;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a):this.set(0,0);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},
negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/
b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a){this.x=a[0];this.y=a[1];return this},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+
a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,g=a.y,f=a.z,a=a.w,h=a*b+g*d-f*c,i=a*c+f*b-e*d,j=a*d+e*c-g*b,b=-e*b-g*c-f*d;this.x=h*a+b*-e+i*-f-j*-g;this.y=i*a+b*-g+j*-e-h*-f;this.z=j*a+b*-f+h*-g-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=
a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=
this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=
a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],g=d[4],f=d[8],h=d[1],i=d[5],j=d[9],k=d[2],l=d[6],d=d[10];void 0===b||"XYZ"===
b?(this.y=Math.asin(c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-g,e)):(this.x=Math.atan2(l,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(f,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-k,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(l)),0.99999>Math.abs(l)?(this.y=Math.atan2(-k,d),this.z=Math.atan2(-g,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(k)),0.99999>Math.abs(k)?(this.x=Math.atan2(l,d),this.z=Math.atan2(h,
e)):(this.x=0,this.z=Math.atan2(-g,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-k,e)):(this.x=0,this.y=Math.atan2(f,d))):"XZY"===b&&(this.z=Math.asin(-c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(l,i),this.y=Math.atan2(f,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,g=a.z*a.z,f=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*
(a.x*a.w-a.y*a.z),f-d-e+g),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),f+d-e-g)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),f-d-e+g),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),f-d+e-g)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),f-d-e+g),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),f-d+e-g)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),f-d-e+g),this.y=Math.asin(c(2*(a.y*a.w-a.x*
a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),f+d-e-g)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),f-d+e-g),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),f+d-e-g),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),f-d+e-g),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),f+d-e-g),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=
this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];return this},toArray:function(){return[this.x,
this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};
THREE.extend(THREE.Vector3.prototype,{applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),projectOnVector:function(){var a=new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;
return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}()});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;
case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},
addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},
applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=
a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var g=a[8],f=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-f)&&0.01>Math.abs(g-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+f)&&0.1>Math.abs(g+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+f)/4;g=(g+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=g/b):h>j?0.01>h?(b=0.707106781,
c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=g/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(g-c)*(g-c)+(f-d)*(f-d));0.0010>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(g-c)/a;this.z=(f-d)/a;this.w=Math.acos((e+h+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<
a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*
this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&
a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,
b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);
this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)};
THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(0.5);
this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(0.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);
this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a){return new THREE.Vector2((a.x-this.min.x)/(this.max.x-this.min.x),
(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);
return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};
THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y),b.z<this.min.z?this.min.z=b.z:b.z>this.max.z&&(this.max.z=b.z)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector3;
return function(b,c){var d=a.copy(c).multiplyScalar(0.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(0.5)},
size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=
this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a){return new THREE.Vector3((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,
this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,
this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,g,f,h,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,g||0,f||0,h||0,void 0!==i?i:1)};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,g,f,h,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=g;j[2]=f;j[5]=h;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],g=a[4],f=a[5],h=a[6],i=a[7],a=a[8];return b*g*a-b*f*i-c*e*a+c*f*h+d*e*i-d*g*h},getInverse:function(a,
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,j,k,l,m,p,r,q){var n=this.elements=new Float32Array(16);n[0]=void 0!==a?a:1;n[4]=b||0;n[8]=c||0;n[12]=d||0;n[1]=e||0;n[5]=void 0!==g?g:1;n[9]=f||0;n[13]=h||0;n[2]=i||0;n[6]=j||0;n[10]=void 0!==k?k:1;n[14]=l||0;n[3]=m||0;n[7]=p||0;n[11]=r||0;n[15]=void 0!==q?q:1};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,j,k,l,m,p,r,q){var n=this.elements;n[0]=a;n[4]=b;n[8]=c;n[12]=d;n[1]=e;n[5]=g;n[9]=f;n[13]=h;n[2]=i;n[6]=j;n[10]=k;n[14]=l;n[3]=m;n[7]=p;n[11]=r;n[15]=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),g=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*g;c[9]=b[9]*g;c[10]=b[10]*g;return this}}(),setRotationFromEuler:function(a,
b){console.warn("DEPRECATED: Matrix4's .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.");return this.makeRotationFromEuler(a,b)},makeRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,g=a.z,f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(g),g=Math.sin(g);if(void 0===b||"XYZ"===b){var j=f*i,k=f*g,l=d*i,m=d*g;c[0]=h*i;c[4]=-h*g;c[8]=e;c[1]=k+l*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=l+k*e;c[10]=f*h}else"YXZ"===b?
(j=h*i,k=h*g,l=e*i,m=e*g,c[0]=j+m*d,c[4]=l*d-k,c[8]=f*e,c[1]=f*g,c[5]=f*i,c[9]=-d,c[2]=k*d-l,c[6]=m+j*d,c[10]=f*h):"ZXY"===b?(j=h*i,k=h*g,l=e*i,m=e*g,c[0]=j-m*d,c[4]=-f*g,c[8]=l+k*d,c[1]=k+l*d,c[5]=f*i,c[9]=m-j*d,c[2]=-f*e,c[6]=d,c[10]=f*h):"ZYX"===b?(j=f*i,k=f*g,l=d*i,m=d*g,c[0]=h*i,c[4]=l*e-k,c[8]=j*e+m,c[1]=h*g,c[5]=m*e+j,c[9]=k*e-l,c[2]=-e,c[6]=d*h,c[10]=f*h):"YZX"===b?(j=f*h,k=f*e,l=d*h,m=d*e,c[0]=h*i,c[4]=m-j*g,c[8]=l*g+k,c[1]=g,c[5]=f*i,c[9]=-d*i,c[2]=-e*i,c[6]=k*g+l,c[10]=j-m*g):"XZY"===b&&
(j=f*h,k=f*e,l=d*h,m=d*e,c[0]=h*i,c[4]=-g,c[8]=e*i,c[1]=j*g+m,c[5]=f*i,c[9]=k*g-l,c[2]=l*g-k,c[6]=d*i,c[10]=m*g+j);c[3]=0;c[7]=0;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w,f=
c+c,h=d+d,i=e+e,a=c*f,j=c*h,c=c*i,k=d*h,d=d*i,e=e*i,f=g*f,h=g*h,g=g*i;b[0]=1-(k+e);b[4]=j-g;b[8]=c+h;b[1]=j+g;b[5]=1-(a+e);b[9]=d-f;b[2]=c-h;b[6]=d+f;b[10]=1-(a+k);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,g){var f=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(g,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(g,c).normalize());
b.crossVectors(c,a);f[0]=a.x;f[4]=b.x;f[8]=c.x;f[1]=a.y;f[5]=b.y;f[9]=c.y;f[2]=a.z;f[6]=b.z;f[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,g=c[0],f=c[4],h=c[8],i=c[12],j=c[1],k=c[5],l=c[9],m=c[13],p=c[2],r=c[6],q=c[10],n=c[14],
s=c[3],t=c[7],u=c[11],c=c[15],v=d[0],w=d[4],x=d[8],y=d[12],z=d[1],A=d[5],B=d[9],C=d[13],D=d[2],E=d[6],F=d[10],G=d[14],H=d[3],I=d[7],J=d[11],d=d[15];e[0]=g*v+f*z+h*D+i*H;e[4]=g*w+f*A+h*E+i*I;e[8]=g*x+f*B+h*F+i*J;e[12]=g*y+f*C+h*G+i*d;e[1]=j*v+k*z+l*D+m*H;e[5]=j*w+k*A+l*E+m*I;e[9]=j*x+k*B+l*F+m*J;e[13]=j*y+k*C+l*G+m*d;e[2]=p*v+r*z+q*D+n*H;e[6]=p*w+r*A+q*E+n*I;e[10]=p*x+r*B+q*F+n*J;e[14]=p*y+r*C+q*G+n*d;e[3]=s*v+t*z+u*D+c*H;e[7]=s*w+t*A+u*E+c*I;e[11]=s*x+t*B+u*F+c*J;e[15]=s*y+t*C+u*G+c*d;return this},
multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],g=a[1],f=a[5],h=a[9],i=a[13],j=a[2],k=a[6],l=a[10],m=a[14];return a[3]*(+e*h*k-d*i*k-e*f*l+c*i*l+d*f*m-c*h*m)+a[7]*(+b*h*m-b*i*l+e*g*l-d*g*m+d*i*j-e*h*j)+a[11]*(+b*i*k-b*f*m-e*g*k+c*g*m+e*f*j-c*i*j)+a[15]*(-d*f*j-b*h*k+b*f*l+d*g*k-c*g*
l+c*h*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],g=d[4],f=d[8],h=d[12],i=d[1],j=d[5],k=d[9],l=d[13],m=d[2],p=d[6],r=d[10],q=d[14],n=d[3],s=d[7],t=d[11],u=d[15];c[0]=k*q*s-l*r*s+l*p*t-j*q*t-k*p*u+j*r*u;c[4]=h*r*s-f*q*s-h*p*t+g*q*t+f*p*u-g*r*u;c[8]=f*l*s-h*k*s+h*j*t-g*l*t-f*j*u+g*k*u;c[12]=h*k*p-f*l*p-h*j*r+g*l*r+f*j*q-g*k*q;c[1]=l*r*n-k*q*n-l*m*t+i*q*t+k*m*u-i*r*u;c[5]=f*q*n-h*r*n+h*m*t-e*q*t-f*m*u+e*r*u;c[9]=h*k*n-f*l*n-h*i*t+e*l*t+f*i*u-
e*k*u;c[13]=f*l*m-h*k*m+h*i*r-e*l*r-f*i*q+e*k*q;c[2]=j*q*n-l*p*n+l*m*s-i*q*s-j*m*u+i*p*u;c[6]=h*p*n-g*q*n-h*m*s+e*q*s+g*m*u-e*p*u;c[10]=g*l*n-h*j*n+h*i*s-e*l*s-g*i*u+e*j*u;c[14]=h*j*m-g*l*m-h*i*p+e*l*p+g*i*q-e*j*q;c[3]=k*p*n-j*r*n-k*m*s+i*r*s+j*m*t-i*p*t;c[7]=g*r*n-f*p*n+f*m*s-e*r*s-g*m*t+e*p*t;c[11]=f*j*n-g*k*n-f*i*s+e*k*s+g*i*t-e*j*t;c[15]=g*k*m-f*j*m+f*i*p-e*k*p-g*i*r+e*j*r;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){console.warn("DEPRECATED: Matrix4's .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code.");return this.makeFromPositionQuaternionScale(a,b,c)},makeFromPositionQuaternionScale:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},makeFromPositionEulerScale:function(a,b,c,d){this.makeRotationFromEuler(b,c);this.scale(d);this.setPosition(a);return this},
makeFrustum:function(a,b,c,d,e,g){var f=this.elements;f[0]=2*e/(b-a);f[4]=0;f[8]=(b+a)/(b-a);f[12]=0;f[1]=0;f[5]=2*e/(d-c);f[9]=(d+c)/(d-c);f[13]=0;f[2]=0;f[6]=0;f[10]=-(g+e)/(g-e);f[14]=-2*g*e/(g-e);f[3]=0;f[7]=0;f[11]=-1;f[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,g){var f=this.elements,h=b-a,i=c-d,j=g-e;f[0]=2/h;f[4]=0;f[8]=0;f[12]=-((b+a)/h);f[1]=0;f[5]=2/
i;f[9]=0;f[13]=-((c+d)/i);f[2]=0;f[6]=0;f[10]=-2/j;f[14]=-((g+e)/j);f[3]=0;f[7]=0;f[11]=0;f[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
THREE.extend(THREE.Matrix4.prototype,{decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,g,f){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;g=g instanceof THREE.Quaternion?g:new THREE.Quaternion;f=f instanceof THREE.Vector3?f:new THREE.Vector3;f.x=a.length();f.y=b.length();f.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=
f.x;d.elements[1]/=f.x;d.elements[2]/=f.x;d.elements[4]/=f.y;d.elements[5]/=f.y;d.elements[6]/=f.y;d.elements[8]/=f.z;d.elements[9]/=f.z;d.elements[10]/=f.z;g.setFromRotationMatrix(d);return[e,g,f]}}()});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
var d=c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Frustum=function(a,b,c,d,e,g){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==g?g:new THREE.Plane]};
THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,g){var f=this.planes;f[0].copy(a);f[1].copy(b);f[2].copy(c);f[3].copy(d);f[4].copy(e);f[5].copy(g);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],g=c[3],f=c[4],h=c[5],i=c[6],j=c[7],k=c[8],l=c[9],m=c[10],p=c[11],r=c[12],q=c[13],n=c[14],c=c[15];b[0].setComponents(g-a,j-f,p-k,c-r).normalize();b[1].setComponents(g+
a,j+f,p+k,c+r).normalize();b[2].setComponents(g+d,j+h,p+l,c+q).normalize();b[3].setComponents(g-d,j-h,p-l,c-q).normalize();b[4].setComponents(g-e,j-i,p-m,c-n).normalize();b[5].setComponents(g+e,j+i,p+m,c+n).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
c);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),g=this.normal.dot(e);if(0==g){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return g=-(b.start.dot(this.normal)+this.constant)/g,0>g||1<g?void 0:d.copy(e).multiplyScalar(g).add(b.start)}}(),
coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getNormalMatrix(c),e=a.copy(this.normal).applyMatrix3(d),g=this.coplanarPoint(b);g.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,g);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var g=a.distanceToSquared(b[d]),c=Math.max(c,g);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,
b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,j,k,l,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
g+2;j=this.points[c[0]];k=this.points[c[1]];l=this.points[c[2]];m=this.points[c[3]];h=f*f;i=f*h;d.x=b(j.x,k.x,l.x,m.x,f,h,i);d.y=b(j.y,k.y,l.y,m.y,f,h,i);d.z=b(j.z,k.z,l.z,m.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,g,f,h){a.subVectors(f,e);b.subVectors(g,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),g=a.dot(c),i=b.dot(b),f=b.dot(c),j=d*i-e*e,h=h||new THREE.Vector3;if(0==j)return h.set(-2,-1,-1);j=1/j;i=(i*g-e*f)*j;d=(d*f-e*g)*j;return h.set(1-i-d,d,i)}}();
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.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)}};
// Export the THREE object for **Node.js**, with

@@ -26,0 +165,0 @@ // backwards-compatibility for the old `require()` API. If we're in

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc