Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kamicane
Created May 14, 2015 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamicane/b7fe528d8059a7403960 to your computer and use it in GitHub Desktop.
Save kamicane/b7fe528d8059a7403960 to your computer and use it in GitHub Desktop.
requirebin sketch
var Scene = require('three.cjs/scenes/Scene').Scene;
var PerspectiveCamera = require('three.cjs/cameras/PerspectiveCamera').PerspectiveCamera;
var BoxGeometry = require('three.cjs/extras/geometries/BoxGeometry').BoxGeometry;
var MeshBasicMaterial = require('three.cjs/materials/MeshBasicMaterial').MeshBasicMaterial;
var Mesh = require('three.cjs/objects/Mesh').Mesh;
var WebGLRenderer = require('three.cjs/renderers/WebGLRenderer').WebGLRenderer;
var scene, camera, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
scene = new Scene();
camera = new PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
geometry = new BoxGeometry( 200, 200, 200 );
material = new MeshBasicMaterial( { color: "red", wireframe: true } );
mesh = new Mesh( geometry, material );
scene.add( mesh );
renderer = new WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],3:[function(require,module,exports){var EventDispatcherModule=require("../core/EventDispatcher");var MathModule=require("../math/Math");var Three=require("../Three");var Material;var instance;Material=function(){Object.defineProperty(this,"id",{value:Three.MaterialIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Material";this.side=Three.FrontSide;this.opacity=1;this.transparent=false;this.blending=Three.NormalBlending;this.blendSrc=Three.SrcAlphaFactor;this.blendDst=Three.OneMinusSrcAlphaFactor;this.blendEquation=Three.AddEquation;this.blendSrcAlpha=null;this.blendDstAlpha=null;this.blendEquationAlpha=null;this.depthTest=true;this.depthWrite=true;this.colorWrite=true;this.polygonOffset=false;this.polygonOffsetFactor=0;this.polygonOffsetUnits=0;this.alphaTest=0;this.overdraw=0;this.visible=true;this._needsUpdate=true};Material.prototype={constructor:Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(value){if(value===true)this.update();this._needsUpdate=value},setValues:function(values){if(values===undefined)return;for(var key in values){var newValue=values[key];if(newValue===undefined){Three.warn("THREE.Material: '"+key+"' parameter is undefined.");continue}if(key in this){var currentValue=this[key];if(!!(instance=currentValue)&&!!instance.isColor){currentValue.set(newValue)}else if(!!(instance=currentValue)&&!!instance.isVector3&&(!!(instance=newValue)&&!!instance.isVector3)){currentValue.copy(newValue)}else if(key=="overdraw"){this[key]=Number(newValue)}else{this[key]=newValue}}}},toJSON:function(){var output={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(!!(instance=this)&&!!instance.isMeshBasicMaterial){output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshLambertMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshPhongMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();output.specular=this.specular.getHex();output.shininess=this.shininess;if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshNormalMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshDepthMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isPointCloudMaterial){output.size=this.size;output.sizeAttenuation=this.sizeAttenuation;output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending}else if(!!(instance=this)&&!!instance.isShaderMaterial){output.uniforms=this.uniforms;output.vertexShader=this.vertexShader;output.fragmentShader=this.fragmentShader}else if(!!(instance=this)&&!!instance.isSpriteMaterial){output.color=this.color.getHex()}if(this.opacity<1)output.opacity=this.opacity;if(this.transparent!==false)output.transparent=this.transparent;if(this.wireframe!==false)output.wireframe=this.wireframe;return output},clone:function(material){if(material===undefined)material=new Material;material.name=this.name;material.side=this.side;material.opacity=this.opacity;material.transparent=this.transparent;material.blending=this.blending;material.blendSrc=this.blendSrc;material.blendDst=this.blendDst;material.blendEquation=this.blendEquation;material.blendSrcAlpha=this.blendSrcAlpha;material.blendDstAlpha=this.blendDstAlpha;material.blendEquationAlpha=this.blendEquationAlpha;material.depthTest=this.depthTest;material.depthWrite=this.depthWrite;material.polygonOffset=this.polygonOffset;material.polygonOffsetFactor=this.polygonOffsetFactor;material.polygonOffsetUnits=this.polygonOffsetUnits;material.alphaTest=this.alphaTest;material.overdraw=this.overdraw;material.visible=this.visible;return material},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Material.prototype);Material.prototype.isMaterial=true;exports.Material=Material},{"../Three":1,"../core/EventDispatcher":2,"../math/Math":5}],4:[function(require,module,exports){var ColorKeywords;var Color;var instance;Color=function(color){if(arguments.length===3){return this.setRGB(arguments[0],arguments[1],arguments[2])}return this.set(color)};Color.prototype={constructor:Color,r:1,g:1,b:1,set:function(value){if(!!(instance=value)&&!!instance.isColor){this.copy(value)}else if(typeof value==="number"){this.setHex(value)}else if(typeof value==="string"){this.setStyle(value)}return this},setHex:function(hex){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this},setRGB:function(r,g,b){this.r=r;this.g=g;this.b=b;return this},setHSL:function(h,s,l){if(s===0){this.r=this.g=this.b=l}else{var hue2rgb=function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*6*(2/3-t);return p};var p=l<=.5?l*(1+s):l+s-l*s;var q=2*l-p;this.r=hue2rgb(q,p,h+1/3);this.g=hue2rgb(q,p,h);this.b=hue2rgb(q,p,h-1/3)}return this},setStyle:function(style){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(style)){var color=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(style);this.r=Math.min(255,parseInt(color[1],10))/255;this.g=Math.min(255,parseInt(color[2],10))/255;this.b=Math.min(255,parseInt(color[3],10))/255;return this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(style)){var color=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(style);this.r=Math.min(100,parseInt(color[1],10))/100;this.g=Math.min(100,parseInt(color[2],10))/100;this.b=Math.min(100,parseInt(color[3],10))/100;return this}if(/^\#([0-9a-f]{6})$/i.test(style)){var color=/^\#([0-9a-f]{6})$/i.exec(style);this.setHex(parseInt(color[1],16));return this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(style)){var color=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(style);this.setHex(parseInt(color[1]+color[1]+color[2]+color[2]+color[3]+color[3],16));return this}if(/^(\w+)$/i.test(style)){this.setHex(ColorKeywords[style]);return this}},copy:function(color){this.r=color.r;this.g=color.g;this.b=color.b;return this},copyGammaToLinear:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;this.r=Math.pow(color.r,gammaFactor);this.g=Math.pow(color.g,gammaFactor);this.b=Math.pow(color.b,gammaFactor);return this},copyLinearToGamma:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;var safeInverse=gammaFactor>0?1/gammaFactor:1;this.r=Math.pow(color.r,safeInverse);this.g=Math.pow(color.g,safeInverse);this.b=Math.pow(color.b,safeInverse);return this},convertGammaToLinear:function(){var r=this.r,g=this.g,b=this.b;this.r=r*r;this.g=g*g;this.b=b*b;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 this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(optionalTarget){var hsl=optionalTarget||{h:0,s:0,l:0};var r=this.r,g=this.g,b=this.b;var max=Math.max(r,g,b);var min=Math.min(r,g,b);var hue,saturation;var lightness=(min+max)/2;if(min===max){hue=0;saturation=0}else{var delta=max-min;saturation=lightness<=.5?delta/(max+min):delta/(2-max-min);switch(max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4;break}hue/=6}hsl.h=hue;hsl.s=saturation;hsl.l=lightness;return hsl},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(h,s,l){var hsl=this.getHSL();hsl.h+=h;hsl.s+=s;hsl.l+=l;this.setHSL(hsl.h,hsl.s,hsl.l);return this},add:function(color){this.r+=color.r;this.g+=color.g;this.b+=color.b;return this},addColors:function(color1,color2){this.r=color1.r+color2.r;this.g=color1.g+color2.g;this.b=color1.b+color2.b;return this},addScalar:function(s){this.r+=s;this.g+=s;this.b+=s;return this},multiply:function(color){this.r*=color.r;this.g*=color.g;this.b*=color.b;return this},multiplyScalar:function(s){this.r*=s;this.g*=s;this.b*=s;return this},lerp:function(color,alpha){this.r+=(color.r-this.r)*alpha;this.g+=(color.g-this.g)*alpha;this.b+=(color.b-this.b)*alpha;return this},equals:function(c){return c.r===this.r&&c.g===this.g&&c.b===this.b},fromArray:function(array){this.r=array[0];this.g=array[1];this.b=array[2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.r;array[offset+1]=this.g;array[offset+2]=this.b;return array},clone:function(){return(new Color).setRGB(this.r,this.g,this.b)}};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};Color.prototype.isColor=true;exports.Color=Color;exports.ColorKeywords=ColorKeywords},{}],5:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],"three.cjs/materials/MeshBasicMaterial":[function(require,module,exports){var Three=require("../Three");var ColorModule=require("../math/Color");var MaterialModule=require("./Material");var MeshBasicMaterial;MeshBasicMaterial=function(parameters){MaterialModule.Material.call(this);this.type="MeshBasicMaterial";this.color=new ColorModule.Color(16777215);this.map=null;this.lightMap=null;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.combine=Three.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=true;this.shading=Three.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap="round";this.wireframeLinejoin="round";this.vertexColors=Three.NoColors;this.skinning=false;this.morphTargets=false;this.setValues(parameters)};MeshBasicMaterial.prototype=Object.create(MaterialModule.Material.prototype);MeshBasicMaterial.prototype.constructor=MeshBasicMaterial;MeshBasicMaterial.prototype.clone=function(){var material=new MeshBasicMaterial;MaterialModule.Material.prototype.clone.call(this,material);material.color.copy(this.color);material.map=this.map;material.lightMap=this.lightMap;material.specularMap=this.specularMap;material.alphaMap=this.alphaMap;material.envMap=this.envMap;material.combine=this.combine;material.reflectivity=this.reflectivity;material.refractionRatio=this.refractionRatio;material.fog=this.fog;material.shading=this.shading;material.wireframe=this.wireframe;material.wireframeLinewidth=this.wireframeLinewidth;material.wireframeLinecap=this.wireframeLinecap;material.wireframeLinejoin=this.wireframeLinejoin;material.vertexColors=this.vertexColors;material.skinning=this.skinning;material.morphTargets=this.morphTargets;return material};MeshBasicMaterial.prototype.isMeshBasicMaterial=true;exports.MeshBasicMaterial=MeshBasicMaterial},{"../Three":1,"../math/Color":4,"./Material":3}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],3:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var Matrix4Module=require("../math/Matrix4");var QuaternionModule=require("../math/Quaternion");var EulerModule=require("../math/Euler");var Vector3Module=require("../math/Vector3");var MathModule=require("../math/Math");var Three=require("../Three");var Object3D;var instance;Object3D=function(){Object.defineProperty(this,"id",{value:Three.Object3DIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Object3D";this.parent=undefined;this.children=[];this.up=Object3D.DefaultUp.clone();var position=new Vector3Module.Vector3;var rotation=new EulerModule.Euler;var quaternion=new QuaternionModule.Quaternion;var scale=new Vector3Module.Vector3(1,1,1);var onRotationChange=function(){quaternion.setFromEuler(rotation,false)};var onQuaternionChange=function(){rotation.setFromQuaternion(quaternion,undefined,false)};rotation.onChange(onRotationChange);quaternion.onChange(onQuaternionChange);Object.defineProperties(this,{position:{enumerable:true,value:position},rotation:{enumerable:true,value:rotation},quaternion:{enumerable:true,value:quaternion},scale:{enumerable:true,value:scale}});this.rotationAutoUpdate=true;this.matrix=new Matrix4Module.Matrix4;this.matrixWorld=new Matrix4Module.Matrix4;this.matrixAutoUpdate=true;this.matrixWorldNeedsUpdate=false;this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.userData={}};Object3D.DefaultUp=new Vector3Module.Vector3(0,1,0);Object3D.prototype={constructor:Object3D,get eulerOrder(){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(value){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=value},get useQuaternion(){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(value){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(matrix){this.matrix.multiplyMatrices(matrix,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(axis,angle){this.quaternion.setFromAxisAngle(axis,angle)},setRotationFromEuler:function(euler){this.quaternion.setFromEuler(euler,true)},setRotationFromMatrix:function(m){this.quaternion.setFromRotationMatrix(m)},setRotationFromQuaternion:function(q){this.quaternion.copy(q)},rotateOnAxis:function(){var q1=new QuaternionModule.Quaternion;return function(axis,angle){q1.setFromAxisAngle(axis,angle);this.quaternion.multiply(q1);return this}}(),rotateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(angle){return this.rotateOnAxis(v1,angle)}}(),translateOnAxis:function(){var v1=new Vector3Module.Vector3;return function(axis,distance){v1.copy(axis).applyQuaternion(this.quaternion);this.position.add(v1.multiplyScalar(distance));return this}}(),translate:function(distance,axis){Three.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(axis,distance)},translateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(distance){return this.translateOnAxis(v1,distance)}}(),localToWorld:function(vector){return vector.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var m1=new Matrix4Module.Matrix4;return function(vector){return vector.applyMatrix4(m1.getInverse(this.matrixWorld))}}(),lookAt:function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(vector,this.position,this.up);this.quaternion.setFromRotationMatrix(m1)}}(),add:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.add(arguments[i])}return this}if(object===this){Three.error("THREE.Object3D.add: object can't be added as a child of itself.",object);return this}if(!!(instance=object)&&!!instance.isObject3D){if(object.parent!==undefined){object.parent.remove(object)}object.parent=this;object.dispatchEvent({type:"added"});this.children.push(object)}else{Three.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",object)}return this},remove:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.remove(arguments[i])}}var index=this.children.indexOf(object);if(index!==-1){object.parent=undefined;object.dispatchEvent({type:"removed"
});this.children.splice(index,1)}},getChildByName:function(name){Three.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(name)},getObjectById:function(id){return this.getObjectByProperty("id",id)},getObjectByName:function(name){return this.getObjectByProperty("name",name)},getObjectByProperty:function(name,value){if(this[name]===value)return this;for(var i=0,l=this.children.length;i<l;i++){var child=this.children[i];var object=child.getObjectByProperty(name,value);if(object!==undefined){return object}}return undefined},getWorldPosition:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);return result.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var position=new Vector3Module.Vector3;var scale=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new QuaternionModule.Quaternion;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,result,scale);return result}}(),getWorldRotation:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new EulerModule.Euler;this.getWorldQuaternion(quaternion);return result.setFromQuaternion(quaternion,this.rotation.order,false)}}(),getWorldScale:function(){var position=new Vector3Module.Vector3;var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,quaternion,result);return result}}(),getWorldDirection:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,1).applyQuaternion(quaternion)}}(),raycast:function(){},traverse:function(callback){callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverse(callback)}},traverseVisible:function(callback){if(this.visible===false)return;callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverseVisible(callback)}},traverseAncestors:function(callback){if(this.parent){callback(this.parent);this.parent.traverseAncestors(callback)}},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(force){if(this.matrixAutoUpdate===true)this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||force===true){if(this.parent===undefined){this.matrixWorld.copy(this.matrix)}else{this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)}this.matrixWorldNeedsUpdate=false;force=true}for(var i=0,l=this.children.length;i<l;i++){this.children[i].updateMatrixWorld(force)}},toJSON:function(){var output={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}};var geometries={};var parseGeometry=function(geometry){if(output.geometries===undefined){output.geometries=[]}if(geometries[geometry.uuid]===undefined){var json=geometry.toJSON();delete json.metadata;geometries[geometry.uuid]=json;output.geometries.push(json)}return geometry.uuid};var materials={};var parseMaterial=function(material){if(output.materials===undefined){output.materials=[]}if(materials[material.uuid]===undefined){var json=material.toJSON();delete json.metadata;materials[material.uuid]=json;output.materials.push(json)}return material.uuid};var parseObject=function(object){var data={};data.uuid=object.uuid;data.type=object.type;if(object.name!=="")data.name=object.name;if(JSON.stringify(object.userData)!=="{}")data.userData=object.userData;if(object.visible!==true)data.visible=object.visible;if(!!(instance=object)&&!!instance.isPerspectiveCamera){data.fov=object.fov;data.aspect=object.aspect;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isOrthographicCamera){data.left=object.left;data.right=object.right;data.top=object.top;data.bottom=object.bottom;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isAmbientLight){data.color=object.color.getHex()}else if(!!(instance=object)&&!!instance.isDirectionalLight){data.color=object.color.getHex();data.intensity=object.intensity}else if(!!(instance=object)&&!!instance.isPointLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isSpotLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.angle=object.angle;data.exponent=object.exponent;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isHemisphereLight){data.color=object.color.getHex();data.groundColor=object.groundColor.getHex()}else if(!!(instance=object)&&!!instance.isMesh||!!(instance=object)&&!!instance.isLine||!!(instance=object)&&!!instance.isPointCloud){data.geometry=parseGeometry(object.geometry);data.material=parseMaterial(object.material);if(!!(instance=object)&&!!instance.isLine)data.mode=object.mode}else if(!!(instance=object)&&!!instance.isSprite){data.material=parseMaterial(object.material)}data.matrix=object.matrix.toArray();if(object.children.length>0){data.children=[];for(var i=0;i<object.children.length;i++){data.children.push(parseObject(object.children[i]))}}return data};output.object=parseObject(this);return output},clone:function(object,recursive){if(object===undefined)object=new Object3D;if(recursive===undefined)recursive=true;object.name=this.name;object.up.copy(this.up);object.position.copy(this.position);object.quaternion.copy(this.quaternion);object.scale.copy(this.scale);object.rotationAutoUpdate=this.rotationAutoUpdate;object.matrix.copy(this.matrix);object.matrixWorld.copy(this.matrixWorld);object.matrixAutoUpdate=this.matrixAutoUpdate;object.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;object.visible=this.visible;object.castShadow=this.castShadow;object.receiveShadow=this.receiveShadow;object.frustumCulled=this.frustumCulled;object.userData=JSON.parse(JSON.stringify(this.userData));if(recursive===true){for(var i=0;i<this.children.length;i++){var child=this.children[i];object.add(child.clone())}}return object}};EventDispatcherModule.EventDispatcher.prototype.apply(Object3D.prototype);Object3D.prototype.isObject3D=true;exports.Object3D=Object3D},{"../Three":1,"../math/Euler":4,"../math/Math":5,"../math/Matrix4":6,"../math/Quaternion":7,"../math/Vector3":8,"./EventDispatcher":2}],4:[function(require,module,exports){var Vector3Module=require("./Vector3");var QuaternionModule=require("./Quaternion");var Matrix4Module=require("./Matrix4");var Three=require("../Three");var MathModule=require("./Math");var Euler;Euler=function(x,y,z,order){this._x=x||0;this._y=y||0;this._z=z||0;this._order=order||Euler.DefaultOrder};Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Euler.DefaultOrder="XYZ";Euler.prototype={constructor:Euler,_x:0,_y:0,_z:0,_order:Euler.DefaultOrder,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get order(){return this._order},set order(value){this._order=value;this.onChangeCallback()},set:function(x,y,z,order){this._x=x;this._y=y;this._z=z;this._order=order||this._order;this.onChangeCallback();return this},copy:function(euler){this._x=euler._x;this._y=euler._y;this._z=euler._z;this._order=euler._order;this.onChangeCallback();return this},setFromRotationMatrix:function(m,order,update){var clamp=MathModule.Math.clamp;var te=m.elements;var m11=te[0],m12=te[4],m13=te[8];var m21=te[1],m22=te[5],m23=te[9];var m31=te[2],m32=te[6],m33=te[10];order=order||this._order;if(order==="XYZ"){this._y=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<.99999){this._x=Math.atan2(-m23,m33);this._z=Math.atan2(-m12,m11)}else{this._x=Math.atan2(m32,m22);this._z=0}}else if(order==="YXZ"){this._x=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<.99999){this._y=Math.atan2(m13,m33);this._z=Math.atan2(m21,m22)}else{this._y=Math.atan2(-m31,m11);this._z=0}}else if(order==="ZXY"){this._x=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<.99999){this._y=Math.atan2(-m31,m33);this._z=Math.atan2(-m12,m22)}else{this._y=0;this._z=Math.atan2(m21,m11)}}else if(order==="ZYX"){this._y=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<.99999){this._x=Math.atan2(m32,m33);this._z=Math.atan2(m21,m11)}else{this._x=0;this._z=Math.atan2(-m12,m22)}}else if(order==="YZX"){this._z=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<.99999){this._x=Math.atan2(-m23,m22);this._y=Math.atan2(-m31,m11)}else{this._x=0;this._y=Math.atan2(m13,m33)}}else if(order==="XZY"){this._z=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<.99999){this._x=Math.atan2(m32,m22);this._y=Math.atan2(m13,m11)}else{this._x=Math.atan2(-m23,m33);this._y=0}}else{Three.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+order)}this._order=order;if(update!==false)this.onChangeCallback();return this},setFromQuaternion:function(){var matrix;return function(q,order,update){if(matrix===undefined)matrix=new Matrix4Module.Matrix4;matrix.makeRotationFromQuaternion(q);this.setFromRotationMatrix(matrix,order,update);return this}}(),setFromVector3:function(v,order){return this.set(v.x,v.y,v.z,order||this._order)},reorder:function(){var q=new QuaternionModule.Quaternion;return function(newOrder){q.setFromEuler(this);this.setFromQuaternion(q,newOrder)}}(),equals:function(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order},fromArray:function(array){this._x=array[0];this._y=array[1];this._z=array[2];if(array[3]!==undefined)this._order=array[3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._order;return array},toVector3:function(optionalResult){if(optionalResult){return optionalResult.set(this._x,this._y,this._z)}else{return new Vector3Module.Vector3(this._x,this._y,this._z)}},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Euler(this._x,this._y,this._z,this._order)}};Euler.prototype.isEuler=true;exports.Euler=Euler},{"../Three":1,"./Math":5,"./Matrix4":6,"./Quaternion":7,"./Vector3":8}],5:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],6:[function(require,module,exports){var MathModule=require("./Math");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Three=require("../Three");var Matrix4;var instance;Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};Matrix4.prototype={constructor:Matrix4,set:function(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){var te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;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(m){this.elements.set(m.elements);return this},extractPosition:function(m){Three.warn("THREE.Matrix4: .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},extractBasis:function(xAxis,yAxis,zAxis){var te=this.elements;xAxis.set(te[0],te[1],te[2]);yAxis.set(te[4],te[5],te[6]);zAxis.set(te[8],te[9],te[10]);return this},makeBasis:function(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this},extractRotation:function(){var v1;return function(m){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);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}}(),makeRotationFromEuler:function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var te=this.elements;var x=euler.x,y=euler.y,z=euler.z;var a=Math.cos(x),b=Math.sin(x);var c=Math.cos(y),d=Math.sin(y);var e=Math.cos(z),f=Math.sin(z);if(euler.order==="XYZ"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c}else if(euler.order==="YXZ"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c}else if(euler.order==="ZXY"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c}else if(euler.order==="ZYX"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c}else if(euler.order==="YZX"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f}else if(euler.order==="XZY"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac}te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},setRotationFromQuaternion:function(q){Three.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(q)},makeRotationFromQuaternion:function(q){var te=this.elements;var x=q.x,y=q.y,z=q.z,w=q.w;var x2=x+x,y2=y+y,z2=z+z;var xx=x*x2,xy=x*y2,xz=x*z2;var yy=y*y2,yz=y*z2,zz=z*z2;var wx=w*x2,wy=w*y2,wz=w*z2;te[0]=1-(yy+zz);te[4]=xy-wz;te[8]=xz+wy;te[1]=xy+wz;te[5]=1-(xx+zz);te[9]=yz-wx;te[2]=xz-wy;te[6]=yz+wx;te[10]=1-(xx+yy);te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},lookAt:function(){var x,y,z;return function(eye,target,up){if(x===undefined)x=new((Vector3Module||getVector3Module()).Vector3);if(y===undefined)y=new((Vector3Module||getVector3Module()).Vector3);if(z===undefined)z=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;z.subVectors(eye,target).normalize();if(z.length()===0){z.z=1}x.crossVectors(up,z).normalize();if(x.length()===0){z.x+=1e-4;x.crossVectors(up,z).normalize()}y.crossVectors(z,x);te[0]=x.x;te[4]=y.x;te[8]=z.x;te[1]=x.y;te[5]=y.y;te[9]=z.y;te[2]=x.z;te[6]=y.z;te[10]=z.z;return this}}(),multiply:function(m,n){if(n!==undefined){Three.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(m,n)}return this.multiplyMatrices(this,m)},multiplyMatrices:function(a,b){var ae=a.elements;var be=b.elements;var te=this.elements;var a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];var a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];var a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];var a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];var b11=be[0],b12=be[4],b13=be[8],b14=be[12];var b21=be[1],b22=be[5],b23=be[9],b24=be[13];var b31=be[2],b32=be[6],b33=be[10],b34=be[14];var b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this},multiplyToArray:function(a,b,r){var te=this.elements;this.multiplyMatrices(a,b);r[0]=te[0];r[1]=te[1];r[2]=te[2];r[3]=te[3];r[4]=te[4];r[5]=te[5];r[6]=te[6];r[7]=te[7];r[8]=te[8];r[9]=te[9];r[10]=te[10];r[11]=te[11];r[12]=te[12];r[13]=te[13];r[14]=te[14];r[15]=te[15];return this},multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return vector.applyProjection(this)},multiplyVector4:function(vector){Three.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1;return function(array,offset,length){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix4(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),rotateAxis:function(v){Three.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");v.transformDirection(this)},crossVector:function(vector){Three.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},determinant:function(){var te=this.elements;var n11=te[0],n12=te[4],n13=te[8],n14=te[12];var n21=te[1],n22=te[5],n23=te[9],n24=te[13];var n31=te[2],n32=te[6],n33=te[10],n34=te[14];var n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)},transpose:function(){var te=this.elements;var tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array},getPosition:function(){var v1;return function(){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);Three.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var te=this.elements;return v1.set(te[12],te[13],te[14])}}(),setPosition:function(v){var te=this.elements;te[12]=v.x;te[13]=v.y;te[14]=v.z;return this},getInverse:function(m,throwOnInvertible){var te=this.elements;var me=m.elements;var n11=me[0],n12=me[4],n13=me[8],n14=me[12];var n21=me[1],n22=me[5],n23=me[9],n24=me[13];var n31=me[2],n32=me[6],n33=me[10],n34=me[14];var n41=me[3],n42=me[7],n43=me[11],n44=me[15];te[0]=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44;te[4]=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44;te[8]=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44;te[12]=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;te[1]=n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44;te[5]=n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44;te[9]=n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44;te[13]=n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34;te[2]=n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44;te[6]=n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44;te[10]=n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44;te[14]=n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34;te[3]=n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43;te[7]=n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43;te[11]=n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43;te[15]=n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33;var det=n11*te[0]+n21*te[4]+n31*te[8]+n41*te[12];if(det==0){var msg="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},translate:function(v){Three.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(angle){Three.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(angle){Three.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(angle){Three.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(axis,angle){Three.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(v){var te=this.elements;var x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this},getMaxScaleOnAxis:function(){var te=this.elements;var scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];var scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];var scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,Math.max(scaleYSq,scaleZSq)))},makeTranslation:function(x,y,z){this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);return this},makeRotationX:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this},makeRotationY:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this},makeRotationZ:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(axis,angle){var c=Math.cos(angle);var s=Math.sin(angle);var t=1-c;var x=axis.x,y=axis.y,z=axis.z;var tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this},makeScale:function(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this},compose:function(position,quaternion,scale){this.makeRotationFromQuaternion(quaternion);this.scale(scale);this.setPosition(position);return this},decompose:function(){var vector;var matrix=new Matrix4;return function(position,quaternion,scale){if(vector===undefined)vector=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;var sx=vector.set(te[0],te[1],te[2]).length();var sy=vector.set(te[4],te[5],te[6]).length();var sz=vector.set(te[8],te[9],te[10]).length();var det=this.determinant();if(det<0){sx=-sx}position.x=te[12];position.y=te[13];position.z=te[14];matrix.elements.set(this.elements);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix.elements[0]*=invSX;matrix.elements[1]*=invSX;matrix.elements[2]*=invSX;matrix.elements[4]*=invSY;matrix.elements[5]*=invSY;matrix.elements[6]*=invSY;matrix.elements[8]*=invSZ;matrix.elements[9]*=invSZ;matrix.elements[10]*=invSZ;quaternion.setFromRotationMatrix(matrix);scale.x=sx;scale.y=sy;scale.z=sz;return this}}(),makeFrustum:function(left,right,bottom,top,near,far){var te=this.elements;var x=2*near/(right-left);var y=2*near/(top-bottom);var a=(right+left)/(right-left);var b=(top+bottom)/(top-bottom);var c=-(far+near)/(far-near);var d=-2*far*near/(far-near);te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this},makePerspective:function(fov,aspect,near,far){var ymax=near*Math.tan(MathModule.Math.degToRad(fov*.5));var ymin=-ymax;var xmin=ymin*aspect;var xmax=ymax*aspect;return this.makeFrustum(xmin,xmax,ymin,ymax,near,far)},makeOrthographic:function(left,right,top,bottom,near,far){var te=this.elements;var w=right-left;var h=top-bottom;var p=far-near;var x=(right+left)/w;var y=(top+bottom)/h;var z=(far+near)/p;te[0]=2/w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2/h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=-2/p;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8],te[9],te[10],te[11],te[12],te[13],te[14],te[15]]},clone:function(){return(new Matrix4).fromArray(this.elements)}};Matrix4.prototype.isMatrix4=true;exports.Matrix4=Matrix4},{"../Three":1,"./Math":5,"./Vector3":8}],7:[function(require,module,exports){var Three=require("../Three");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Quaternion;var instance;Quaternion=function(x,y,z,w){this._x=x||0;this._y=y||0;this._z=z||0;this._w=w!==undefined?w:1};Quaternion.prototype={constructor:Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get w(){return this._w},set w(value){this._w=value;this.onChangeCallback()},set:function(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this.onChangeCallback();return this},copy:function(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this.onChangeCallback();return this},setFromEuler:function(euler,update){if((!!(instance=euler)&&!!instance.isEuler)===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var c1=Math.cos(euler._x/2);var c2=Math.cos(euler._y/2);var c3=Math.cos(euler._z/2);var s1=Math.sin(euler._x/2);var s2=Math.sin(euler._y/2);var s3=Math.sin(euler._z/2);if(euler.order==="XYZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="YXZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="ZXY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="ZYX"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="YZX"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="XZY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}if(update!==false)this.onChangeCallback();return this},setFromAxisAngle:function(axis,angle){var halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this.onChangeCallback();return this},setFromRotationMatrix:function(m){var te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33,s;if(trace>0){s=.5/Math.sqrt(trace+1);this._w=.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s;this._x=.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s}else if(m22>m33){s=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=.25*s;this._z=(m23+m32)/s}else{s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=.25*s}this.onChangeCallback();return this},setFromUnitVectors:function(){var v1,r;var EPS=1e-6;return function(vFrom,vTo){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);r=vFrom.dot(vTo)+1;if(r<EPS){r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){v1.set(-vFrom.y,vFrom.x,0)}else{v1.set(0,-vFrom.z,vFrom.y)}}else{v1.crossVectors(vFrom,vTo)}this._x=v1.x;this._y=v1.y;this._z=v1.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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)},normalize:function(){var l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1}else{l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l}this.onChangeCallback();return this},multiply:function(q,p){if(p!==undefined){Three.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(q,p)}return this.multiplyQuaternions(this,q)},multiplyQuaternions:function(a,b){var qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;var qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.onChangeCallback();return this},multiplyVector3:function(vector){Three.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return vector.applyQuaternion(this)},slerp:function(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);
var x=this._x,y=this._y,z=this._z,w=this._w;var cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta}else{this.copy(qb)}if(cosHalfTheta>=1){this._w=w;this._x=x;this._y=y;this._z=z;return this}var halfTheta=Math.acos(cosHalfTheta);var sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){this._w=.5*(w+this._w);this._x=.5*(x+this._x);this._y=.5*(y+this._y);this._z=.5*(z+this._z);return this}var ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this.onChangeCallback();return this},equals:function(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w},fromArray:function(array,offset){if(offset===undefined)offset=0;this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Quaternion(this._x,this._y,this._z,this._w)}};Quaternion.slerp=function(qa,qb,qm,t){return qm.copy(qa).slerp(qb,t)};Quaternion.prototype.isQuaternion=true;exports.Quaternion=Quaternion},{"../Three":1,"./Vector3":8}],8:[function(require,module,exports){var MathModule=require("./Math");var Matrix4Module,getMatrix4Module=function(){return Matrix4Module=require("./Matrix4")};var QuaternionModule,getQuaternionModule=function(){return QuaternionModule=require("./Quaternion")};var Three=require("../Three");var Vector3;var instance;Vector3=function(x,y,z){this.x=x||0;this.y=y||0;this.z=z||0};Vector3.prototype={constructor:Vector3,set:function(x,y,z){this.x=x;this.y=y;this.z=z;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(v,w)}this.x*=v.x;this.y*=v.y;this.z*=v.z;return this},multiplyScalar:function(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;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},applyEuler:function(){var quaternion;return function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromEuler(euler));return this}}(),applyAxisAngle:function(){var quaternion;return function(axis,angle){if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromAxisAngle(axis,angle));return this}}(),applyMatrix3:function(m){var x=this.x;var y=this.y;var z=this.z;var e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this},applyMatrix4:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];return this},applyProjection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;var d=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*d;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*d;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*d;return this},applyQuaternion:function(q){var x=this.x;var y=this.y;var z=this.z;var qx=q.x;var qy=q.y;var qz=q.z;var qw=q.w;var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;this.x=ix*qw+iw*-qx+iy*-qz-iz*-qy;this.y=iy*qw+iw*-qy+iz*-qx-ix*-qz;this.z=iz*qw+iw*-qz+ix*-qy-iy*-qx;return this},project:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.projectionMatrix,matrix.getInverse(camera.matrixWorld));return this.applyProjection(matrix)}}(),unproject:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.matrixWorld,matrix.getInverse(camera.projectionMatrix));return this.applyProjection(matrix)}}(),transformDirection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;this.normalize();return this},divide:function(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar}else{this.x=0;this.y=0;this.z=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector3;max=new Vector3}min.set(minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},cross:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(v,w)}var x=this.x,y=this.y,z=this.z;this.x=y*v.z-z*v.y;this.y=z*v.x-x*v.z;this.z=x*v.y-y*v.x;return this},crossVectors:function(a,b){var ax=a.x,ay=a.y,az=a.z;var bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this},projectOnVector:function(){var v1,dot;return function(vector){if(v1===undefined)v1=new Vector3;v1.copy(vector).normalize();dot=this.dot(v1);return this.copy(v1).multiplyScalar(dot)}}(),projectOnPlane:function(){var v1;return function(planeNormal){if(v1===undefined)v1=new Vector3;v1.copy(this).projectOnVector(planeNormal);return this.sub(v1)}}(),reflect:function(){var v1;return function(normal){if(v1===undefined)v1=new Vector3;return this.sub(v1.copy(normal).multiplyScalar(2*this.dot(normal)))}}(),angleTo:function(v){var theta=this.dot(v)/(this.length()*v.length());return Math.acos(MathModule.Math.clamp(theta,-1,1))},distanceTo:function(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x;var dy=this.y-v.y;var dz=this.z-v.z;return dx*dx+dy*dy+dz*dz},setEulerFromRotationMatrix:function(m,order){Three.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(q,order){Three.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(m){Three.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(m)},getScaleFromMatrix:function(m){Three.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(m)},getColumnFromMatrix:function(index,matrix){Three.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(index,matrix)},setFromMatrixPosition:function(m){this.x=m.elements[12];this.y=m.elements[13];this.z=m.elements[14];return this},setFromMatrixScale:function(m){var sx=this.set(m.elements[0],m.elements[1],m.elements[2]).length();var sy=this.set(m.elements[4],m.elements[5],m.elements[6]).length();var sz=this.set(m.elements[8],m.elements[9],m.elements[10]).length();this.x=sx;this.y=sy;this.z=sz;return this},setFromMatrixColumn: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){return v.x===this.x&&v.y===this.y&&v.z===this.z},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];return this},clone:function(){return new Vector3(this.x,this.y,this.z)}};Vector3.prototype.isVector3=true;exports.Vector3=Vector3},{"../Three":1,"./Math":5,"./Matrix4":6,"./Quaternion":7}],"three.cjs/scenes/Scene":[function(require,module,exports){var Object3DModule=require("../core/Object3D");var Scene;Scene=function(){Object3DModule.Object3D.call(this);this.type="Scene";this.fog=null;this.overrideMaterial=null;this.autoUpdate=true};Scene.prototype=Object.create(Object3DModule.Object3D.prototype);Scene.prototype.constructor=Scene;Scene.prototype.clone=function(object){if(object===undefined)object=new Scene;Object3DModule.Object3D.prototype.clone.call(this,object);if(this.fog!==null)object.fog=this.fog.clone();if(this.overrideMaterial!==null)object.overrideMaterial=this.overrideMaterial.clone();object.autoUpdate=this.autoUpdate;object.matrixAutoUpdate=this.matrixAutoUpdate;return object};Scene.prototype.isScene=true;exports.Scene=Scene},{"../core/Object3D":3}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var Vector3Module=require("../math/Vector3");var QuaternionModule=require("../math/Quaternion");var Matrix4Module=require("../math/Matrix4");var Object3DModule=require("../core/Object3D");var Camera;Camera=function(){Object3DModule.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new Matrix4Module.Matrix4;this.projectionMatrix=new Matrix4Module.Matrix4};Camera.prototype=Object.create(Object3DModule.Object3D.prototype);Camera.prototype.constructor=Camera;Camera.prototype.getWorldDirection=function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,-1).applyQuaternion(quaternion)}}();Camera.prototype.lookAt=function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(this.position,vector,this.up);this.quaternion.setFromRotationMatrix(m1)}}();Camera.prototype.clone=function(camera){if(camera===undefined)camera=new Camera;Object3DModule.Object3D.prototype.clone.call(this,camera);camera.matrixWorldInverse.copy(this.matrixWorldInverse);camera.projectionMatrix.copy(this.projectionMatrix);return camera};Camera.prototype.isCamera=true;exports.Camera=Camera},{"../core/Object3D":4,"../math/Matrix4":7,"../math/Quaternion":8,"../math/Vector3":9}],3:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],4:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var Matrix4Module=require("../math/Matrix4");var QuaternionModule=require("../math/Quaternion");var EulerModule=require("../math/Euler");var Vector3Module=require("../math/Vector3");var MathModule=require("../math/Math");var Three=require("../Three");var Object3D;var instance;Object3D=function(){Object.defineProperty(this,"id",{value:Three.Object3DIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Object3D";this.parent=undefined;this.children=[];this.up=Object3D.DefaultUp.clone();var position=new Vector3Module.Vector3;var rotation=new EulerModule.Euler;var quaternion=new QuaternionModule.Quaternion;var scale=new Vector3Module.Vector3(1,1,1);var onRotationChange=function(){quaternion.setFromEuler(rotation,false)};var onQuaternionChange=function(){rotation.setFromQuaternion(quaternion,undefined,false)};rotation.onChange(onRotationChange);quaternion.onChange(onQuaternionChange);Object.defineProperties(this,{position:{enumerable:true,value:position},rotation:{enumerable:true,value:rotation},quaternion:{enumerable:true,value:quaternion},scale:{enumerable:true,value:scale}});this.rotationAutoUpdate=true;this.matrix=new Matrix4Module.Matrix4;this.matrixWorld=new Matrix4Module.Matrix4;this.matrixAutoUpdate=true;this.matrixWorldNeedsUpdate=false;this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.userData={}};Object3D.DefaultUp=new Vector3Module.Vector3(0,1,0);Object3D.prototype={constructor:Object3D,get eulerOrder(){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(value){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=value},get useQuaternion(){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(value){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(matrix){this.matrix.multiplyMatrices(matrix,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(axis,angle){this.quaternion.setFromAxisAngle(axis,angle)},setRotationFromEuler:function(euler){this.quaternion.setFromEuler(euler,true)},setRotationFromMatrix:function(m){this.quaternion.setFromRotationMatrix(m)},setRotationFromQuaternion:function(q){this.quaternion.copy(q)},rotateOnAxis:function(){var q1=new QuaternionModule.Quaternion;return function(axis,angle){q1.setFromAxisAngle(axis,angle);this.quaternion.multiply(q1);return this}}(),rotateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(angle){return this.rotateOnAxis(v1,angle)}}(),translateOnAxis:function(){var v1=new Vector3Module.Vector3;return function(axis,distance){v1.copy(axis).applyQuaternion(this.quaternion);this.position.add(v1.multiplyScalar(distance));return this}}(),translate:function(distance,axis){Three.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(axis,distance)},translateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(distance){return this.translateOnAxis(v1,distance)}}(),localToWorld:function(vector){return vector.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var m1=new Matrix4Module.Matrix4;return function(vector){return vector.applyMatrix4(m1.getInverse(this.matrixWorld))}}(),lookAt:function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(vector,this.position,this.up);this.quaternion.setFromRotationMatrix(m1)}}(),add:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.add(arguments[i])}return this}if(object===this){Three.error("THREE.Object3D.add: object can't be added as a child of itself.",object);return this}if(!!(instance=object)&&!!instance.isObject3D){if(object.parent!==undefined){object.parent.remove(object)}object.parent=this;object.dispatchEvent({type:"added"});this.children.push(object)}else{Three.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",object)}return this},remove:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.remove(arguments[i])}}var index=this.children.indexOf(object);if(index!==-1){object.parent=undefined;object.dispatchEvent({type:"removed"});this.children.splice(index,1)}},getChildByName:function(name){Three.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(name)},getObjectById:function(id){return this.getObjectByProperty("id",id)},getObjectByName:function(name){return this.getObjectByProperty("name",name)},getObjectByProperty:function(name,value){if(this[name]===value)return this;for(var i=0,l=this.children.length;i<l;i++){var child=this.children[i];var object=child.getObjectByProperty(name,value);if(object!==undefined){return object}}return undefined},getWorldPosition:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);return result.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var position=new Vector3Module.Vector3;var scale=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new QuaternionModule.Quaternion;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,result,scale);return result}}(),getWorldRotation:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new EulerModule.Euler;this.getWorldQuaternion(quaternion);return result.setFromQuaternion(quaternion,this.rotation.order,false)}}(),getWorldScale:function(){var position=new Vector3Module.Vector3;var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,quaternion,result);return result}}(),getWorldDirection:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,1).applyQuaternion(quaternion)}}(),raycast:function(){},traverse:function(callback){callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverse(callback)}},traverseVisible:function(callback){if(this.visible===false)return;callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverseVisible(callback)}},traverseAncestors:function(callback){if(this.parent){callback(this.parent);this.parent.traverseAncestors(callback)}},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(force){if(this.matrixAutoUpdate===true)this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||force===true){if(this.parent===undefined){this.matrixWorld.copy(this.matrix)}else{this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)}this.matrixWorldNeedsUpdate=false;force=true}for(var i=0,l=this.children.length;i<l;i++){this.children[i].updateMatrixWorld(force)}},toJSON:function(){var output={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}};var geometries={};var parseGeometry=function(geometry){if(output.geometries===undefined){output.geometries=[]}if(geometries[geometry.uuid]===undefined){var json=geometry.toJSON();delete json.metadata;geometries[geometry.uuid]=json;output.geometries.push(json)}return geometry.uuid};var materials={};var parseMaterial=function(material){if(output.materials===undefined){output.materials=[]}if(materials[material.uuid]===undefined){var json=material.toJSON();delete json.metadata;materials[material.uuid]=json;output.materials.push(json)}return material.uuid};var parseObject=function(object){var data={};data.uuid=object.uuid;data.type=object.type;if(object.name!=="")data.name=object.name;if(JSON.stringify(object.userData)!=="{}")data.userData=object.userData;if(object.visible!==true)data.visible=object.visible;if(!!(instance=object)&&!!instance.isPerspectiveCamera){data.fov=object.fov;data.aspect=object.aspect;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isOrthographicCamera){data.left=object.left;data.right=object.right;data.top=object.top;data.bottom=object.bottom;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isAmbientLight){data.color=object.color.getHex()}else if(!!(instance=object)&&!!instance.isDirectionalLight){data.color=object.color.getHex();data.intensity=object.intensity}else if(!!(instance=object)&&!!instance.isPointLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isSpotLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.angle=object.angle;data.exponent=object.exponent;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isHemisphereLight){data.color=object.color.getHex();data.groundColor=object.groundColor.getHex()}else if(!!(instance=object)&&!!instance.isMesh||!!(instance=object)&&!!instance.isLine||!!(instance=object)&&!!instance.isPointCloud){data.geometry=parseGeometry(object.geometry);data.material=parseMaterial(object.material);if(!!(instance=object)&&!!instance.isLine)data.mode=object.mode}else if(!!(instance=object)&&!!instance.isSprite){data.material=parseMaterial(object.material)}data.matrix=object.matrix.toArray();if(object.children.length>0){data.children=[];for(var i=0;i<object.children.length;i++){data.children.push(parseObject(object.children[i]))}}return data};output.object=parseObject(this);return output},clone:function(object,recursive){if(object===undefined)object=new Object3D;if(recursive===undefined)recursive=true;object.name=this.name;object.up.copy(this.up);object.position.copy(this.position);object.quaternion.copy(this.quaternion);object.scale.copy(this.scale);object.rotationAutoUpdate=this.rotationAutoUpdate;object.matrix.copy(this.matrix);object.matrixWorld.copy(this.matrixWorld);object.matrixAutoUpdate=this.matrixAutoUpdate;object.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;object.visible=this.visible;object.castShadow=this.castShadow;object.receiveShadow=this.receiveShadow;object.frustumCulled=this.frustumCulled;object.userData=JSON.parse(JSON.stringify(this.userData));if(recursive===true){for(var i=0;i<this.children.length;i++){var child=this.children[i];object.add(child.clone())}}return object}};EventDispatcherModule.EventDispatcher.prototype.apply(Object3D.prototype);Object3D.prototype.isObject3D=true;exports.Object3D=Object3D},{"../Three":1,"../math/Euler":5,"../math/Math":6,"../math/Matrix4":7,"../math/Quaternion":8,"../math/Vector3":9,"./EventDispatcher":3}],5:[function(require,module,exports){var Vector3Module=require("./Vector3");var QuaternionModule=require("./Quaternion");var Matrix4Module=require("./Matrix4");var Three=require("../Three");var MathModule=require("./Math");var Euler;Euler=function(x,y,z,order){this._x=x||0;this._y=y||0;this._z=z||0;this._order=order||Euler.DefaultOrder};Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Euler.DefaultOrder="XYZ";Euler.prototype={constructor:Euler,_x:0,_y:0,_z:0,_order:Euler.DefaultOrder,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get order(){return this._order},set order(value){this._order=value;this.onChangeCallback()},set:function(x,y,z,order){this._x=x;this._y=y;this._z=z;this._order=order||this._order;this.onChangeCallback();return this},copy:function(euler){this._x=euler._x;this._y=euler._y;this._z=euler._z;this._order=euler._order;this.onChangeCallback();return this},setFromRotationMatrix:function(m,order,update){
var clamp=MathModule.Math.clamp;var te=m.elements;var m11=te[0],m12=te[4],m13=te[8];var m21=te[1],m22=te[5],m23=te[9];var m31=te[2],m32=te[6],m33=te[10];order=order||this._order;if(order==="XYZ"){this._y=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<.99999){this._x=Math.atan2(-m23,m33);this._z=Math.atan2(-m12,m11)}else{this._x=Math.atan2(m32,m22);this._z=0}}else if(order==="YXZ"){this._x=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<.99999){this._y=Math.atan2(m13,m33);this._z=Math.atan2(m21,m22)}else{this._y=Math.atan2(-m31,m11);this._z=0}}else if(order==="ZXY"){this._x=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<.99999){this._y=Math.atan2(-m31,m33);this._z=Math.atan2(-m12,m22)}else{this._y=0;this._z=Math.atan2(m21,m11)}}else if(order==="ZYX"){this._y=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<.99999){this._x=Math.atan2(m32,m33);this._z=Math.atan2(m21,m11)}else{this._x=0;this._z=Math.atan2(-m12,m22)}}else if(order==="YZX"){this._z=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<.99999){this._x=Math.atan2(-m23,m22);this._y=Math.atan2(-m31,m11)}else{this._x=0;this._y=Math.atan2(m13,m33)}}else if(order==="XZY"){this._z=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<.99999){this._x=Math.atan2(m32,m22);this._y=Math.atan2(m13,m11)}else{this._x=Math.atan2(-m23,m33);this._y=0}}else{Three.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+order)}this._order=order;if(update!==false)this.onChangeCallback();return this},setFromQuaternion:function(){var matrix;return function(q,order,update){if(matrix===undefined)matrix=new Matrix4Module.Matrix4;matrix.makeRotationFromQuaternion(q);this.setFromRotationMatrix(matrix,order,update);return this}}(),setFromVector3:function(v,order){return this.set(v.x,v.y,v.z,order||this._order)},reorder:function(){var q=new QuaternionModule.Quaternion;return function(newOrder){q.setFromEuler(this);this.setFromQuaternion(q,newOrder)}}(),equals:function(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order},fromArray:function(array){this._x=array[0];this._y=array[1];this._z=array[2];if(array[3]!==undefined)this._order=array[3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._order;return array},toVector3:function(optionalResult){if(optionalResult){return optionalResult.set(this._x,this._y,this._z)}else{return new Vector3Module.Vector3(this._x,this._y,this._z)}},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Euler(this._x,this._y,this._z,this._order)}};Euler.prototype.isEuler=true;exports.Euler=Euler},{"../Three":1,"./Math":6,"./Matrix4":7,"./Quaternion":8,"./Vector3":9}],6:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],7:[function(require,module,exports){var MathModule=require("./Math");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Three=require("../Three");var Matrix4;var instance;Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};Matrix4.prototype={constructor:Matrix4,set:function(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){var te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;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(m){this.elements.set(m.elements);return this},extractPosition:function(m){Three.warn("THREE.Matrix4: .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},extractBasis:function(xAxis,yAxis,zAxis){var te=this.elements;xAxis.set(te[0],te[1],te[2]);yAxis.set(te[4],te[5],te[6]);zAxis.set(te[8],te[9],te[10]);return this},makeBasis:function(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this},extractRotation:function(){var v1;return function(m){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);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}}(),makeRotationFromEuler:function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var te=this.elements;var x=euler.x,y=euler.y,z=euler.z;var a=Math.cos(x),b=Math.sin(x);var c=Math.cos(y),d=Math.sin(y);var e=Math.cos(z),f=Math.sin(z);if(euler.order==="XYZ"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c}else if(euler.order==="YXZ"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c}else if(euler.order==="ZXY"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c}else if(euler.order==="ZYX"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c}else if(euler.order==="YZX"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f}else if(euler.order==="XZY"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac}te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},setRotationFromQuaternion:function(q){Three.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(q)},makeRotationFromQuaternion:function(q){var te=this.elements;var x=q.x,y=q.y,z=q.z,w=q.w;var x2=x+x,y2=y+y,z2=z+z;var xx=x*x2,xy=x*y2,xz=x*z2;var yy=y*y2,yz=y*z2,zz=z*z2;var wx=w*x2,wy=w*y2,wz=w*z2;te[0]=1-(yy+zz);te[4]=xy-wz;te[8]=xz+wy;te[1]=xy+wz;te[5]=1-(xx+zz);te[9]=yz-wx;te[2]=xz-wy;te[6]=yz+wx;te[10]=1-(xx+yy);te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},lookAt:function(){var x,y,z;return function(eye,target,up){if(x===undefined)x=new((Vector3Module||getVector3Module()).Vector3);if(y===undefined)y=new((Vector3Module||getVector3Module()).Vector3);if(z===undefined)z=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;z.subVectors(eye,target).normalize();if(z.length()===0){z.z=1}x.crossVectors(up,z).normalize();if(x.length()===0){z.x+=1e-4;x.crossVectors(up,z).normalize()}y.crossVectors(z,x);te[0]=x.x;te[4]=y.x;te[8]=z.x;te[1]=x.y;te[5]=y.y;te[9]=z.y;te[2]=x.z;te[6]=y.z;te[10]=z.z;return this}}(),multiply:function(m,n){if(n!==undefined){Three.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(m,n)}return this.multiplyMatrices(this,m)},multiplyMatrices:function(a,b){var ae=a.elements;var be=b.elements;var te=this.elements;var a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];var a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];var a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];var a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];var b11=be[0],b12=be[4],b13=be[8],b14=be[12];var b21=be[1],b22=be[5],b23=be[9],b24=be[13];var b31=be[2],b32=be[6],b33=be[10],b34=be[14];var b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this},multiplyToArray:function(a,b,r){var te=this.elements;this.multiplyMatrices(a,b);r[0]=te[0];r[1]=te[1];r[2]=te[2];r[3]=te[3];r[4]=te[4];r[5]=te[5];r[6]=te[6];r[7]=te[7];r[8]=te[8];r[9]=te[9];r[10]=te[10];r[11]=te[11];r[12]=te[12];r[13]=te[13];r[14]=te[14];r[15]=te[15];return this},multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return vector.applyProjection(this)},multiplyVector4:function(vector){Three.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1;return function(array,offset,length){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix4(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),rotateAxis:function(v){Three.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");v.transformDirection(this)},crossVector:function(vector){Three.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},determinant:function(){var te=this.elements;var n11=te[0],n12=te[4],n13=te[8],n14=te[12];var n21=te[1],n22=te[5],n23=te[9],n24=te[13];var n31=te[2],n32=te[6],n33=te[10],n34=te[14];var n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)},transpose:function(){var te=this.elements;var tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array},getPosition:function(){var v1;return function(){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);Three.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var te=this.elements;return v1.set(te[12],te[13],te[14])}}(),setPosition:function(v){var te=this.elements;te[12]=v.x;te[13]=v.y;te[14]=v.z;return this},getInverse:function(m,throwOnInvertible){var te=this.elements;var me=m.elements;var n11=me[0],n12=me[4],n13=me[8],n14=me[12];var n21=me[1],n22=me[5],n23=me[9],n24=me[13];var n31=me[2],n32=me[6],n33=me[10],n34=me[14];var n41=me[3],n42=me[7],n43=me[11],n44=me[15];te[0]=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44;te[4]=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44;te[8]=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44;te[12]=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;te[1]=n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44;te[5]=n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44;te[9]=n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44;te[13]=n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34;te[2]=n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44;te[6]=n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44;te[10]=n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44;te[14]=n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34;te[3]=n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43;te[7]=n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43;te[11]=n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43;te[15]=n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33;var det=n11*te[0]+n21*te[4]+n31*te[8]+n41*te[12];if(det==0){var msg="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},translate:function(v){Three.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(angle){Three.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(angle){Three.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(angle){Three.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(axis,angle){Three.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(v){var te=this.elements;var x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this},getMaxScaleOnAxis:function(){var te=this.elements;var scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];var scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];var scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,Math.max(scaleYSq,scaleZSq)))},makeTranslation:function(x,y,z){this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);return this},makeRotationX:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this},makeRotationY:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this},makeRotationZ:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(axis,angle){var c=Math.cos(angle);var s=Math.sin(angle);var t=1-c;var x=axis.x,y=axis.y,z=axis.z;var tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this},makeScale:function(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this},compose:function(position,quaternion,scale){this.makeRotationFromQuaternion(quaternion);this.scale(scale);this.setPosition(position);return this},decompose:function(){var vector;var matrix=new Matrix4;return function(position,quaternion,scale){if(vector===undefined)vector=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;var sx=vector.set(te[0],te[1],te[2]).length();var sy=vector.set(te[4],te[5],te[6]).length();var sz=vector.set(te[8],te[9],te[10]).length();var det=this.determinant();if(det<0){sx=-sx}position.x=te[12];position.y=te[13];position.z=te[14];matrix.elements.set(this.elements);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix.elements[0]*=invSX;matrix.elements[1]*=invSX;matrix.elements[2]*=invSX;matrix.elements[4]*=invSY;matrix.elements[5]*=invSY;matrix.elements[6]*=invSY;matrix.elements[8]*=invSZ;matrix.elements[9]*=invSZ;matrix.elements[10]*=invSZ;quaternion.setFromRotationMatrix(matrix);scale.x=sx;scale.y=sy;scale.z=sz;return this}}(),makeFrustum:function(left,right,bottom,top,near,far){var te=this.elements;var x=2*near/(right-left);var y=2*near/(top-bottom);var a=(right+left)/(right-left);var b=(top+bottom)/(top-bottom);var c=-(far+near)/(far-near);var d=-2*far*near/(far-near);te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this},makePerspective:function(fov,aspect,near,far){var ymax=near*Math.tan(MathModule.Math.degToRad(fov*.5));var ymin=-ymax;var xmin=ymin*aspect;var xmax=ymax*aspect;return this.makeFrustum(xmin,xmax,ymin,ymax,near,far)},makeOrthographic:function(left,right,top,bottom,near,far){var te=this.elements;var w=right-left;var h=top-bottom;var p=far-near;var x=(right+left)/w;var y=(top+bottom)/h;var z=(far+near)/p;te[0]=2/w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2/h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=-2/p;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8],te[9],te[10],te[11],te[12],te[13],te[14],te[15]]},clone:function(){return(new Matrix4).fromArray(this.elements)}};Matrix4.prototype.isMatrix4=true;exports.Matrix4=Matrix4},{"../Three":1,"./Math":6,"./Vector3":9}],8:[function(require,module,exports){var Three=require("../Three");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Quaternion;var instance;Quaternion=function(x,y,z,w){this._x=x||0;this._y=y||0;this._z=z||0;this._w=w!==undefined?w:1};Quaternion.prototype={constructor:Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get w(){return this._w},set w(value){this._w=value;this.onChangeCallback()},set:function(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this.onChangeCallback();return this},copy:function(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this.onChangeCallback();return this},setFromEuler:function(euler,update){if((!!(instance=euler)&&!!instance.isEuler)===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var c1=Math.cos(euler._x/2);var c2=Math.cos(euler._y/2);var c3=Math.cos(euler._z/2);var s1=Math.sin(euler._x/2);var s2=Math.sin(euler._y/2);var s3=Math.sin(euler._z/2);if(euler.order==="XYZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="YXZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="ZXY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="ZYX"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="YZX"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="XZY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}if(update!==false)this.onChangeCallback();return this},setFromAxisAngle:function(axis,angle){var halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this.onChangeCallback();return this},setFromRotationMatrix:function(m){var te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33,s;if(trace>0){s=.5/Math.sqrt(trace+1);this._w=.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s;this._x=.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s}else if(m22>m33){s=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=.25*s;this._z=(m23+m32)/s}else{s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=.25*s}this.onChangeCallback();return this},setFromUnitVectors:function(){var v1,r;var EPS=1e-6;return function(vFrom,vTo){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);r=vFrom.dot(vTo)+1;if(r<EPS){r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){v1.set(-vFrom.y,vFrom.x,0)}else{v1.set(0,-vFrom.z,vFrom.y)}}else{v1.crossVectors(vFrom,vTo)}this._x=v1.x;this._y=v1.y;this._z=v1.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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)},normalize:function(){var l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1}else{l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l}this.onChangeCallback();return this},multiply:function(q,p){if(p!==undefined){Three.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(q,p)}return this.multiplyQuaternions(this,q)},multiplyQuaternions:function(a,b){var qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;var qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.onChangeCallback();return this},multiplyVector3:function(vector){Three.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return vector.applyQuaternion(this)},slerp:function(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);var x=this._x,y=this._y,z=this._z,w=this._w;var cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta}else{this.copy(qb)}if(cosHalfTheta>=1){this._w=w;this._x=x;this._y=y;this._z=z;return this}var halfTheta=Math.acos(cosHalfTheta);var sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){this._w=.5*(w+this._w);this._x=.5*(x+this._x);this._y=.5*(y+this._y);this._z=.5*(z+this._z);return this}var ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this.onChangeCallback();return this},equals:function(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w},fromArray:function(array,offset){if(offset===undefined)offset=0;this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Quaternion(this._x,this._y,this._z,this._w)}};Quaternion.slerp=function(qa,qb,qm,t){return qm.copy(qa).slerp(qb,t)};Quaternion.prototype.isQuaternion=true;exports.Quaternion=Quaternion},{"../Three":1,"./Vector3":9}],9:[function(require,module,exports){var MathModule=require("./Math");var Matrix4Module,getMatrix4Module=function(){return Matrix4Module=require("./Matrix4")};var QuaternionModule,getQuaternionModule=function(){return QuaternionModule=require("./Quaternion")};var Three=require("../Three");var Vector3;var instance;Vector3=function(x,y,z){this.x=x||0;this.y=y||0;this.z=z||0};Vector3.prototype={constructor:Vector3,set:function(x,y,z){this.x=x;this.y=y;this.z=z;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(v,w)}this.x*=v.x;this.y*=v.y;this.z*=v.z;return this},multiplyScalar:function(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;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},applyEuler:function(){var quaternion;return function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromEuler(euler));return this}}(),applyAxisAngle:function(){var quaternion;return function(axis,angle){if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromAxisAngle(axis,angle));return this}}(),applyMatrix3:function(m){var x=this.x;var y=this.y;var z=this.z;var e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this},applyMatrix4:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];return this},applyProjection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;var d=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*d;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*d;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*d;return this},applyQuaternion:function(q){var x=this.x;var y=this.y;var z=this.z;var qx=q.x;var qy=q.y;var qz=q.z;var qw=q.w;var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;this.x=ix*qw+iw*-qx+iy*-qz-iz*-qy;this.y=iy*qw+iw*-qy+iz*-qx-ix*-qz;this.z=iz*qw+iw*-qz+ix*-qy-iy*-qx;return this},project:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.projectionMatrix,matrix.getInverse(camera.matrixWorld));return this.applyProjection(matrix)}}(),unproject:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.matrixWorld,matrix.getInverse(camera.projectionMatrix));return this.applyProjection(matrix)}}(),transformDirection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;this.normalize();return this},divide:function(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar}else{this.x=0;this.y=0;this.z=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector3;max=new Vector3}min.set(minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},cross:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(v,w)}var x=this.x,y=this.y,z=this.z;this.x=y*v.z-z*v.y;this.y=z*v.x-x*v.z;this.z=x*v.y-y*v.x;return this},crossVectors:function(a,b){var ax=a.x,ay=a.y,az=a.z;var bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this},projectOnVector:function(){var v1,dot;return function(vector){if(v1===undefined)v1=new Vector3;v1.copy(vector).normalize();dot=this.dot(v1);return this.copy(v1).multiplyScalar(dot)}}(),projectOnPlane:function(){var v1;return function(planeNormal){if(v1===undefined)v1=new Vector3;v1.copy(this).projectOnVector(planeNormal);return this.sub(v1)}}(),reflect:function(){var v1;return function(normal){if(v1===undefined)v1=new Vector3;return this.sub(v1.copy(normal).multiplyScalar(2*this.dot(normal)))}}(),angleTo:function(v){var theta=this.dot(v)/(this.length()*v.length());return Math.acos(MathModule.Math.clamp(theta,-1,1))},distanceTo:function(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x;var dy=this.y-v.y;var dz=this.z-v.z;return dx*dx+dy*dy+dz*dz},setEulerFromRotationMatrix:function(m,order){Three.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(q,order){Three.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(m){Three.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(m)},getScaleFromMatrix:function(m){Three.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(m)},getColumnFromMatrix:function(index,matrix){Three.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(index,matrix)},setFromMatrixPosition:function(m){this.x=m.elements[12];this.y=m.elements[13];this.z=m.elements[14];return this},setFromMatrixScale:function(m){var sx=this.set(m.elements[0],m.elements[1],m.elements[2]).length();var sy=this.set(m.elements[4],m.elements[5],m.elements[6]).length();var sz=this.set(m.elements[8],m.elements[9],m.elements[10]).length();this.x=sx;this.y=sy;this.z=sz;return this},setFromMatrixColumn: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){return v.x===this.x&&v.y===this.y&&v.z===this.z},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];return this},clone:function(){return new Vector3(this.x,this.y,this.z)}};Vector3.prototype.isVector3=true;exports.Vector3=Vector3},{"../Three":1,"./Math":6,"./Matrix4":7,"./Quaternion":8}],"three.cjs/cameras/PerspectiveCamera":[function(require,module,exports){var MathModule=require("../math/Math");var CameraModule=require("./Camera");var PerspectiveCamera;PerspectiveCamera=function(fov,aspect,near,far){CameraModule.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=fov!==undefined?fov:50;this.aspect=aspect!==undefined?aspect:1;this.near=near!==undefined?near:.1;this.far=far!==undefined?far:2e3;this.updateProjectionMatrix()};PerspectiveCamera.prototype=Object.create(CameraModule.Camera.prototype);PerspectiveCamera.prototype.constructor=PerspectiveCamera;PerspectiveCamera.prototype.setLens=function(focalLength,frameHeight){if(frameHeight===undefined)frameHeight=24;this.fov=2*MathModule.Math.radToDeg(Math.atan(frameHeight/(focalLength*2)));this.updateProjectionMatrix()};PerspectiveCamera.prototype.setViewOffset=function(fullWidth,fullHeight,x,y,width,height){this.fullWidth=fullWidth;this.fullHeight=fullHeight;this.x=x;this.y=y;this.width=width;this.height=height;this.updateProjectionMatrix()};PerspectiveCamera.prototype.updateProjectionMatrix=function(){var fov=MathModule.Math.radToDeg(2*Math.atan(Math.tan(MathModule.Math.degToRad(this.fov)*.5)/this.zoom));if(this.fullWidth){var aspect=this.fullWidth/this.fullHeight;var top=Math.tan(MathModule.Math.degToRad(fov*.5))*this.near;var bottom=-top;var left=aspect*bottom;var right=aspect*top;var width=Math.abs(right-left);var height=Math.abs(top-bottom);this.projectionMatrix.makeFrustum(left+this.x*width/this.fullWidth,left+(this.x+this.width)*width/this.fullWidth,top-(this.y+this.height)*height/this.fullHeight,top-this.y*height/this.fullHeight,this.near,this.far)}else{this.projectionMatrix.makePerspective(fov,this.aspect,this.near,this.far)}};PerspectiveCamera.prototype.clone=function(){var camera=new PerspectiveCamera;CameraModule.Camera.prototype.clone.call(this,camera);camera.zoom=this.zoom;camera.fov=this.fov;camera.aspect=this.aspect;camera.near=this.near;camera.far=this.far;camera.projectionMatrix.copy(this.projectionMatrix);return camera};PerspectiveCamera.prototype.isPerspectiveCamera=true;exports.PerspectiveCamera=PerspectiveCamera},{"../math/Math":6,"./Camera":2}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],3:[function(require,module,exports){var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Face3;var toString=Object.prototype.toString;var instance;Face3=function(a,b,c,normal,color,materialIndex){this.a=a;this.b=b;this.c=c;this.normal=!!(instance=normal)&&!!instance.isVector3?normal:new Vector3Module.Vector3;this.vertexNormals=toString.call(normal).slice(8,-1)==="Array"?normal:[];this.color=!!(instance=color)&&!!instance.isColor?color:new ColorModule.Color;this.vertexColors=toString.call(color).slice(8,-1)==="Array"?color:[];this.vertexTangents=[];this.materialIndex=materialIndex!==undefined?materialIndex:0};Face3.prototype={constructor:Face3,clone:function(){var face=new Face3(this.a,this.b,this.c);face.normal.copy(this.normal);face.color.copy(this.color);face.materialIndex=this.materialIndex;for(var i=0,il=this.vertexNormals.length;i<il;i++){face.vertexNormals[i]=this.vertexNormals[i].clone()}for(var i=0,il=this.vertexColors.length;i<il;i++){face.vertexColors[i]=this.vertexColors[i].clone()}for(var i=0,il=this.vertexTangents.length;i<il;i++){face.vertexTangents[i]=this.vertexTangents[i].clone()}return face}};Face3.prototype.isFace3=true;exports.Face3=Face3},{"../math/Color":6,"../math/Vector3":13}],4:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var SphereModule=require("../math/Sphere");var Box3Module=require("../math/Box3");var Vector4Module=require("../math/Vector4");var Matrix4Module=require("../math/Matrix4");var Face3Module=require("./Face3");var Vector2Module=require("../math/Vector2");var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Matrix3Module=require("../math/Matrix3");var MathModule=require("../math/Math");var Three=require("../Three");var Geometry;var instance;Geometry=function(){Object.defineProperty(this,"id",{value:Three.GeometryIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingBox=null;this.boundingSphere=null;this.hasTangents=false;this.dynamic=true;this.verticesNeedUpdate=false;this.elementsNeedUpdate=false;this.uvsNeedUpdate=false;this.normalsNeedUpdate=false;this.tangentsNeedUpdate=false;this.colorsNeedUpdate=false;this.lineDistancesNeedUpdate=false;this.groupsNeedUpdate=false};Geometry.prototype={constructor:Geometry,applyMatrix:function(matrix){var normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix);for(var i=0,il=this.vertices.length;i<il;i++){var vertex=this.vertices[i];vertex.applyMatrix4(matrix)}for(var i=0,il=this.faces.length;i<il;i++){var face=this.faces[i];face.normal.applyMatrix3(normalMatrix).normalize();for(var j=0,jl=face.vertexNormals.length;j<jl;j++){face.vertexNormals[j].applyMatrix3(normalMatrix).normalize()}}if(this.boundingBox!==null){this.computeBoundingBox()}if(this.boundingSphere!==null){this.computeBoundingSphere()}this.verticesNeedUpdate=true;this.normalsNeedUpdate=true},fromBufferGeometry:function(geometry){var scope=this;var attributes=geometry.attributes;var vertices=attributes.position.array;var indices=attributes.index!==undefined?attributes.index.array:undefined;var normals=attributes.normal!==undefined?attributes.normal.array:undefined;var colors=attributes.color!==undefined?attributes.color.array:undefined;var uvs=attributes.uv!==undefined?attributes.uv.array:undefined;var tempNormals=[];var tempUVs=[];for(var i=0,j=0;i<vertices.length;i+=3,j+=2){scope.vertices.push(new Vector3Module.Vector3(vertices[i],vertices[i+1],vertices[i+2]));if(normals!==undefined){tempNormals.push(new Vector3Module.Vector3(normals[i],normals[i+1],normals[i+2]))}if(colors!==undefined){scope.colors.push(new ColorModule.Color(colors[i],colors[i+1],colors[i+2]))}if(uvs!==undefined){tempUVs.push(new Vector2Module.Vector2(uvs[j],uvs[j+1]))}}var addFace=function(a,b,c){var vertexNormals=normals!==undefined?[tempNormals[a].clone(),tempNormals[b].clone(),tempNormals[c].clone()]:[];var vertexColors=colors!==undefined?[scope.colors[a].clone(),scope.colors[b].clone(),scope.colors[c].clone()]:[];scope.faces.push(new Face3Module.Face3(a,b,c,vertexNormals,vertexColors));if(uvs!==undefined){scope.faceVertexUvs[0].push([tempUVs[a].clone(),tempUVs[b].clone(),tempUVs[c].clone()])}};if(indices!==undefined){var drawcalls=geometry.drawcalls;if(drawcalls.length>0){for(var i=0;i<drawcalls.length;i++){var drawcall=drawcalls[i];var start=drawcall.start;var count=drawcall.count;var index=drawcall.index;for(var j=start,jl=start+count;j<jl;j+=3){addFace(index+indices[j],index+indices[j+1],index+indices[j+2])}}}else{for(var i=0;i<indices.length;i+=3){addFace(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0;i<vertices.length/3;i+=3){addFace(i,i+1,i+2)}}this.computeFaceNormals();if(geometry.boundingBox!==null){this.boundingBox=geometry.boundingBox.clone()}if(geometry.boundingSphere!==null){this.boundingSphere=geometry.boundingSphere.clone()}return this},center:function(){this.computeBoundingBox();var offset=this.boundingBox.center().negate();this.applyMatrix((new Matrix4Module.Matrix4).setPosition(offset));return offset},computeFaceNormals:function(){var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(var f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f];var vA=this.vertices[face.a];var vB=this.vertices[face.b];var vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);cb.normalize();face.normal.copy(cb)}},computeVertexNormals:function(areaWeighted){var v,vl,f,fl,face,vertices;vertices=new Array(this.vertices.length);for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v]=new Vector3Module.Vector3}if(areaWeighted){var vA,vB,vC;var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vA=this.vertices[face.a];vB=this.vertices[face.b];vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);vertices[face.a].add(cb);vertices[face.b].add(cb);vertices[face.c].add(cb)}}else{for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vertices[face.a].add(face.normal);vertices[face.b].add(face.normal);vertices[face.c].add(face.normal)}}for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v].normalize()}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.vertexNormals[0]=vertices[face.a].clone();face.vertexNormals[1]=vertices[face.b].clone();face.vertexNormals[2]=vertices[face.c].clone()}},computeMorphNormals:function(){var i,il,f,fl,face;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];if(!face.__originalFaceNormal){face.__originalFaceNormal=face.normal.clone()}else{face.__originalFaceNormal.copy(face.normal)}if(!face.__originalVertexNormals)face.__originalVertexNormals=[];for(i=0,il=face.vertexNormals.length;i<il;i++){if(!face.__originalVertexNormals[i]){face.__originalVertexNormals[i]=face.vertexNormals[i].clone()}else{face.__originalVertexNormals[i].copy(face.vertexNormals[i])}}}var tmpGeo=new Geometry;tmpGeo.faces=this.faces;for(i=0,il=this.morphTargets.length;i<il;i++){if(!this.morphNormals[i]){this.morphNormals[i]={};this.morphNormals[i].faceNormals=[];this.morphNormals[i].vertexNormals=[];var dstNormalsFace=this.morphNormals[i].faceNormals;var dstNormalsVertex=this.morphNormals[i].vertexNormals;var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){faceNormal=new Vector3Module.Vector3;vertexNormals={a:new Vector3Module.Vector3,b:new Vector3Module.Vector3,c:new Vector3Module.Vector3};dstNormalsFace.push(faceNormal);dstNormalsVertex.push(vertexNormals)}}var morphNormals=this.morphNormals[i];tmpGeo.vertices=this.morphTargets[i].vertices;tmpGeo.computeFaceNormals();tmpGeo.computeVertexNormals();var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];faceNormal=morphNormals.faceNormals[f];vertexNormals=morphNormals.vertexNormals[f];faceNormal.copy(face.normal);vertexNormals.a.copy(face.vertexNormals[0]);vertexNormals.b.copy(face.vertexNormals[1]);vertexNormals.c.copy(face.vertexNormals[2])}}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.normal=face.__originalFaceNormal;face.vertexNormals=face.__originalVertexNormals}},computeTangents:function(){var f,fl,v,vl,i,vertexIndex,face,uv,vA,vB,vC,uvA,uvB,uvC,x1,x2,y1,y2,z1,z2,s1,s2,t1,t2,r,t,test,tan1=[],tan2=[],sdir=new Vector3Module.Vector3,tdir=new Vector3Module.Vector3,tmp=new Vector3Module.Vector3,tmp2=new Vector3Module.Vector3,n=new Vector3Module.Vector3,w;for(v=0,vl=this.vertices.length;v<vl;v++){tan1[v]=new Vector3Module.Vector3;tan2[v]=new Vector3Module.Vector3}function handleTriangle(context,a,b,c,ua,ub,uc){vA=context.vertices[a];vB=context.vertices[b];vC=context.vertices[c];uvA=uv[ua];uvB=uv[ub];uvC=uv[uc];x1=vB.x-vA.x;x2=vC.x-vA.x;y1=vB.y-vA.y;y2=vC.y-vA.y;z1=vB.z-vA.z;z2=vC.z-vA.z;s1=uvB.x-uvA.x;s2=uvC.x-uvA.x;t1=uvB.y-uvA.y;t2=uvC.y-uvA.y;r=1/(s1*t2-s2*t1);sdir.set((t2*x1-t1*x2)*r,(t2*y1-t1*y2)*r,(t2*z1-t1*z2)*r);tdir.set((s1*x2-s2*x1)*r,(s1*y2-s2*y1)*r,(s1*z2-s2*z1)*r);tan1[a].add(sdir);tan1[b].add(sdir);tan1[c].add(sdir);tan2[a].add(tdir);tan2[b].add(tdir);tan2[c].add(tdir)}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];uv=this.faceVertexUvs[0][f];handleTriangle(this,face.a,face.b,face.c,0,1,2)}var faceIndex=["a","b","c","d"];for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];for(i=0;i<Math.min(face.vertexNormals.length,3);i++){n.copy(face.vertexNormals[i]);vertexIndex=face[faceIndex[i]];t=tan1[vertexIndex];tmp.copy(t);tmp.sub(n.multiplyScalar(n.dot(t))).normalize();tmp2.crossVectors(face.vertexNormals[i],t);test=tmp2.dot(tan2[vertexIndex]);w=test<0?-1:1;face.vertexTangents[i]=new Vector4Module.Vector4(tmp.x,tmp.y,tmp.z,w)}}this.hasTangents=true},computeLineDistances:function(){var d=0;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){if(i>0){d+=vertices[i].distanceTo(vertices[i-1])}this.lineDistances[i]=d}},computeBoundingBox:function(){if(this.boundingBox===null){this.boundingBox=new Box3Module.Box3}this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){if(this.boundingSphere===null){this.boundingSphere=new SphereModule.Sphere}this.boundingSphere.setFromPoints(this.vertices)},merge:function(geometry,matrix,materialIndexOffset){if((!!(instance=geometry)&&!!instance.isGeometry)===false){Three.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",geometry);return}var normalMatrix,vertexOffset=this.vertices.length,vertices1=this.vertices,vertices2=geometry.vertices,faces1=this.faces,faces2=geometry.faces,uvs1=this.faceVertexUvs[0],uvs2=geometry.faceVertexUvs[0];if(materialIndexOffset===undefined)materialIndexOffset=0;if(matrix!==undefined){normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix)}for(var i=0,il=vertices2.length;i<il;i++){var vertex=vertices2[i];var vertexCopy=vertex.clone();if(matrix!==undefined)vertexCopy.applyMatrix4(matrix);vertices1.push(vertexCopy)}for(i=0,il=faces2.length;i<il;i++){var face=faces2[i],faceCopy,normal,color,faceVertexNormals=face.vertexNormals,faceVertexColors=face.vertexColors;faceCopy=new Face3Module.Face3(face.a+vertexOffset,face.b+vertexOffset,face.c+vertexOffset);faceCopy.normal.copy(face.normal);if(normalMatrix!==undefined){faceCopy.normal.applyMatrix3(normalMatrix).normalize()}for(var j=0,jl=faceVertexNormals.length;j<jl;j++){normal=faceVertexNormals[j].clone();if(normalMatrix!==undefined){normal.applyMatrix3(normalMatrix).normalize()}faceCopy.vertexNormals.push(normal)}faceCopy.color.copy(face.color);for(var j=0,jl=faceVertexColors.length;j<jl;j++){color=faceVertexColors[j];faceCopy.vertexColors.push(color.clone())}faceCopy.materialIndex=face.materialIndex+materialIndexOffset;faces1.push(faceCopy)}for(i=0,il=uvs2.length;i<il;i++){var uv=uvs2[i],uvCopy=[];if(uv===undefined){continue}for(var j=0,jl=uv.length;j<jl;j++){uvCopy.push(uv[j].clone())}uvs1.push(uvCopy)}},mergeMesh:function(mesh){if((!!(instance=mesh)&&!!instance.isMesh)===false){Three.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",mesh);return}mesh.matrixAutoUpdate&&mesh.updateMatrix();this.merge(mesh.geometry,mesh.matrix)},mergeVertices:function(){var verticesMap={};var unique=[],changes=[];var v,key;var precisionPoints=4;var precision=Math.pow(10,precisionPoints);var i,il,face;var indices,j,jl;for(i=0,il=this.vertices.length;i<il;i++){v=this.vertices[i];key=Math.round(v.x*precision)+"_"+Math.round(v.y*precision)+"_"+Math.round(v.z*precision);if(verticesMap[key]===undefined){verticesMap[key]=i;unique.push(this.vertices[i]);changes[i]=unique.length-1}else{changes[i]=changes[verticesMap[key]]}}var faceIndicesToRemove=[];for(i=0,il=this.faces.length;i<il;i++){face=this.faces[i];face.a=changes[face.a];face.b=changes[face.b];face.c=changes[face.c];indices=[face.a,face.b,face.c];var dupIndex=-1;for(var n=0;n<3;n++){if(indices[n]==indices[(n+1)%3]){dupIndex=n;faceIndicesToRemove.push(i);break}}}for(i=faceIndicesToRemove.length-1;i>=0;i--){var idx=faceIndicesToRemove[i];this.faces.splice(idx,1);for(j=0,jl=this.faceVertexUvs.length;j<jl;j++){this.faceVertexUvs[j].splice(idx,1)}}var diff=this.vertices.length-unique.length;this.vertices=unique;return diff},toJSON:function(){var output={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(this.parameters!==undefined){var parameters=this.parameters;for(var key in parameters){if(parameters[key]!==undefined)output[key]=parameters[key]}return output}var vertices=[];for(var i=0;i<this.vertices.length;i++){var vertex=this.vertices[i];vertices.push(vertex.x,vertex.y,vertex.z)}var faces=[];var normals=[];var normalsHash={};var colors=[];var colorsHash={};var uvs=[];var uvsHash={};for(var i=0;i<this.faces.length;i++){var face=this.faces[i];var hasMaterial=false;var hasFaceUv=false;var hasFaceVertexUv=this.faceVertexUvs[0][i]!==undefined;var hasFaceNormal=face.normal.length()>0;var hasFaceVertexNormal=face.vertexNormals.length>0;var hasFaceColor=face.color.r!==1||face.color.g!==1||face.color.b!==1;var hasFaceVertexColor=face.vertexColors.length>0;var faceType=0;faceType=setBit(faceType,0,0);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);faces.push(faceType);faces.push(face.a,face.b,face.c);if(hasFaceVertexUv){var faceVertexUvs=this.faceVertexUvs[0][i];faces.push(getUvIndex(faceVertexUvs[0]),getUvIndex(faceVertexUvs[1]),getUvIndex(faceVertexUvs[2]))}if(hasFaceNormal){faces.push(getNormalIndex(face.normal))}if(hasFaceVertexNormal){var vertexNormals=face.vertexNormals;faces.push(getNormalIndex(vertexNormals[0]),getNormalIndex(vertexNormals[1]),getNormalIndex(vertexNormals[2]))}if(hasFaceColor){faces.push(getColorIndex(face.color))}if(hasFaceVertexColor){var vertexColors=face.vertexColors;faces.push(getColorIndex(vertexColors[0]),getColorIndex(vertexColors[1]),getColorIndex(vertexColors[2]))}}function setBit(value,position,enabled){return enabled?value|1<<position:value&~(1<<position)}function getNormalIndex(normal){var hash=normal.x.toString()+normal.y.toString()+normal.z.toString();if(normalsHash[hash]!==undefined){return normalsHash[hash]}normalsHash[hash]=normals.length/3;normals.push(normal.x,normal.y,normal.z);return normalsHash[hash]}function getColorIndex(color){var hash=color.r.toString()+color.g.toString()+color.b.toString();if(colorsHash[hash]!==undefined){return colorsHash[hash]}colorsHash[hash]=colors.length;colors.push(color.getHex());return colorsHash[hash]}function getUvIndex(uv){var hash=uv.x.toString()+uv.y.toString();if(uvsHash[hash]!==undefined){return uvsHash[hash]}uvsHash[hash]=uvs.length/2;uvs.push(uv.x,uv.y);return uvsHash[hash]}output.data={};output.data.vertices=vertices;output.data.normals=normals;if(colors.length>0)output.data.colors=colors;if(uvs.length>0)output.data.uvs=[uvs];output.data.faces=faces;return output},clone:function(){var geometry=new Geometry;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){geometry.vertices.push(vertices[i].clone())}var faces=this.faces;for(var i=0,il=faces.length;i<il;i++){geometry.faces.push(faces[i].clone())}for(var i=0,il=this.faceVertexUvs.length;i<il;i++){var faceVertexUvs=this.faceVertexUvs[i];if(geometry.faceVertexUvs[i]===undefined){geometry.faceVertexUvs[i]=[]}for(var j=0,jl=faceVertexUvs.length;j<jl;j++){var uvs=faceVertexUvs[j],uvsCopy=[];for(var k=0,kl=uvs.length;k<kl;k++){var uv=uvs[k];uvsCopy.push(uv.clone())}geometry.faceVertexUvs[i].push(uvsCopy)}}return geometry},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Geometry.prototype);Geometry.prototype.isGeometry=true;exports.Geometry=Geometry},{"../Three":1,"../math/Box3":5,"../math/Color":6,"../math/Math":7,"../math/Matrix3":8,"../math/Matrix4":9,"../math/Sphere":11,"../math/Vector2":12,"../math/Vector3":13,"../math/Vector4":14,"./EventDispatcher":2,"./Face3":3}],5:[function(require,module,exports){var SphereModule,getSphereModule=function(){return SphereModule=require("./Sphere")};var Vector3Module=require("./Vector3");var Box3;var instance;Box3=function(min,max){this.min=min!==undefined?min:new Vector3Module.Vector3(Infinity,Infinity,Infinity);this.max=max!==undefined?max:new Vector3Module.Vector3(-Infinity,-Infinity,-Infinity)};Box3.prototype={constructor:Box3,set:function(min,max){this.min.copy(min);this.max.copy(max);return this},setFromPoints:function(points){this.makeEmpty();for(var i=0,il=points.length;i<il;i++){this.expandByPoint(points[i])}return this},setFromCenterAndSize:function(){var v1=new Vector3Module.Vector3;return function(center,size){var halfSize=v1.copy(size).multiplyScalar(.5);this.min.copy(center).sub(halfSize);this.max.copy(center).add(halfSize);return this}}(),setFromObject:function(){var v1=new Vector3Module.Vector3;return function(object){var scope=this;object.updateMatrixWorld(true);this.makeEmpty();object.traverse(function(node){var geometry=node.geometry;if(geometry!==undefined){if(!!(instance=geometry)&&!!instance.isGeometry){var vertices=geometry.vertices;for(var i=0,il=vertices.length;i<il;i++){v1.copy(vertices[i]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}else if(!!(instance=geometry)&&!!instance.isBufferGeometry&&geometry.attributes["position"]!==undefined){var positions=geometry.attributes["position"].array;for(var i=0,il=positions.length;i<il;i+=3){v1.set(positions[i],positions[i+1],positions[i+2]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}}});return this}}(),copy:function(box){this.min.copy(box.min);this.max.copy(box.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(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.subVectors(this.max,this.min)},expandByPoint:function(point){this.min.min(point);this.max.max(point);return this},expandByVector:function(vector){this.min.sub(vector);this.max.add(vector);return this},expandByScalar:function(scalar){this.min.addScalar(-scalar);this.max.addScalar(scalar);return this},containsPoint:function(point){if(point.x<this.min.x||point.x>this.max.x||point.y<this.min.y||point.y>this.max.y||point.z<this.min.z||point.z>this.max.z){return false}return true},containsBox:function(box){if(this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<=box.min.z&&box.max.z<=this.max.z){return true}return false},getParameter:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.set((point.x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min.y),(point.z-this.min.z)/(this.max.z-this.min.z));
},isIntersectionBox:function(box){if(box.max.x<this.min.x||box.min.x>this.max.x||box.max.y<this.min.y||box.min.y>this.max.y||box.max.z<this.min.z||box.min.z>this.max.z){return false}return true},clampPoint:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(point).clamp(this.min,this.max)},distanceToPoint:function(){var v1=new Vector3Module.Vector3;return function(point){var clampedPoint=v1.copy(point).clamp(this.min,this.max);return clampedPoint.sub(point).length()}}(),getBoundingSphere:function(){var v1=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new((SphereModule||getSphereModule()).Sphere);result.center=this.center();result.radius=this.size(v1).length()*.5;return result}}(),intersect:function(box){this.min.max(box.min);this.max.min(box.max);return this},union:function(box){this.min.min(box.min);this.max.max(box.max);return this},applyMatrix4:function(){var points=[new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3];return function(matrix){points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix);points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix);points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix);points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix);points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix);points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix);points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix);points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix);this.makeEmpty();this.setFromPoints(points);return this}}(),translate:function(offset){this.min.add(offset);this.max.add(offset);return this},equals:function(box){return box.min.equals(this.min)&&box.max.equals(this.max)},clone:function(){return(new Box3).copy(this)}};Box3.prototype.isBox3=true;exports.Box3=Box3},{"./Sphere":11,"./Vector3":13}],6:[function(require,module,exports){var ColorKeywords;var Color;var instance;Color=function(color){if(arguments.length===3){return this.setRGB(arguments[0],arguments[1],arguments[2])}return this.set(color)};Color.prototype={constructor:Color,r:1,g:1,b:1,set:function(value){if(!!(instance=value)&&!!instance.isColor){this.copy(value)}else if(typeof value==="number"){this.setHex(value)}else if(typeof value==="string"){this.setStyle(value)}return this},setHex:function(hex){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this},setRGB:function(r,g,b){this.r=r;this.g=g;this.b=b;return this},setHSL:function(h,s,l){if(s===0){this.r=this.g=this.b=l}else{var hue2rgb=function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*6*(2/3-t);return p};var p=l<=.5?l*(1+s):l+s-l*s;var q=2*l-p;this.r=hue2rgb(q,p,h+1/3);this.g=hue2rgb(q,p,h);this.b=hue2rgb(q,p,h-1/3)}return this},setStyle:function(style){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(style)){var color=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(style);this.r=Math.min(255,parseInt(color[1],10))/255;this.g=Math.min(255,parseInt(color[2],10))/255;this.b=Math.min(255,parseInt(color[3],10))/255;return this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(style)){var color=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(style);this.r=Math.min(100,parseInt(color[1],10))/100;this.g=Math.min(100,parseInt(color[2],10))/100;this.b=Math.min(100,parseInt(color[3],10))/100;return this}if(/^\#([0-9a-f]{6})$/i.test(style)){var color=/^\#([0-9a-f]{6})$/i.exec(style);this.setHex(parseInt(color[1],16));return this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(style)){var color=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(style);this.setHex(parseInt(color[1]+color[1]+color[2]+color[2]+color[3]+color[3],16));return this}if(/^(\w+)$/i.test(style)){this.setHex(ColorKeywords[style]);return this}},copy:function(color){this.r=color.r;this.g=color.g;this.b=color.b;return this},copyGammaToLinear:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;this.r=Math.pow(color.r,gammaFactor);this.g=Math.pow(color.g,gammaFactor);this.b=Math.pow(color.b,gammaFactor);return this},copyLinearToGamma:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;var safeInverse=gammaFactor>0?1/gammaFactor:1;this.r=Math.pow(color.r,safeInverse);this.g=Math.pow(color.g,safeInverse);this.b=Math.pow(color.b,safeInverse);return this},convertGammaToLinear:function(){var r=this.r,g=this.g,b=this.b;this.r=r*r;this.g=g*g;this.b=b*b;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 this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(optionalTarget){var hsl=optionalTarget||{h:0,s:0,l:0};var r=this.r,g=this.g,b=this.b;var max=Math.max(r,g,b);var min=Math.min(r,g,b);var hue,saturation;var lightness=(min+max)/2;if(min===max){hue=0;saturation=0}else{var delta=max-min;saturation=lightness<=.5?delta/(max+min):delta/(2-max-min);switch(max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4;break}hue/=6}hsl.h=hue;hsl.s=saturation;hsl.l=lightness;return hsl},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(h,s,l){var hsl=this.getHSL();hsl.h+=h;hsl.s+=s;hsl.l+=l;this.setHSL(hsl.h,hsl.s,hsl.l);return this},add:function(color){this.r+=color.r;this.g+=color.g;this.b+=color.b;return this},addColors:function(color1,color2){this.r=color1.r+color2.r;this.g=color1.g+color2.g;this.b=color1.b+color2.b;return this},addScalar:function(s){this.r+=s;this.g+=s;this.b+=s;return this},multiply:function(color){this.r*=color.r;this.g*=color.g;this.b*=color.b;return this},multiplyScalar:function(s){this.r*=s;this.g*=s;this.b*=s;return this},lerp:function(color,alpha){this.r+=(color.r-this.r)*alpha;this.g+=(color.g-this.g)*alpha;this.b+=(color.b-this.b)*alpha;return this},equals:function(c){return c.r===this.r&&c.g===this.g&&c.b===this.b},fromArray:function(array){this.r=array[0];this.g=array[1];this.b=array[2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.r;array[offset+1]=this.g;array[offset+2]=this.b;return array},clone:function(){return(new Color).setRGB(this.r,this.g,this.b)}};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};Color.prototype.isColor=true;exports.Color=Color;exports.ColorKeywords=ColorKeywords},{}],7:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],8:[function(require,module,exports){var Vector3Module=require("./Vector3");var Three=require("../Three");var Matrix3;Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}};Matrix3.prototype={constructor:Matrix3,set:function(n11,n12,n13,n21,n22,n23,n31,n32,n33){var te=this.elements;te[0]=n11;te[3]=n12;te[6]=n13;te[1]=n21;te[4]=n22;te[7]=n23;te[2]=n31;te[5]=n32;te[8]=n33;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(m){var me=m.elements;this.set(me[0],me[3],me[6],me[1],me[4],me[7],me[2],me[5],me[8]);return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return vector.applyMatrix3(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1=new Vector3Module.Vector3;return function(array,offset,length){if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix3(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[3]*=s;te[6]*=s;te[1]*=s;te[4]*=s;te[7]*=s;te[2]*=s;te[5]*=s;te[8]*=s;return this},determinant:function(){var te=this.elements;var a=te[0],b=te[1],c=te[2],d=te[3],e=te[4],f=te[5],g=te[6],h=te[7],i=te[8];return a*e*i-a*f*h-b*d*i+b*f*g+c*d*h-c*e*g},getInverse:function(matrix,throwOnInvertible){var me=matrix.elements;var te=this.elements;te[0]=me[10]*me[5]-me[6]*me[9];te[1]=-me[10]*me[1]+me[2]*me[9];te[2]=me[6]*me[1]-me[2]*me[5];te[3]=-me[10]*me[4]+me[6]*me[8];te[4]=me[10]*me[0]-me[2]*me[8];te[5]=-me[6]*me[0]+me[2]*me[4];te[6]=me[9]*me[4]-me[5]*me[8];te[7]=-me[9]*me[0]+me[1]*me[8];te[8]=me[5]*me[0]-me[1]*me[4];var det=me[0]*te[0]+me[1]*te[3]+me[2]*te[6];if(det===0){var msg="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},transpose:function(){var tmp,m=this.elements;tmp=m[1];m[1]=m[3];m[3]=tmp;tmp=m[2];m[2]=m[6];m[6]=tmp;tmp=m[5];m[5]=m[7];m[7]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];return array},getNormalMatrix:function(m){this.getInverse(m).transpose();return this},transposeIntoArray:function(r){var m=this.elements;r[0]=m[0];r[1]=m[3];r[2]=m[6];r[3]=m[1];r[4]=m[4];r[5]=m[7];r[6]=m[2];r[7]=m[5];r[8]=m[8];return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8]]},clone:function(){return(new Matrix3).fromArray(this.elements)}};Matrix3.prototype.isMatrix3=true;exports.Matrix3=Matrix3},{"../Three":1,"./Vector3":13}],9:[function(require,module,exports){var MathModule=require("./Math");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Three=require("../Three");var Matrix4;var instance;Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};Matrix4.prototype={constructor:Matrix4,set:function(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){var te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;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(m){this.elements.set(m.elements);return this},extractPosition:function(m){Three.warn("THREE.Matrix4: .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},extractBasis:function(xAxis,yAxis,zAxis){var te=this.elements;xAxis.set(te[0],te[1],te[2]);yAxis.set(te[4],te[5],te[6]);zAxis.set(te[8],te[9],te[10]);return this},makeBasis:function(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this},extractRotation:function(){var v1;return function(m){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);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}}(),makeRotationFromEuler:function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var te=this.elements;var x=euler.x,y=euler.y,z=euler.z;var a=Math.cos(x),b=Math.sin(x);var c=Math.cos(y),d=Math.sin(y);var e=Math.cos(z),f=Math.sin(z);if(euler.order==="XYZ"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c}else if(euler.order==="YXZ"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c}else if(euler.order==="ZXY"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c}else if(euler.order==="ZYX"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c}else if(euler.order==="YZX"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f}else if(euler.order==="XZY"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac}te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},setRotationFromQuaternion:function(q){Three.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(q)},makeRotationFromQuaternion:function(q){var te=this.elements;var x=q.x,y=q.y,z=q.z,w=q.w;var x2=x+x,y2=y+y,z2=z+z;var xx=x*x2,xy=x*y2,xz=x*z2;var yy=y*y2,yz=y*z2,zz=z*z2;var wx=w*x2,wy=w*y2,wz=w*z2;te[0]=1-(yy+zz);te[4]=xy-wz;te[8]=xz+wy;te[1]=xy+wz;te[5]=1-(xx+zz);te[9]=yz-wx;te[2]=xz-wy;te[6]=yz+wx;te[10]=1-(xx+yy);te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},lookAt:function(){var x,y,z;return function(eye,target,up){if(x===undefined)x=new((Vector3Module||getVector3Module()).Vector3);if(y===undefined)y=new((Vector3Module||getVector3Module()).Vector3);if(z===undefined)z=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;z.subVectors(eye,target).normalize();if(z.length()===0){z.z=1}x.crossVectors(up,z).normalize();if(x.length()===0){z.x+=1e-4;x.crossVectors(up,z).normalize()}y.crossVectors(z,x);te[0]=x.x;te[4]=y.x;te[8]=z.x;te[1]=x.y;te[5]=y.y;te[9]=z.y;te[2]=x.z;te[6]=y.z;te[10]=z.z;return this}}(),multiply:function(m,n){if(n!==undefined){Three.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(m,n)}return this.multiplyMatrices(this,m)},multiplyMatrices:function(a,b){var ae=a.elements;var be=b.elements;var te=this.elements;var a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];var a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];var a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];var a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];var b11=be[0],b12=be[4],b13=be[8],b14=be[12];var b21=be[1],b22=be[5],b23=be[9],b24=be[13];var b31=be[2],b32=be[6],b33=be[10],b34=be[14];var b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this},multiplyToArray:function(a,b,r){var te=this.elements;this.multiplyMatrices(a,b);r[0]=te[0];r[1]=te[1];r[2]=te[2];r[3]=te[3];r[4]=te[4];r[5]=te[5];r[6]=te[6];r[7]=te[7];r[8]=te[8];r[9]=te[9];r[10]=te[10];r[11]=te[11];r[12]=te[12];r[13]=te[13];r[14]=te[14];r[15]=te[15];return this},multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return vector.applyProjection(this)},multiplyVector4:function(vector){Three.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1;return function(array,offset,length){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix4(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),rotateAxis:function(v){Three.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");v.transformDirection(this)},crossVector:function(vector){Three.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},determinant:function(){var te=this.elements;var n11=te[0],n12=te[4],n13=te[8],n14=te[12];var n21=te[1],n22=te[5],n23=te[9],n24=te[13];var n31=te[2],n32=te[6],n33=te[10],n34=te[14];var n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)},transpose:function(){var te=this.elements;var tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array},getPosition:function(){var v1;return function(){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);Three.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var te=this.elements;return v1.set(te[12],te[13],te[14])}}(),setPosition:function(v){var te=this.elements;te[12]=v.x;te[13]=v.y;te[14]=v.z;return this},getInverse:function(m,throwOnInvertible){var te=this.elements;var me=m.elements;var n11=me[0],n12=me[4],n13=me[8],n14=me[12];var n21=me[1],n22=me[5],n23=me[9],n24=me[13];var n31=me[2],n32=me[6],n33=me[10],n34=me[14];var n41=me[3],n42=me[7],n43=me[11],n44=me[15];te[0]=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44;te[4]=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44;te[8]=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44;te[12]=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;te[1]=n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44;te[5]=n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44;te[9]=n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44;te[13]=n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34;te[2]=n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44;te[6]=n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44;te[10]=n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44;te[14]=n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34;te[3]=n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43;te[7]=n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43;te[11]=n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43;te[15]=n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33;var det=n11*te[0]+n21*te[4]+n31*te[8]+n41*te[12];if(det==0){var msg="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},translate:function(v){Three.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(angle){Three.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(angle){Three.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(angle){Three.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(axis,angle){Three.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(v){var te=this.elements;var x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this},getMaxScaleOnAxis:function(){var te=this.elements;var scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];var scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];var scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,Math.max(scaleYSq,scaleZSq)))},makeTranslation:function(x,y,z){this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);return this},makeRotationX:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this},makeRotationY:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this},makeRotationZ:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(axis,angle){var c=Math.cos(angle);var s=Math.sin(angle);var t=1-c;var x=axis.x,y=axis.y,z=axis.z;var tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this},makeScale:function(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this},compose:function(position,quaternion,scale){this.makeRotationFromQuaternion(quaternion);this.scale(scale);this.setPosition(position);return this},decompose:function(){var vector;var matrix=new Matrix4;return function(position,quaternion,scale){if(vector===undefined)vector=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;var sx=vector.set(te[0],te[1],te[2]).length();var sy=vector.set(te[4],te[5],te[6]).length();var sz=vector.set(te[8],te[9],te[10]).length();var det=this.determinant();if(det<0){sx=-sx}position.x=te[12];position.y=te[13];position.z=te[14];matrix.elements.set(this.elements);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix.elements[0]*=invSX;matrix.elements[1]*=invSX;matrix.elements[2]*=invSX;matrix.elements[4]*=invSY;matrix.elements[5]*=invSY;matrix.elements[6]*=invSY;matrix.elements[8]*=invSZ;matrix.elements[9]*=invSZ;matrix.elements[10]*=invSZ;quaternion.setFromRotationMatrix(matrix);scale.x=sx;scale.y=sy;scale.z=sz;return this}}(),makeFrustum:function(left,right,bottom,top,near,far){var te=this.elements;var x=2*near/(right-left);var y=2*near/(top-bottom);var a=(right+left)/(right-left);var b=(top+bottom)/(top-bottom);var c=-(far+near)/(far-near);var d=-2*far*near/(far-near);te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this},makePerspective:function(fov,aspect,near,far){var ymax=near*Math.tan(MathModule.Math.degToRad(fov*.5));var ymin=-ymax;var xmin=ymin*aspect;var xmax=ymax*aspect;return this.makeFrustum(xmin,xmax,ymin,ymax,near,far)},makeOrthographic:function(left,right,top,bottom,near,far){var te=this.elements;var w=right-left;var h=top-bottom;var p=far-near;var x=(right+left)/w;var y=(top+bottom)/h;var z=(far+near)/p;te[0]=2/w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2/h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=-2/p;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8],te[9],te[10],te[11],te[12],te[13],te[14],te[15]]},clone:function(){return(new Matrix4).fromArray(this.elements)}};Matrix4.prototype.isMatrix4=true;exports.Matrix4=Matrix4},{"../Three":1,"./Math":7,"./Vector3":13}],10:[function(require,module,exports){var Three=require("../Three");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Quaternion;var instance;Quaternion=function(x,y,z,w){this._x=x||0;this._y=y||0;this._z=z||0;this._w=w!==undefined?w:1};Quaternion.prototype={constructor:Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get w(){return this._w},set w(value){this._w=value;this.onChangeCallback()},set:function(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this.onChangeCallback();return this},copy:function(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this.onChangeCallback();return this},setFromEuler:function(euler,update){if((!!(instance=euler)&&!!instance.isEuler)===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var c1=Math.cos(euler._x/2);var c2=Math.cos(euler._y/2);var c3=Math.cos(euler._z/2);var s1=Math.sin(euler._x/2);var s2=Math.sin(euler._y/2);var s3=Math.sin(euler._z/2);if(euler.order==="XYZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="YXZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="ZXY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="ZYX"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="YZX"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="XZY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}if(update!==false)this.onChangeCallback();return this},setFromAxisAngle:function(axis,angle){var halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this.onChangeCallback();return this},setFromRotationMatrix:function(m){var te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33,s;if(trace>0){s=.5/Math.sqrt(trace+1);this._w=.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){s=2*Math.sqrt(1+m11-m22-m33);
this._w=(m32-m23)/s;this._x=.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s}else if(m22>m33){s=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=.25*s;this._z=(m23+m32)/s}else{s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=.25*s}this.onChangeCallback();return this},setFromUnitVectors:function(){var v1,r;var EPS=1e-6;return function(vFrom,vTo){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);r=vFrom.dot(vTo)+1;if(r<EPS){r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){v1.set(-vFrom.y,vFrom.x,0)}else{v1.set(0,-vFrom.z,vFrom.y)}}else{v1.crossVectors(vFrom,vTo)}this._x=v1.x;this._y=v1.y;this._z=v1.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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)},normalize:function(){var l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1}else{l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l}this.onChangeCallback();return this},multiply:function(q,p){if(p!==undefined){Three.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(q,p)}return this.multiplyQuaternions(this,q)},multiplyQuaternions:function(a,b){var qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;var qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.onChangeCallback();return this},multiplyVector3:function(vector){Three.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return vector.applyQuaternion(this)},slerp:function(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);var x=this._x,y=this._y,z=this._z,w=this._w;var cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta}else{this.copy(qb)}if(cosHalfTheta>=1){this._w=w;this._x=x;this._y=y;this._z=z;return this}var halfTheta=Math.acos(cosHalfTheta);var sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){this._w=.5*(w+this._w);this._x=.5*(x+this._x);this._y=.5*(y+this._y);this._z=.5*(z+this._z);return this}var ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this.onChangeCallback();return this},equals:function(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w},fromArray:function(array,offset){if(offset===undefined)offset=0;this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Quaternion(this._x,this._y,this._z,this._w)}};Quaternion.slerp=function(qa,qb,qm,t){return qm.copy(qa).slerp(qb,t)};Quaternion.prototype.isQuaternion=true;exports.Quaternion=Quaternion},{"../Three":1,"./Vector3":13}],11:[function(require,module,exports){var Box3Module,getBox3Module=function(){return Box3Module=require("./Box3")};var Vector3Module=require("./Vector3");var Sphere;Sphere=function(center,radius){this.center=center!==undefined?center:new Vector3Module.Vector3;this.radius=radius!==undefined?radius:0};Sphere.prototype={constructor:Sphere,set:function(center,radius){this.center.copy(center);this.radius=radius;return this},setFromPoints:function(){var box;return function(points,optionalCenter){if(box===undefined)box=new((Box3Module||getBox3Module()).Box3);var center=this.center;if(optionalCenter!==undefined){center.copy(optionalCenter)}else{box.setFromPoints(points).center(center)}var maxRadiusSq=0;for(var i=0,il=points.length;i<il;i++){maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(points[i]))}this.radius=Math.sqrt(maxRadiusSq);return this}}(),copy:function(sphere){this.center.copy(sphere.center);this.radius=sphere.radius;return this},empty:function(){return this.radius<=0},containsPoint:function(point){return point.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(point){return point.distanceTo(this.center)-this.radius},intersectsSphere:function(sphere){var radiusSum=this.radius+sphere.radius;return sphere.center.distanceToSquared(this.center)<=radiusSum*radiusSum},clampPoint:function(point,optionalTarget){var deltaLengthSq=this.center.distanceToSquared(point);var result=optionalTarget||new Vector3Module.Vector3;result.copy(point);if(deltaLengthSq>this.radius*this.radius){result.sub(this.center).normalize();result.multiplyScalar(this.radius).add(this.center)}return result},getBoundingBox:function(optionalTarget){var box=optionalTarget||new((Box3Module||getBox3Module()).Box3);box.set(this.center,this.center);box.expandByScalar(this.radius);return box},applyMatrix4:function(matrix){this.center.applyMatrix4(matrix);this.radius=this.radius*matrix.getMaxScaleOnAxis();return this},translate:function(offset){this.center.add(offset);return this},equals:function(sphere){return sphere.center.equals(this.center)&&sphere.radius===this.radius},clone:function(){return(new Sphere).copy(this)}};Sphere.prototype.isSphere=true;exports.Sphere=Sphere},{"./Box3":5,"./Vector3":13}],12:[function(require,module,exports){var Three=require("../Three");var Vector2;Vector2=function(x,y){this.x=x||0;this.y=y||0};Vector2.prototype={constructor:Vector2,set:function(x,y){this.x=x;this.y=y;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;return this},addScalar:function(s){this.x+=s;this.y+=s;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},sub:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;return this},subScalar:function(s){this.x-=s;this.y-=s;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(v){this.x*=v.x;this.y*=v.y;return this},multiplyScalar:function(s){this.x*=s;this.y*=s;return this},divide:function(v){this.x/=v.x;this.y/=v.y;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar}else{this.x=0;this.y=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector2;max=new Vector2}min.set(minVal,minVal);max.set(maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(v){return this.x*v.x+this.y*v.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(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x,dy=this.y-v.y;return dx*dx+dy*dy},setLength:function(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];return this},clone:function(){return new Vector2(this.x,this.y)}};Vector2.prototype.isVector2=true;exports.Vector2=Vector2},{"../Three":1}],13:[function(require,module,exports){var MathModule=require("./Math");var Matrix4Module,getMatrix4Module=function(){return Matrix4Module=require("./Matrix4")};var QuaternionModule,getQuaternionModule=function(){return QuaternionModule=require("./Quaternion")};var Three=require("../Three");var Vector3;var instance;Vector3=function(x,y,z){this.x=x||0;this.y=y||0;this.z=z||0};Vector3.prototype={constructor:Vector3,set:function(x,y,z){this.x=x;this.y=y;this.z=z;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(v,w)}this.x*=v.x;this.y*=v.y;this.z*=v.z;return this},multiplyScalar:function(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;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},applyEuler:function(){var quaternion;return function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromEuler(euler));return this}}(),applyAxisAngle:function(){var quaternion;return function(axis,angle){if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromAxisAngle(axis,angle));return this}}(),applyMatrix3:function(m){var x=this.x;var y=this.y;var z=this.z;var e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this},applyMatrix4:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];return this},applyProjection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;var d=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*d;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*d;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*d;return this},applyQuaternion:function(q){var x=this.x;var y=this.y;var z=this.z;var qx=q.x;var qy=q.y;var qz=q.z;var qw=q.w;var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;this.x=ix*qw+iw*-qx+iy*-qz-iz*-qy;this.y=iy*qw+iw*-qy+iz*-qx-ix*-qz;this.z=iz*qw+iw*-qz+ix*-qy-iy*-qx;return this},project:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.projectionMatrix,matrix.getInverse(camera.matrixWorld));return this.applyProjection(matrix)}}(),unproject:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.matrixWorld,matrix.getInverse(camera.projectionMatrix));return this.applyProjection(matrix)}}(),transformDirection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;this.normalize();return this},divide:function(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar}else{this.x=0;this.y=0;this.z=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector3;max=new Vector3}min.set(minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},cross:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(v,w)}var x=this.x,y=this.y,z=this.z;this.x=y*v.z-z*v.y;this.y=z*v.x-x*v.z;this.z=x*v.y-y*v.x;return this},crossVectors:function(a,b){var ax=a.x,ay=a.y,az=a.z;var bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this},projectOnVector:function(){var v1,dot;return function(vector){if(v1===undefined)v1=new Vector3;v1.copy(vector).normalize();dot=this.dot(v1);return this.copy(v1).multiplyScalar(dot)}}(),projectOnPlane:function(){var v1;return function(planeNormal){if(v1===undefined)v1=new Vector3;v1.copy(this).projectOnVector(planeNormal);return this.sub(v1)}}(),reflect:function(){var v1;return function(normal){if(v1===undefined)v1=new Vector3;return this.sub(v1.copy(normal).multiplyScalar(2*this.dot(normal)))}}(),angleTo:function(v){var theta=this.dot(v)/(this.length()*v.length());return Math.acos(MathModule.Math.clamp(theta,-1,1))},distanceTo:function(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x;var dy=this.y-v.y;var dz=this.z-v.z;return dx*dx+dy*dy+dz*dz},setEulerFromRotationMatrix:function(m,order){Three.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(q,order){Three.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(m){Three.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(m)},getScaleFromMatrix:function(m){Three.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(m)},getColumnFromMatrix:function(index,matrix){Three.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(index,matrix)},setFromMatrixPosition:function(m){this.x=m.elements[12];this.y=m.elements[13];this.z=m.elements[14];return this},setFromMatrixScale:function(m){var sx=this.set(m.elements[0],m.elements[1],m.elements[2]).length();var sy=this.set(m.elements[4],m.elements[5],m.elements[6]).length();var sz=this.set(m.elements[8],m.elements[9],m.elements[10]).length();this.x=sx;this.y=sy;this.z=sz;return this},setFromMatrixColumn: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){return v.x===this.x&&v.y===this.y&&v.z===this.z},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];return this},clone:function(){return new Vector3(this.x,this.y,this.z)}};Vector3.prototype.isVector3=true;exports.Vector3=Vector3},{"../Three":1,"./Math":7,"./Matrix4":9,"./Quaternion":10}],14:[function(require,module,exports){var Three=require("../Three");var Vector4;Vector4=function(x,y,z,w){this.x=x||0;this.y=y||0;this.z=z||0;this.w=w!==undefined?w:1};Vector4.prototype={constructor:Vector4,set:function(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setW:function(w){this.w=w;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;this.w=v.w!==undefined?v.w:1;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;this.w+=v.w;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;this.w+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;this.w-=v.w;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;this.w-=s;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(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;this.w*=scalar;return this},applyMatrix4:function(m){var x=this.x;var y=this.y;var z=this.z;var w=this.w;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12]*w;this.y=e[1]*x+e[5]*y+e[9]*z+e[13]*w;this.z=e[2]*x+e[6]*y+e[10]*z+e[14]*w;this.w=e[3]*x+e[7]*y+e[11]*z+e[15]*w;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar;this.w*=invScalar}else{this.x=0;this.y=0;this.z=0;this.w=1}return this},setAxisAngleFromQuaternion:function(q){this.w=2*Math.acos(q.w);var s=Math.sqrt(1-q.w*q.w);if(s<1e-4){this.x=1;this.y=0;this.z=0}else{this.x=q.x/s;this.y=q.y/s;this.z=q.z/s}return this},setAxisAngleFromRotationMatrix:function(m){var angle,x,y,z,epsilon=.01,epsilon2=.1,te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(Math.abs(m12-m21)<epsilon&&Math.abs(m13-m31)<epsilon&&Math.abs(m23-m32)<epsilon){if(Math.abs(m12+m21)<epsilon2&&Math.abs(m13+m31)<epsilon2&&Math.abs(m23+m32)<epsilon2&&Math.abs(m11+m22+m33-3)<epsilon2){this.set(1,0,0,0);return this}angle=Math.PI;var xx=(m11+1)/2;var yy=(m22+1)/2;var zz=(m33+1)/2;var xy=(m12+m21)/4;var xz=(m13+m31)/4;var yz=(m23+m32)/4;if(xx>yy&&xx>zz){if(xx<epsilon){x=0;y=.707106781;z=.707106781}else{x=Math.sqrt(xx);y=xy/x;z=xz/x}}else if(yy>zz){if(yy<epsilon){x=.707106781;y=0;z=.707106781}else{y=Math.sqrt(yy);x=xy/y;z=yz/y}}else{if(zz<epsilon){x=.707106781;y=.707106781;z=0}else{z=Math.sqrt(zz);x=xz/z;y=yz/z}}this.set(x,y,z,angle);return this}var s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));if(Math.abs(s)<.001)s=1;this.x=(m32-m23)/s;this.y=(m13-m31)/s;this.z=(m21-m12)/s;this.w=Math.acos((m11+m22+m33-1)/2);return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}if(this.w>v.w){this.w=v.w}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}if(this.w<v.w){this.w=v.w}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}if(this.w<min.w){this.w=min.w}else if(this.w>max.w){this.w=max.w}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector4;max=new Vector4}min.set(minVal,minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;this.w+=(v.w-this.w)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this.w},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];this.w=array[offset+3];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;array[offset+3]=this.w;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];this.w=attribute.array[index+3];return this},clone:function(){return new Vector4(this.x,this.y,this.z,this.w)}};Vector4.prototype.isVector4=true;exports.Vector4=Vector4},{"../Three":1}],"three.cjs/extras/geometries/BoxGeometry":[function(require,module,exports){var Face3Module=require("../../core/Face3");var Vector2Module=require("../../math/Vector2");var Vector3Module=require("../../math/Vector3");var GeometryModule=require("../../core/Geometry");var BoxGeometry;BoxGeometry=function(width,height,depth,widthSegments,heightSegments,depthSegments){GeometryModule.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:width,height:height,depth:depth,widthSegments:widthSegments,heightSegments:heightSegments,depthSegments:depthSegments};this.widthSegments=widthSegments||1;this.heightSegments=heightSegments||1;this.depthSegments=depthSegments||1;var scope=this;var width_half=width/2;var height_half=height/2;var depth_half=depth/2;buildPlane("z","y",-1,-1,depth,height,width_half,0);buildPlane("z","y",1,-1,depth,height,-width_half,1);buildPlane("x","z",1,1,width,depth,height_half,2);buildPlane("x","z",1,-1,width,depth,-height_half,3);buildPlane("x","y",1,-1,width,height,depth_half,4);buildPlane("x","y",-1,-1,width,height,-depth_half,5);function buildPlane(u,v,udir,vdir,width,height,depth,materialIndex){var w,ix,iy,gridX=scope.widthSegments,gridY=scope.heightSegments,width_half=width/2,height_half=height/2,offset=scope.vertices.length;if(u==="x"&&v==="y"||u==="y"&&v==="x"){w="z"}else if(u==="x"&&v==="z"||u==="z"&&v==="x"){w="y";gridY=scope.depthSegments}else if(u==="z"&&v==="y"||u==="y"&&v==="z"){w="x";gridX=scope.depthSegments}var gridX1=gridX+1,gridY1=gridY+1,segment_width=width/gridX,segment_height=height/gridY,normal=new Vector3Module.Vector3;normal[w]=depth>0?1:-1;for(iy=0;iy<gridY1;iy++){for(ix=0;ix<gridX1;ix++){var vector=new Vector3Module.Vector3;vector[u]=(ix*segment_width-width_half)*udir;vector[v]=(iy*segment_height-height_half)*vdir;vector[w]=depth;scope.vertices.push(vector)}}for(iy=0;iy<gridY;iy++){for(ix=0;ix<gridX;ix++){var a=ix+gridX1*iy;var b=ix+gridX1*(iy+1);var c=ix+1+gridX1*(iy+1);var d=ix+1+gridX1*iy;var uva=new Vector2Module.Vector2(ix/gridX,1-iy/gridY);var uvb=new Vector2Module.Vector2(ix/gridX,1-(iy+1)/gridY);var uvc=new Vector2Module.Vector2((ix+1)/gridX,1-(iy+1)/gridY);var uvd=new Vector2Module.Vector2((ix+1)/gridX,1-iy/gridY);var face=new Face3Module.Face3(a+offset,b+offset,d+offset);face.normal.copy(normal);face.vertexNormals.push(normal.clone(),normal.clone(),normal.clone());face.materialIndex=materialIndex;scope.faces.push(face);scope.faceVertexUvs[0].push([uva,uvb,uvd]);face=new Face3Module.Face3(b+offset,c+offset,d+offset);face.normal.copy(normal);face.vertexNormals.push(normal.clone(),normal.clone(),normal.clone());face.materialIndex=materialIndex;scope.faces.push(face);scope.faceVertexUvs[0].push([uvb.clone(),uvc,uvd.clone()])}}}this.mergeVertices()};BoxGeometry.prototype=Object.create(GeometryModule.Geometry.prototype);BoxGeometry.prototype.constructor=BoxGeometry;BoxGeometry.prototype.isBoxGeometry=true;exports.BoxGeometry=BoxGeometry},{"../../core/Face3":3,"../../core/Geometry":4,"../../math/Vector2":12,"../../math/Vector3":13}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],3:[function(require,module,exports){var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Face3;var toString=Object.prototype.toString;var instance;Face3=function(a,b,c,normal,color,materialIndex){this.a=a;this.b=b;this.c=c;this.normal=!!(instance=normal)&&!!instance.isVector3?normal:new Vector3Module.Vector3;this.vertexNormals=toString.call(normal).slice(8,-1)==="Array"?normal:[];this.color=!!(instance=color)&&!!instance.isColor?color:new ColorModule.Color;this.vertexColors=toString.call(color).slice(8,-1)==="Array"?color:[];this.vertexTangents=[];this.materialIndex=materialIndex!==undefined?materialIndex:0};Face3.prototype={constructor:Face3,clone:function(){var face=new Face3(this.a,this.b,this.c);face.normal.copy(this.normal);face.color.copy(this.color);face.materialIndex=this.materialIndex;for(var i=0,il=this.vertexNormals.length;i<il;i++){face.vertexNormals[i]=this.vertexNormals[i].clone()}for(var i=0,il=this.vertexColors.length;i<il;i++){face.vertexColors[i]=this.vertexColors[i].clone()}for(var i=0,il=this.vertexTangents.length;i<il;i++){face.vertexTangents[i]=this.vertexTangents[i].clone()}return face}};Face3.prototype.isFace3=true;exports.Face3=Face3},{"../math/Color":9,"../math/Vector3":20}],4:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var SphereModule=require("../math/Sphere");var Box3Module=require("../math/Box3");var Vector4Module=require("../math/Vector4");var Matrix4Module=require("../math/Matrix4");var Face3Module=require("./Face3");var Vector2Module=require("../math/Vector2");var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Matrix3Module=require("../math/Matrix3");var MathModule=require("../math/Math");var Three=require("../Three");var Geometry;var instance;Geometry=function(){Object.defineProperty(this,"id",{value:Three.GeometryIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingBox=null;this.boundingSphere=null;this.hasTangents=false;this.dynamic=true;this.verticesNeedUpdate=false;this.elementsNeedUpdate=false;this.uvsNeedUpdate=false;this.normalsNeedUpdate=false;this.tangentsNeedUpdate=false;this.colorsNeedUpdate=false;this.lineDistancesNeedUpdate=false;this.groupsNeedUpdate=false};Geometry.prototype={constructor:Geometry,applyMatrix:function(matrix){var normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix);for(var i=0,il=this.vertices.length;i<il;i++){var vertex=this.vertices[i];vertex.applyMatrix4(matrix)}for(var i=0,il=this.faces.length;i<il;i++){var face=this.faces[i];face.normal.applyMatrix3(normalMatrix).normalize();for(var j=0,jl=face.vertexNormals.length;j<jl;j++){face.vertexNormals[j].applyMatrix3(normalMatrix).normalize()}}if(this.boundingBox!==null){this.computeBoundingBox()}if(this.boundingSphere!==null){this.computeBoundingSphere()}this.verticesNeedUpdate=true;this.normalsNeedUpdate=true},fromBufferGeometry:function(geometry){var scope=this;var attributes=geometry.attributes;var vertices=attributes.position.array;var indices=attributes.index!==undefined?attributes.index.array:undefined;var normals=attributes.normal!==undefined?attributes.normal.array:undefined;var colors=attributes.color!==undefined?attributes.color.array:undefined;var uvs=attributes.uv!==undefined?attributes.uv.array:undefined;var tempNormals=[];var tempUVs=[];for(var i=0,j=0;i<vertices.length;i+=3,j+=2){scope.vertices.push(new Vector3Module.Vector3(vertices[i],vertices[i+1],vertices[i+2]));if(normals!==undefined){tempNormals.push(new Vector3Module.Vector3(normals[i],normals[i+1],normals[i+2]))}if(colors!==undefined){scope.colors.push(new ColorModule.Color(colors[i],colors[i+1],colors[i+2]))}if(uvs!==undefined){tempUVs.push(new Vector2Module.Vector2(uvs[j],uvs[j+1]))}}var addFace=function(a,b,c){var vertexNormals=normals!==undefined?[tempNormals[a].clone(),tempNormals[b].clone(),tempNormals[c].clone()]:[];var vertexColors=colors!==undefined?[scope.colors[a].clone(),scope.colors[b].clone(),scope.colors[c].clone()]:[];scope.faces.push(new Face3Module.Face3(a,b,c,vertexNormals,vertexColors));if(uvs!==undefined){scope.faceVertexUvs[0].push([tempUVs[a].clone(),tempUVs[b].clone(),tempUVs[c].clone()])}};if(indices!==undefined){var drawcalls=geometry.drawcalls;if(drawcalls.length>0){for(var i=0;i<drawcalls.length;i++){var drawcall=drawcalls[i];var start=drawcall.start;var count=drawcall.count;var index=drawcall.index;for(var j=start,jl=start+count;j<jl;j+=3){addFace(index+indices[j],index+indices[j+1],index+indices[j+2])}}}else{for(var i=0;i<indices.length;i+=3){addFace(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0;i<vertices.length/3;i+=3){addFace(i,i+1,i+2)}}this.computeFaceNormals();if(geometry.boundingBox!==null){this.boundingBox=geometry.boundingBox.clone()}if(geometry.boundingSphere!==null){this.boundingSphere=geometry.boundingSphere.clone()}return this},center:function(){this.computeBoundingBox();var offset=this.boundingBox.center().negate();this.applyMatrix((new Matrix4Module.Matrix4).setPosition(offset));return offset},computeFaceNormals:function(){var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(var f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f];var vA=this.vertices[face.a];var vB=this.vertices[face.b];var vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);cb.normalize();face.normal.copy(cb)}},computeVertexNormals:function(areaWeighted){var v,vl,f,fl,face,vertices;vertices=new Array(this.vertices.length);for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v]=new Vector3Module.Vector3}if(areaWeighted){var vA,vB,vC;var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vA=this.vertices[face.a];vB=this.vertices[face.b];vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);vertices[face.a].add(cb);vertices[face.b].add(cb);vertices[face.c].add(cb)}}else{for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vertices[face.a].add(face.normal);vertices[face.b].add(face.normal);vertices[face.c].add(face.normal)}}for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v].normalize()}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.vertexNormals[0]=vertices[face.a].clone();face.vertexNormals[1]=vertices[face.b].clone();face.vertexNormals[2]=vertices[face.c].clone()}},computeMorphNormals:function(){var i,il,f,fl,face;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];if(!face.__originalFaceNormal){face.__originalFaceNormal=face.normal.clone()}else{face.__originalFaceNormal.copy(face.normal)}if(!face.__originalVertexNormals)face.__originalVertexNormals=[];for(i=0,il=face.vertexNormals.length;i<il;i++){if(!face.__originalVertexNormals[i]){face.__originalVertexNormals[i]=face.vertexNormals[i].clone()}else{face.__originalVertexNormals[i].copy(face.vertexNormals[i])}}}var tmpGeo=new Geometry;tmpGeo.faces=this.faces;for(i=0,il=this.morphTargets.length;i<il;i++){if(!this.morphNormals[i]){this.morphNormals[i]={};this.morphNormals[i].faceNormals=[];this.morphNormals[i].vertexNormals=[];var dstNormalsFace=this.morphNormals[i].faceNormals;var dstNormalsVertex=this.morphNormals[i].vertexNormals;var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){faceNormal=new Vector3Module.Vector3;vertexNormals={a:new Vector3Module.Vector3,b:new Vector3Module.Vector3,c:new Vector3Module.Vector3};dstNormalsFace.push(faceNormal);dstNormalsVertex.push(vertexNormals)}}var morphNormals=this.morphNormals[i];tmpGeo.vertices=this.morphTargets[i].vertices;tmpGeo.computeFaceNormals();tmpGeo.computeVertexNormals();var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];faceNormal=morphNormals.faceNormals[f];vertexNormals=morphNormals.vertexNormals[f];faceNormal.copy(face.normal);vertexNormals.a.copy(face.vertexNormals[0]);vertexNormals.b.copy(face.vertexNormals[1]);vertexNormals.c.copy(face.vertexNormals[2])}}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.normal=face.__originalFaceNormal;face.vertexNormals=face.__originalVertexNormals}},computeTangents:function(){var f,fl,v,vl,i,vertexIndex,face,uv,vA,vB,vC,uvA,uvB,uvC,x1,x2,y1,y2,z1,z2,s1,s2,t1,t2,r,t,test,tan1=[],tan2=[],sdir=new Vector3Module.Vector3,tdir=new Vector3Module.Vector3,tmp=new Vector3Module.Vector3,tmp2=new Vector3Module.Vector3,n=new Vector3Module.Vector3,w;for(v=0,vl=this.vertices.length;v<vl;v++){tan1[v]=new Vector3Module.Vector3;tan2[v]=new Vector3Module.Vector3}function handleTriangle(context,a,b,c,ua,ub,uc){vA=context.vertices[a];vB=context.vertices[b];vC=context.vertices[c];uvA=uv[ua];uvB=uv[ub];uvC=uv[uc];x1=vB.x-vA.x;x2=vC.x-vA.x;y1=vB.y-vA.y;y2=vC.y-vA.y;z1=vB.z-vA.z;z2=vC.z-vA.z;s1=uvB.x-uvA.x;s2=uvC.x-uvA.x;t1=uvB.y-uvA.y;t2=uvC.y-uvA.y;r=1/(s1*t2-s2*t1);sdir.set((t2*x1-t1*x2)*r,(t2*y1-t1*y2)*r,(t2*z1-t1*z2)*r);tdir.set((s1*x2-s2*x1)*r,(s1*y2-s2*y1)*r,(s1*z2-s2*z1)*r);tan1[a].add(sdir);tan1[b].add(sdir);tan1[c].add(sdir);tan2[a].add(tdir);tan2[b].add(tdir);tan2[c].add(tdir)}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];uv=this.faceVertexUvs[0][f];handleTriangle(this,face.a,face.b,face.c,0,1,2)}var faceIndex=["a","b","c","d"];for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];for(i=0;i<Math.min(face.vertexNormals.length,3);i++){n.copy(face.vertexNormals[i]);vertexIndex=face[faceIndex[i]];t=tan1[vertexIndex];tmp.copy(t);tmp.sub(n.multiplyScalar(n.dot(t))).normalize();tmp2.crossVectors(face.vertexNormals[i],t);test=tmp2.dot(tan2[vertexIndex]);w=test<0?-1:1;face.vertexTangents[i]=new Vector4Module.Vector4(tmp.x,tmp.y,tmp.z,w)}}this.hasTangents=true},computeLineDistances:function(){var d=0;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){if(i>0){d+=vertices[i].distanceTo(vertices[i-1])}this.lineDistances[i]=d}},computeBoundingBox:function(){if(this.boundingBox===null){this.boundingBox=new Box3Module.Box3}this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){if(this.boundingSphere===null){this.boundingSphere=new SphereModule.Sphere}this.boundingSphere.setFromPoints(this.vertices)},merge:function(geometry,matrix,materialIndexOffset){if((!!(instance=geometry)&&!!instance.isGeometry)===false){Three.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",geometry);return}var normalMatrix,vertexOffset=this.vertices.length,vertices1=this.vertices,vertices2=geometry.vertices,faces1=this.faces,faces2=geometry.faces,uvs1=this.faceVertexUvs[0],uvs2=geometry.faceVertexUvs[0];if(materialIndexOffset===undefined)materialIndexOffset=0;if(matrix!==undefined){normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix)}for(var i=0,il=vertices2.length;i<il;i++){var vertex=vertices2[i];var vertexCopy=vertex.clone();if(matrix!==undefined)vertexCopy.applyMatrix4(matrix);vertices1.push(vertexCopy)}for(i=0,il=faces2.length;i<il;i++){var face=faces2[i],faceCopy,normal,color,faceVertexNormals=face.vertexNormals,faceVertexColors=face.vertexColors;faceCopy=new Face3Module.Face3(face.a+vertexOffset,face.b+vertexOffset,face.c+vertexOffset);faceCopy.normal.copy(face.normal);if(normalMatrix!==undefined){faceCopy.normal.applyMatrix3(normalMatrix).normalize()}for(var j=0,jl=faceVertexNormals.length;j<jl;j++){normal=faceVertexNormals[j].clone();if(normalMatrix!==undefined){normal.applyMatrix3(normalMatrix).normalize()}faceCopy.vertexNormals.push(normal)}faceCopy.color.copy(face.color);for(var j=0,jl=faceVertexColors.length;j<jl;j++){color=faceVertexColors[j];faceCopy.vertexColors.push(color.clone())}faceCopy.materialIndex=face.materialIndex+materialIndexOffset;faces1.push(faceCopy)}for(i=0,il=uvs2.length;i<il;i++){var uv=uvs2[i],uvCopy=[];if(uv===undefined){continue}for(var j=0,jl=uv.length;j<jl;j++){uvCopy.push(uv[j].clone())}uvs1.push(uvCopy)}},mergeMesh:function(mesh){if((!!(instance=mesh)&&!!instance.isMesh)===false){Three.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",mesh);return}mesh.matrixAutoUpdate&&mesh.updateMatrix();this.merge(mesh.geometry,mesh.matrix)},mergeVertices:function(){var verticesMap={};var unique=[],changes=[];var v,key;var precisionPoints=4;var precision=Math.pow(10,precisionPoints);var i,il,face;var indices,j,jl;for(i=0,il=this.vertices.length;i<il;i++){v=this.vertices[i];key=Math.round(v.x*precision)+"_"+Math.round(v.y*precision)+"_"+Math.round(v.z*precision);if(verticesMap[key]===undefined){verticesMap[key]=i;unique.push(this.vertices[i]);changes[i]=unique.length-1}else{changes[i]=changes[verticesMap[key]]}}var faceIndicesToRemove=[];for(i=0,il=this.faces.length;i<il;i++){face=this.faces[i];face.a=changes[face.a];face.b=changes[face.b];face.c=changes[face.c];indices=[face.a,face.b,face.c];var dupIndex=-1;for(var n=0;n<3;n++){if(indices[n]==indices[(n+1)%3]){dupIndex=n;faceIndicesToRemove.push(i);break}}}for(i=faceIndicesToRemove.length-1;i>=0;i--){var idx=faceIndicesToRemove[i];this.faces.splice(idx,1);for(j=0,jl=this.faceVertexUvs.length;j<jl;j++){this.faceVertexUvs[j].splice(idx,1)}}var diff=this.vertices.length-unique.length;this.vertices=unique;return diff},toJSON:function(){var output={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(this.parameters!==undefined){var parameters=this.parameters;for(var key in parameters){if(parameters[key]!==undefined)output[key]=parameters[key]}return output}var vertices=[];for(var i=0;i<this.vertices.length;i++){var vertex=this.vertices[i];vertices.push(vertex.x,vertex.y,vertex.z)}var faces=[];var normals=[];var normalsHash={};var colors=[];var colorsHash={};var uvs=[];var uvsHash={};for(var i=0;i<this.faces.length;i++){var face=this.faces[i];var hasMaterial=false;var hasFaceUv=false;var hasFaceVertexUv=this.faceVertexUvs[0][i]!==undefined;var hasFaceNormal=face.normal.length()>0;var hasFaceVertexNormal=face.vertexNormals.length>0;var hasFaceColor=face.color.r!==1||face.color.g!==1||face.color.b!==1;var hasFaceVertexColor=face.vertexColors.length>0;var faceType=0;faceType=setBit(faceType,0,0);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);faces.push(faceType);faces.push(face.a,face.b,face.c);if(hasFaceVertexUv){var faceVertexUvs=this.faceVertexUvs[0][i];faces.push(getUvIndex(faceVertexUvs[0]),getUvIndex(faceVertexUvs[1]),getUvIndex(faceVertexUvs[2]))}if(hasFaceNormal){faces.push(getNormalIndex(face.normal))}if(hasFaceVertexNormal){var vertexNormals=face.vertexNormals;faces.push(getNormalIndex(vertexNormals[0]),getNormalIndex(vertexNormals[1]),getNormalIndex(vertexNormals[2]))}if(hasFaceColor){faces.push(getColorIndex(face.color))}if(hasFaceVertexColor){var vertexColors=face.vertexColors;faces.push(getColorIndex(vertexColors[0]),getColorIndex(vertexColors[1]),getColorIndex(vertexColors[2]))}}function setBit(value,position,enabled){return enabled?value|1<<position:value&~(1<<position)}function getNormalIndex(normal){var hash=normal.x.toString()+normal.y.toString()+normal.z.toString();if(normalsHash[hash]!==undefined){return normalsHash[hash]}normalsHash[hash]=normals.length/3;normals.push(normal.x,normal.y,normal.z);return normalsHash[hash]}function getColorIndex(color){var hash=color.r.toString()+color.g.toString()+color.b.toString();if(colorsHash[hash]!==undefined){return colorsHash[hash]}colorsHash[hash]=colors.length;colors.push(color.getHex());return colorsHash[hash]}function getUvIndex(uv){var hash=uv.x.toString()+uv.y.toString();if(uvsHash[hash]!==undefined){return uvsHash[hash]}uvsHash[hash]=uvs.length/2;uvs.push(uv.x,uv.y);return uvsHash[hash]}output.data={};output.data.vertices=vertices;output.data.normals=normals;if(colors.length>0)output.data.colors=colors;if(uvs.length>0)output.data.uvs=[uvs];output.data.faces=faces;return output},clone:function(){var geometry=new Geometry;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){geometry.vertices.push(vertices[i].clone())}var faces=this.faces;for(var i=0,il=faces.length;i<il;i++){geometry.faces.push(faces[i].clone())}for(var i=0,il=this.faceVertexUvs.length;i<il;i++){var faceVertexUvs=this.faceVertexUvs[i];if(geometry.faceVertexUvs[i]===undefined){geometry.faceVertexUvs[i]=[]}for(var j=0,jl=faceVertexUvs.length;j<jl;j++){var uvs=faceVertexUvs[j],uvsCopy=[];for(var k=0,kl=uvs.length;k<kl;k++){var uv=uvs[k];uvsCopy.push(uv.clone())}geometry.faceVertexUvs[i].push(uvsCopy)}}return geometry},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Geometry.prototype);Geometry.prototype.isGeometry=true;exports.Geometry=Geometry},{"../Three":1,"../math/Box3":8,"../math/Color":9,"../math/Math":11,"../math/Matrix3":12,"../math/Matrix4":13,"../math/Sphere":17,"../math/Vector2":19,"../math/Vector3":20,"../math/Vector4":21,"./EventDispatcher":2,"./Face3":3}],5:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var Matrix4Module=require("../math/Matrix4");var QuaternionModule=require("../math/Quaternion");var EulerModule=require("../math/Euler");var Vector3Module=require("../math/Vector3");var MathModule=require("../math/Math");var Three=require("../Three");var Object3D;var instance;Object3D=function(){Object.defineProperty(this,"id",{value:Three.Object3DIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Object3D";this.parent=undefined;this.children=[];this.up=Object3D.DefaultUp.clone();var position=new Vector3Module.Vector3;var rotation=new EulerModule.Euler;var quaternion=new QuaternionModule.Quaternion;var scale=new Vector3Module.Vector3(1,1,1);var onRotationChange=function(){quaternion.setFromEuler(rotation,false)};var onQuaternionChange=function(){rotation.setFromQuaternion(quaternion,undefined,false)};rotation.onChange(onRotationChange);quaternion.onChange(onQuaternionChange);Object.defineProperties(this,{position:{enumerable:true,value:position},rotation:{enumerable:true,value:rotation},quaternion:{enumerable:true,value:quaternion},scale:{enumerable:true,value:scale}});this.rotationAutoUpdate=true;this.matrix=new Matrix4Module.Matrix4;this.matrixWorld=new Matrix4Module.Matrix4;this.matrixAutoUpdate=true;this.matrixWorldNeedsUpdate=false;this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.userData={}};Object3D.DefaultUp=new Vector3Module.Vector3(0,1,0);Object3D.prototype={constructor:Object3D,get eulerOrder(){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(value){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=value},get useQuaternion(){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(value){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(matrix){this.matrix.multiplyMatrices(matrix,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(axis,angle){this.quaternion.setFromAxisAngle(axis,angle)},setRotationFromEuler:function(euler){this.quaternion.setFromEuler(euler,true)},setRotationFromMatrix:function(m){this.quaternion.setFromRotationMatrix(m)},setRotationFromQuaternion:function(q){this.quaternion.copy(q)},rotateOnAxis:function(){var q1=new QuaternionModule.Quaternion;return function(axis,angle){q1.setFromAxisAngle(axis,angle);this.quaternion.multiply(q1);return this}}(),rotateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(angle){return this.rotateOnAxis(v1,angle)}}(),translateOnAxis:function(){var v1=new Vector3Module.Vector3;return function(axis,distance){v1.copy(axis).applyQuaternion(this.quaternion);this.position.add(v1.multiplyScalar(distance));return this}}(),translate:function(distance,axis){Three.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(axis,distance)},translateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(distance){return this.translateOnAxis(v1,distance)}}(),localToWorld:function(vector){return vector.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var m1=new Matrix4Module.Matrix4;return function(vector){return vector.applyMatrix4(m1.getInverse(this.matrixWorld))}}(),lookAt:function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(vector,this.position,this.up);this.quaternion.setFromRotationMatrix(m1)}}(),add:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.add(arguments[i])}return this}if(object===this){Three.error("THREE.Object3D.add: object can't be added as a child of itself.",object);return this}if(!!(instance=object)&&!!instance.isObject3D){if(object.parent!==undefined){object.parent.remove(object)}object.parent=this;object.dispatchEvent({type:"added"});this.children.push(object)}else{Three.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",object)}return this},remove:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.remove(arguments[i])}}var index=this.children.indexOf(object);if(index!==-1){object.parent=undefined;object.dispatchEvent({type:"removed"});this.children.splice(index,1)}},getChildByName:function(name){Three.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(name)},getObjectById:function(id){return this.getObjectByProperty("id",id)},getObjectByName:function(name){return this.getObjectByProperty("name",name)},getObjectByProperty:function(name,value){if(this[name]===value)return this;for(var i=0,l=this.children.length;i<l;i++){var child=this.children[i];var object=child.getObjectByProperty(name,value);if(object!==undefined){return object}}return undefined},getWorldPosition:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);return result.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var position=new Vector3Module.Vector3;var scale=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new QuaternionModule.Quaternion;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,result,scale);return result}}(),getWorldRotation:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new EulerModule.Euler;this.getWorldQuaternion(quaternion);return result.setFromQuaternion(quaternion,this.rotation.order,false)}}(),getWorldScale:function(){var position=new Vector3Module.Vector3;var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,quaternion,result);return result}}(),getWorldDirection:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,1).applyQuaternion(quaternion)}}(),raycast:function(){},traverse:function(callback){callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverse(callback)}},traverseVisible:function(callback){if(this.visible===false)return;callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverseVisible(callback)}},traverseAncestors:function(callback){if(this.parent){callback(this.parent);this.parent.traverseAncestors(callback)}},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(force){if(this.matrixAutoUpdate===true)this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||force===true){if(this.parent===undefined){this.matrixWorld.copy(this.matrix)}else{this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)}this.matrixWorldNeedsUpdate=false;force=true}for(var i=0,l=this.children.length;i<l;i++){this.children[i].updateMatrixWorld(force)}},toJSON:function(){var output={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}};var geometries={};var parseGeometry=function(geometry){if(output.geometries===undefined){output.geometries=[]}if(geometries[geometry.uuid]===undefined){var json=geometry.toJSON();delete json.metadata;geometries[geometry.uuid]=json;output.geometries.push(json)}return geometry.uuid};var materials={};var parseMaterial=function(material){if(output.materials===undefined){output.materials=[]}if(materials[material.uuid]===undefined){var json=material.toJSON();delete json.metadata;materials[material.uuid]=json;output.materials.push(json)}return material.uuid};var parseObject=function(object){var data={};data.uuid=object.uuid;data.type=object.type;if(object.name!=="")data.name=object.name;if(JSON.stringify(object.userData)!=="{}")data.userData=object.userData;if(object.visible!==true)data.visible=object.visible;if(!!(instance=object)&&!!instance.isPerspectiveCamera){data.fov=object.fov;data.aspect=object.aspect;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isOrthographicCamera){data.left=object.left;data.right=object.right;data.top=object.top;data.bottom=object.bottom;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isAmbientLight){data.color=object.color.getHex()}else if(!!(instance=object)&&!!instance.isDirectionalLight){data.color=object.color.getHex();data.intensity=object.intensity}else if(!!(instance=object)&&!!instance.isPointLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isSpotLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.angle=object.angle;data.exponent=object.exponent;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isHemisphereLight){data.color=object.color.getHex();data.groundColor=object.groundColor.getHex()}else if(!!(instance=object)&&!!instance.isMesh||!!(instance=object)&&!!instance.isLine||!!(instance=object)&&!!instance.isPointCloud){data.geometry=parseGeometry(object.geometry);data.material=parseMaterial(object.material);if(!!(instance=object)&&!!instance.isLine)data.mode=object.mode}else if(!!(instance=object)&&!!instance.isSprite){data.material=parseMaterial(object.material)}data.matrix=object.matrix.toArray();if(object.children.length>0){data.children=[];for(var i=0;i<object.children.length;i++){data.children.push(parseObject(object.children[i]))}}return data};output.object=parseObject(this);return output},clone:function(object,recursive){if(object===undefined)object=new Object3D;if(recursive===undefined)recursive=true;object.name=this.name;object.up.copy(this.up);object.position.copy(this.position);object.quaternion.copy(this.quaternion);object.scale.copy(this.scale);object.rotationAutoUpdate=this.rotationAutoUpdate;object.matrix.copy(this.matrix);object.matrixWorld.copy(this.matrixWorld);object.matrixAutoUpdate=this.matrixAutoUpdate;object.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;object.visible=this.visible;object.castShadow=this.castShadow;object.receiveShadow=this.receiveShadow;object.frustumCulled=this.frustumCulled;object.userData=JSON.parse(JSON.stringify(this.userData));if(recursive===true){for(var i=0;i<this.children.length;i++){var child=this.children[i];object.add(child.clone())}}return object}};EventDispatcherModule.EventDispatcher.prototype.apply(Object3D.prototype);Object3D.prototype.isObject3D=true;exports.Object3D=Object3D;
},{"../Three":1,"../math/Euler":10,"../math/Math":11,"../math/Matrix4":13,"../math/Quaternion":15,"../math/Vector3":20,"./EventDispatcher":2}],6:[function(require,module,exports){var EventDispatcherModule=require("../core/EventDispatcher");var MathModule=require("../math/Math");var Three=require("../Three");var Material;var instance;Material=function(){Object.defineProperty(this,"id",{value:Three.MaterialIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Material";this.side=Three.FrontSide;this.opacity=1;this.transparent=false;this.blending=Three.NormalBlending;this.blendSrc=Three.SrcAlphaFactor;this.blendDst=Three.OneMinusSrcAlphaFactor;this.blendEquation=Three.AddEquation;this.blendSrcAlpha=null;this.blendDstAlpha=null;this.blendEquationAlpha=null;this.depthTest=true;this.depthWrite=true;this.colorWrite=true;this.polygonOffset=false;this.polygonOffsetFactor=0;this.polygonOffsetUnits=0;this.alphaTest=0;this.overdraw=0;this.visible=true;this._needsUpdate=true};Material.prototype={constructor:Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(value){if(value===true)this.update();this._needsUpdate=value},setValues:function(values){if(values===undefined)return;for(var key in values){var newValue=values[key];if(newValue===undefined){Three.warn("THREE.Material: '"+key+"' parameter is undefined.");continue}if(key in this){var currentValue=this[key];if(!!(instance=currentValue)&&!!instance.isColor){currentValue.set(newValue)}else if(!!(instance=currentValue)&&!!instance.isVector3&&(!!(instance=newValue)&&!!instance.isVector3)){currentValue.copy(newValue)}else if(key=="overdraw"){this[key]=Number(newValue)}else{this[key]=newValue}}}},toJSON:function(){var output={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(!!(instance=this)&&!!instance.isMeshBasicMaterial){output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshLambertMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshPhongMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();output.specular=this.specular.getHex();output.shininess=this.shininess;if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshNormalMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshDepthMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isPointCloudMaterial){output.size=this.size;output.sizeAttenuation=this.sizeAttenuation;output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending}else if(!!(instance=this)&&!!instance.isShaderMaterial){output.uniforms=this.uniforms;output.vertexShader=this.vertexShader;output.fragmentShader=this.fragmentShader}else if(!!(instance=this)&&!!instance.isSpriteMaterial){output.color=this.color.getHex()}if(this.opacity<1)output.opacity=this.opacity;if(this.transparent!==false)output.transparent=this.transparent;if(this.wireframe!==false)output.wireframe=this.wireframe;return output},clone:function(material){if(material===undefined)material=new Material;material.name=this.name;material.side=this.side;material.opacity=this.opacity;material.transparent=this.transparent;material.blending=this.blending;material.blendSrc=this.blendSrc;material.blendDst=this.blendDst;material.blendEquation=this.blendEquation;material.blendSrcAlpha=this.blendSrcAlpha;material.blendDstAlpha=this.blendDstAlpha;material.blendEquationAlpha=this.blendEquationAlpha;material.depthTest=this.depthTest;material.depthWrite=this.depthWrite;material.polygonOffset=this.polygonOffset;material.polygonOffsetFactor=this.polygonOffsetFactor;material.polygonOffsetUnits=this.polygonOffsetUnits;material.alphaTest=this.alphaTest;material.overdraw=this.overdraw;material.visible=this.visible;return material},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Material.prototype);Material.prototype.isMaterial=true;exports.Material=Material},{"../Three":1,"../core/EventDispatcher":2,"../math/Math":11}],7:[function(require,module,exports){var Three=require("../Three");var ColorModule=require("../math/Color");var MaterialModule=require("./Material");var MeshBasicMaterial;MeshBasicMaterial=function(parameters){MaterialModule.Material.call(this);this.type="MeshBasicMaterial";this.color=new ColorModule.Color(16777215);this.map=null;this.lightMap=null;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.combine=Three.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=true;this.shading=Three.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap="round";this.wireframeLinejoin="round";this.vertexColors=Three.NoColors;this.skinning=false;this.morphTargets=false;this.setValues(parameters)};MeshBasicMaterial.prototype=Object.create(MaterialModule.Material.prototype);MeshBasicMaterial.prototype.constructor=MeshBasicMaterial;MeshBasicMaterial.prototype.clone=function(){var material=new MeshBasicMaterial;MaterialModule.Material.prototype.clone.call(this,material);material.color.copy(this.color);material.map=this.map;material.lightMap=this.lightMap;material.specularMap=this.specularMap;material.alphaMap=this.alphaMap;material.envMap=this.envMap;material.combine=this.combine;material.reflectivity=this.reflectivity;material.refractionRatio=this.refractionRatio;material.fog=this.fog;material.shading=this.shading;material.wireframe=this.wireframe;material.wireframeLinewidth=this.wireframeLinewidth;material.wireframeLinecap=this.wireframeLinecap;material.wireframeLinejoin=this.wireframeLinejoin;material.vertexColors=this.vertexColors;material.skinning=this.skinning;material.morphTargets=this.morphTargets;return material};MeshBasicMaterial.prototype.isMeshBasicMaterial=true;exports.MeshBasicMaterial=MeshBasicMaterial},{"../Three":1,"../math/Color":9,"./Material":6}],8:[function(require,module,exports){var SphereModule,getSphereModule=function(){return SphereModule=require("./Sphere")};var Vector3Module=require("./Vector3");var Box3;var instance;Box3=function(min,max){this.min=min!==undefined?min:new Vector3Module.Vector3(Infinity,Infinity,Infinity);this.max=max!==undefined?max:new Vector3Module.Vector3(-Infinity,-Infinity,-Infinity)};Box3.prototype={constructor:Box3,set:function(min,max){this.min.copy(min);this.max.copy(max);return this},setFromPoints:function(points){this.makeEmpty();for(var i=0,il=points.length;i<il;i++){this.expandByPoint(points[i])}return this},setFromCenterAndSize:function(){var v1=new Vector3Module.Vector3;return function(center,size){var halfSize=v1.copy(size).multiplyScalar(.5);this.min.copy(center).sub(halfSize);this.max.copy(center).add(halfSize);return this}}(),setFromObject:function(){var v1=new Vector3Module.Vector3;return function(object){var scope=this;object.updateMatrixWorld(true);this.makeEmpty();object.traverse(function(node){var geometry=node.geometry;if(geometry!==undefined){if(!!(instance=geometry)&&!!instance.isGeometry){var vertices=geometry.vertices;for(var i=0,il=vertices.length;i<il;i++){v1.copy(vertices[i]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}else if(!!(instance=geometry)&&!!instance.isBufferGeometry&&geometry.attributes["position"]!==undefined){var positions=geometry.attributes["position"].array;for(var i=0,il=positions.length;i<il;i+=3){v1.set(positions[i],positions[i+1],positions[i+2]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}}});return this}}(),copy:function(box){this.min.copy(box.min);this.max.copy(box.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(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.subVectors(this.max,this.min)},expandByPoint:function(point){this.min.min(point);this.max.max(point);return this},expandByVector:function(vector){this.min.sub(vector);this.max.add(vector);return this},expandByScalar:function(scalar){this.min.addScalar(-scalar);this.max.addScalar(scalar);return this},containsPoint:function(point){if(point.x<this.min.x||point.x>this.max.x||point.y<this.min.y||point.y>this.max.y||point.z<this.min.z||point.z>this.max.z){return false}return true},containsBox:function(box){if(this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<=box.min.z&&box.max.z<=this.max.z){return true}return false},getParameter:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.set((point.x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min.y),(point.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(box){if(box.max.x<this.min.x||box.min.x>this.max.x||box.max.y<this.min.y||box.min.y>this.max.y||box.max.z<this.min.z||box.min.z>this.max.z){return false}return true},clampPoint:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(point).clamp(this.min,this.max)},distanceToPoint:function(){var v1=new Vector3Module.Vector3;return function(point){var clampedPoint=v1.copy(point).clamp(this.min,this.max);return clampedPoint.sub(point).length()}}(),getBoundingSphere:function(){var v1=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new((SphereModule||getSphereModule()).Sphere);result.center=this.center();result.radius=this.size(v1).length()*.5;return result}}(),intersect:function(box){this.min.max(box.min);this.max.min(box.max);return this},union:function(box){this.min.min(box.min);this.max.max(box.max);return this},applyMatrix4:function(){var points=[new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3];return function(matrix){points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix);points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix);points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix);points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix);points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix);points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix);points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix);points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix);this.makeEmpty();this.setFromPoints(points);return this}}(),translate:function(offset){this.min.add(offset);this.max.add(offset);return this},equals:function(box){return box.min.equals(this.min)&&box.max.equals(this.max)},clone:function(){return(new Box3).copy(this)}};Box3.prototype.isBox3=true;exports.Box3=Box3},{"./Sphere":17,"./Vector3":20}],9:[function(require,module,exports){var ColorKeywords;var Color;var instance;Color=function(color){if(arguments.length===3){return this.setRGB(arguments[0],arguments[1],arguments[2])}return this.set(color)};Color.prototype={constructor:Color,r:1,g:1,b:1,set:function(value){if(!!(instance=value)&&!!instance.isColor){this.copy(value)}else if(typeof value==="number"){this.setHex(value)}else if(typeof value==="string"){this.setStyle(value)}return this},setHex:function(hex){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this},setRGB:function(r,g,b){this.r=r;this.g=g;this.b=b;return this},setHSL:function(h,s,l){if(s===0){this.r=this.g=this.b=l}else{var hue2rgb=function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*6*(2/3-t);return p};var p=l<=.5?l*(1+s):l+s-l*s;var q=2*l-p;this.r=hue2rgb(q,p,h+1/3);this.g=hue2rgb(q,p,h);this.b=hue2rgb(q,p,h-1/3)}return this},setStyle:function(style){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(style)){var color=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(style);this.r=Math.min(255,parseInt(color[1],10))/255;this.g=Math.min(255,parseInt(color[2],10))/255;this.b=Math.min(255,parseInt(color[3],10))/255;return this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(style)){var color=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(style);this.r=Math.min(100,parseInt(color[1],10))/100;this.g=Math.min(100,parseInt(color[2],10))/100;this.b=Math.min(100,parseInt(color[3],10))/100;return this}if(/^\#([0-9a-f]{6})$/i.test(style)){var color=/^\#([0-9a-f]{6})$/i.exec(style);this.setHex(parseInt(color[1],16));return this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(style)){var color=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(style);this.setHex(parseInt(color[1]+color[1]+color[2]+color[2]+color[3]+color[3],16));return this}if(/^(\w+)$/i.test(style)){this.setHex(ColorKeywords[style]);return this}},copy:function(color){this.r=color.r;this.g=color.g;this.b=color.b;return this},copyGammaToLinear:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;this.r=Math.pow(color.r,gammaFactor);this.g=Math.pow(color.g,gammaFactor);this.b=Math.pow(color.b,gammaFactor);return this},copyLinearToGamma:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;var safeInverse=gammaFactor>0?1/gammaFactor:1;this.r=Math.pow(color.r,safeInverse);this.g=Math.pow(color.g,safeInverse);this.b=Math.pow(color.b,safeInverse);return this},convertGammaToLinear:function(){var r=this.r,g=this.g,b=this.b;this.r=r*r;this.g=g*g;this.b=b*b;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 this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(optionalTarget){var hsl=optionalTarget||{h:0,s:0,l:0};var r=this.r,g=this.g,b=this.b;var max=Math.max(r,g,b);var min=Math.min(r,g,b);var hue,saturation;var lightness=(min+max)/2;if(min===max){hue=0;saturation=0}else{var delta=max-min;saturation=lightness<=.5?delta/(max+min):delta/(2-max-min);switch(max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4;break}hue/=6}hsl.h=hue;hsl.s=saturation;hsl.l=lightness;return hsl},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(h,s,l){var hsl=this.getHSL();hsl.h+=h;hsl.s+=s;hsl.l+=l;this.setHSL(hsl.h,hsl.s,hsl.l);return this},add:function(color){this.r+=color.r;this.g+=color.g;this.b+=color.b;return this},addColors:function(color1,color2){this.r=color1.r+color2.r;this.g=color1.g+color2.g;this.b=color1.b+color2.b;return this},addScalar:function(s){this.r+=s;this.g+=s;this.b+=s;return this},multiply:function(color){this.r*=color.r;this.g*=color.g;this.b*=color.b;return this},multiplyScalar:function(s){this.r*=s;this.g*=s;this.b*=s;return this},lerp:function(color,alpha){this.r+=(color.r-this.r)*alpha;this.g+=(color.g-this.g)*alpha;this.b+=(color.b-this.b)*alpha;return this},equals:function(c){return c.r===this.r&&c.g===this.g&&c.b===this.b},fromArray:function(array){this.r=array[0];this.g=array[1];this.b=array[2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.r;array[offset+1]=this.g;array[offset+2]=this.b;return array},clone:function(){return(new Color).setRGB(this.r,this.g,this.b)}};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};Color.prototype.isColor=true;exports.Color=Color;exports.ColorKeywords=ColorKeywords},{}],10:[function(require,module,exports){var Vector3Module=require("./Vector3");var QuaternionModule=require("./Quaternion");var Matrix4Module=require("./Matrix4");var Three=require("../Three");var MathModule=require("./Math");var Euler;Euler=function(x,y,z,order){this._x=x||0;this._y=y||0;this._z=z||0;this._order=order||Euler.DefaultOrder};Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Euler.DefaultOrder="XYZ";Euler.prototype={constructor:Euler,_x:0,_y:0,_z:0,_order:Euler.DefaultOrder,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get order(){return this._order},set order(value){this._order=value;this.onChangeCallback()},set:function(x,y,z,order){this._x=x;this._y=y;this._z=z;this._order=order||this._order;this.onChangeCallback();return this},copy:function(euler){this._x=euler._x;this._y=euler._y;this._z=euler._z;this._order=euler._order;this.onChangeCallback();return this},setFromRotationMatrix:function(m,order,update){var clamp=MathModule.Math.clamp;var te=m.elements;var m11=te[0],m12=te[4],m13=te[8];var m21=te[1],m22=te[5],m23=te[9];var m31=te[2],m32=te[6],m33=te[10];order=order||this._order;if(order==="XYZ"){this._y=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<.99999){this._x=Math.atan2(-m23,m33);this._z=Math.atan2(-m12,m11)}else{this._x=Math.atan2(m32,m22);this._z=0}}else if(order==="YXZ"){this._x=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<.99999){this._y=Math.atan2(m13,m33);this._z=Math.atan2(m21,m22)}else{this._y=Math.atan2(-m31,m11);this._z=0}}else if(order==="ZXY"){this._x=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<.99999){this._y=Math.atan2(-m31,m33);this._z=Math.atan2(-m12,m22)}else{this._y=0;this._z=Math.atan2(m21,m11)}}else if(order==="ZYX"){this._y=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<.99999){this._x=Math.atan2(m32,m33);this._z=Math.atan2(m21,m11)}else{this._x=0;this._z=Math.atan2(-m12,m22)}}else if(order==="YZX"){this._z=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<.99999){this._x=Math.atan2(-m23,m22);this._y=Math.atan2(-m31,m11)}else{this._x=0;this._y=Math.atan2(m13,m33)}}else if(order==="XZY"){this._z=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<.99999){this._x=Math.atan2(m32,m22);this._y=Math.atan2(m13,m11)}else{this._x=Math.atan2(-m23,m33);this._y=0}}else{Three.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+order)}this._order=order;if(update!==false)this.onChangeCallback();return this},setFromQuaternion:function(){var matrix;return function(q,order,update){if(matrix===undefined)matrix=new Matrix4Module.Matrix4;matrix.makeRotationFromQuaternion(q);this.setFromRotationMatrix(matrix,order,update);return this}}(),setFromVector3:function(v,order){return this.set(v.x,v.y,v.z,order||this._order)},reorder:function(){var q=new QuaternionModule.Quaternion;return function(newOrder){q.setFromEuler(this);this.setFromQuaternion(q,newOrder)}}(),equals:function(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order},fromArray:function(array){this._x=array[0];this._y=array[1];this._z=array[2];if(array[3]!==undefined)this._order=array[3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._order;return array},toVector3:function(optionalResult){if(optionalResult){return optionalResult.set(this._x,this._y,this._z)}else{return new Vector3Module.Vector3(this._x,this._y,this._z)}},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Euler(this._x,this._y,this._z,this._order)}};Euler.prototype.isEuler=true;exports.Euler=Euler},{"../Three":1,"./Math":11,"./Matrix4":13,"./Quaternion":15,"./Vector3":20}],11:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],12:[function(require,module,exports){var Vector3Module=require("./Vector3");var Three=require("../Three");var Matrix3;Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}};Matrix3.prototype={constructor:Matrix3,set:function(n11,n12,n13,n21,n22,n23,n31,n32,n33){var te=this.elements;te[0]=n11;te[3]=n12;te[6]=n13;te[1]=n21;te[4]=n22;te[7]=n23;te[2]=n31;te[5]=n32;te[8]=n33;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(m){var me=m.elements;this.set(me[0],me[3],me[6],me[1],me[4],me[7],me[2],me[5],me[8]);return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return vector.applyMatrix3(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1=new Vector3Module.Vector3;return function(array,offset,length){if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix3(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[3]*=s;te[6]*=s;te[1]*=s;te[4]*=s;te[7]*=s;te[2]*=s;te[5]*=s;te[8]*=s;return this},determinant:function(){var te=this.elements;var a=te[0],b=te[1],c=te[2],d=te[3],e=te[4],f=te[5],g=te[6],h=te[7],i=te[8];return a*e*i-a*f*h-b*d*i+b*f*g+c*d*h-c*e*g},getInverse:function(matrix,throwOnInvertible){var me=matrix.elements;var te=this.elements;te[0]=me[10]*me[5]-me[6]*me[9];te[1]=-me[10]*me[1]+me[2]*me[9];te[2]=me[6]*me[1]-me[2]*me[5];te[3]=-me[10]*me[4]+me[6]*me[8];te[4]=me[10]*me[0]-me[2]*me[8];te[5]=-me[6]*me[0]+me[2]*me[4];te[6]=me[9]*me[4]-me[5]*me[8];te[7]=-me[9]*me[0]+me[1]*me[8];te[8]=me[5]*me[0]-me[1]*me[4];var det=me[0]*te[0]+me[1]*te[3]+me[2]*te[6];if(det===0){var msg="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},transpose:function(){var tmp,m=this.elements;tmp=m[1];m[1]=m[3];m[3]=tmp;tmp=m[2];m[2]=m[6];m[6]=tmp;tmp=m[5];m[5]=m[7];m[7]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];return array},getNormalMatrix:function(m){this.getInverse(m).transpose();return this},transposeIntoArray:function(r){var m=this.elements;r[0]=m[0];r[1]=m[3];r[2]=m[6];r[3]=m[1];r[4]=m[4];r[5]=m[7];r[6]=m[2];r[7]=m[5];r[8]=m[8];return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8]]},clone:function(){return(new Matrix3).fromArray(this.elements)}};Matrix3.prototype.isMatrix3=true;exports.Matrix3=Matrix3},{"../Three":1,"./Vector3":20}],13:[function(require,module,exports){var MathModule=require("./Math");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Three=require("../Three");var Matrix4;var instance;Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};Matrix4.prototype={constructor:Matrix4,set:function(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){var te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;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(m){this.elements.set(m.elements);return this},extractPosition:function(m){Three.warn("THREE.Matrix4: .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},extractBasis:function(xAxis,yAxis,zAxis){var te=this.elements;xAxis.set(te[0],te[1],te[2]);yAxis.set(te[4],te[5],te[6]);zAxis.set(te[8],te[9],te[10]);return this},makeBasis:function(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this},extractRotation:function(){var v1;return function(m){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);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}}(),makeRotationFromEuler:function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var te=this.elements;var x=euler.x,y=euler.y,z=euler.z;var a=Math.cos(x),b=Math.sin(x);var c=Math.cos(y),d=Math.sin(y);var e=Math.cos(z),f=Math.sin(z);if(euler.order==="XYZ"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c}else if(euler.order==="YXZ"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c}else if(euler.order==="ZXY"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c}else if(euler.order==="ZYX"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c}else if(euler.order==="YZX"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f}else if(euler.order==="XZY"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac}te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},setRotationFromQuaternion:function(q){Three.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(q)},makeRotationFromQuaternion:function(q){
var te=this.elements;var x=q.x,y=q.y,z=q.z,w=q.w;var x2=x+x,y2=y+y,z2=z+z;var xx=x*x2,xy=x*y2,xz=x*z2;var yy=y*y2,yz=y*z2,zz=z*z2;var wx=w*x2,wy=w*y2,wz=w*z2;te[0]=1-(yy+zz);te[4]=xy-wz;te[8]=xz+wy;te[1]=xy+wz;te[5]=1-(xx+zz);te[9]=yz-wx;te[2]=xz-wy;te[6]=yz+wx;te[10]=1-(xx+yy);te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},lookAt:function(){var x,y,z;return function(eye,target,up){if(x===undefined)x=new((Vector3Module||getVector3Module()).Vector3);if(y===undefined)y=new((Vector3Module||getVector3Module()).Vector3);if(z===undefined)z=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;z.subVectors(eye,target).normalize();if(z.length()===0){z.z=1}x.crossVectors(up,z).normalize();if(x.length()===0){z.x+=1e-4;x.crossVectors(up,z).normalize()}y.crossVectors(z,x);te[0]=x.x;te[4]=y.x;te[8]=z.x;te[1]=x.y;te[5]=y.y;te[9]=z.y;te[2]=x.z;te[6]=y.z;te[10]=z.z;return this}}(),multiply:function(m,n){if(n!==undefined){Three.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(m,n)}return this.multiplyMatrices(this,m)},multiplyMatrices:function(a,b){var ae=a.elements;var be=b.elements;var te=this.elements;var a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];var a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];var a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];var a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];var b11=be[0],b12=be[4],b13=be[8],b14=be[12];var b21=be[1],b22=be[5],b23=be[9],b24=be[13];var b31=be[2],b32=be[6],b33=be[10],b34=be[14];var b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this},multiplyToArray:function(a,b,r){var te=this.elements;this.multiplyMatrices(a,b);r[0]=te[0];r[1]=te[1];r[2]=te[2];r[3]=te[3];r[4]=te[4];r[5]=te[5];r[6]=te[6];r[7]=te[7];r[8]=te[8];r[9]=te[9];r[10]=te[10];r[11]=te[11];r[12]=te[12];r[13]=te[13];r[14]=te[14];r[15]=te[15];return this},multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return vector.applyProjection(this)},multiplyVector4:function(vector){Three.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1;return function(array,offset,length){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix4(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),rotateAxis:function(v){Three.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");v.transformDirection(this)},crossVector:function(vector){Three.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},determinant:function(){var te=this.elements;var n11=te[0],n12=te[4],n13=te[8],n14=te[12];var n21=te[1],n22=te[5],n23=te[9],n24=te[13];var n31=te[2],n32=te[6],n33=te[10],n34=te[14];var n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)},transpose:function(){var te=this.elements;var tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array},getPosition:function(){var v1;return function(){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);Three.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var te=this.elements;return v1.set(te[12],te[13],te[14])}}(),setPosition:function(v){var te=this.elements;te[12]=v.x;te[13]=v.y;te[14]=v.z;return this},getInverse:function(m,throwOnInvertible){var te=this.elements;var me=m.elements;var n11=me[0],n12=me[4],n13=me[8],n14=me[12];var n21=me[1],n22=me[5],n23=me[9],n24=me[13];var n31=me[2],n32=me[6],n33=me[10],n34=me[14];var n41=me[3],n42=me[7],n43=me[11],n44=me[15];te[0]=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44;te[4]=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44;te[8]=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44;te[12]=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;te[1]=n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44;te[5]=n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44;te[9]=n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44;te[13]=n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34;te[2]=n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44;te[6]=n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44;te[10]=n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44;te[14]=n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34;te[3]=n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43;te[7]=n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43;te[11]=n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43;te[15]=n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33;var det=n11*te[0]+n21*te[4]+n31*te[8]+n41*te[12];if(det==0){var msg="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},translate:function(v){Three.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(angle){Three.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(angle){Three.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(angle){Three.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(axis,angle){Three.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(v){var te=this.elements;var x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this},getMaxScaleOnAxis:function(){var te=this.elements;var scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];var scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];var scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,Math.max(scaleYSq,scaleZSq)))},makeTranslation:function(x,y,z){this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);return this},makeRotationX:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this},makeRotationY:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this},makeRotationZ:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(axis,angle){var c=Math.cos(angle);var s=Math.sin(angle);var t=1-c;var x=axis.x,y=axis.y,z=axis.z;var tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this},makeScale:function(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this},compose:function(position,quaternion,scale){this.makeRotationFromQuaternion(quaternion);this.scale(scale);this.setPosition(position);return this},decompose:function(){var vector;var matrix=new Matrix4;return function(position,quaternion,scale){if(vector===undefined)vector=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;var sx=vector.set(te[0],te[1],te[2]).length();var sy=vector.set(te[4],te[5],te[6]).length();var sz=vector.set(te[8],te[9],te[10]).length();var det=this.determinant();if(det<0){sx=-sx}position.x=te[12];position.y=te[13];position.z=te[14];matrix.elements.set(this.elements);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix.elements[0]*=invSX;matrix.elements[1]*=invSX;matrix.elements[2]*=invSX;matrix.elements[4]*=invSY;matrix.elements[5]*=invSY;matrix.elements[6]*=invSY;matrix.elements[8]*=invSZ;matrix.elements[9]*=invSZ;matrix.elements[10]*=invSZ;quaternion.setFromRotationMatrix(matrix);scale.x=sx;scale.y=sy;scale.z=sz;return this}}(),makeFrustum:function(left,right,bottom,top,near,far){var te=this.elements;var x=2*near/(right-left);var y=2*near/(top-bottom);var a=(right+left)/(right-left);var b=(top+bottom)/(top-bottom);var c=-(far+near)/(far-near);var d=-2*far*near/(far-near);te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this},makePerspective:function(fov,aspect,near,far){var ymax=near*Math.tan(MathModule.Math.degToRad(fov*.5));var ymin=-ymax;var xmin=ymin*aspect;var xmax=ymax*aspect;return this.makeFrustum(xmin,xmax,ymin,ymax,near,far)},makeOrthographic:function(left,right,top,bottom,near,far){var te=this.elements;var w=right-left;var h=top-bottom;var p=far-near;var x=(right+left)/w;var y=(top+bottom)/h;var z=(far+near)/p;te[0]=2/w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2/h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=-2/p;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8],te[9],te[10],te[11],te[12],te[13],te[14],te[15]]},clone:function(){return(new Matrix4).fromArray(this.elements)}};Matrix4.prototype.isMatrix4=true;exports.Matrix4=Matrix4},{"../Three":1,"./Math":11,"./Vector3":20}],14:[function(require,module,exports){var Matrix3Module=require("./Matrix3");var Vector3Module=require("./Vector3");var Plane;Plane=function(normal,constant){this.normal=normal!==undefined?normal:new Vector3Module.Vector3(1,0,0);this.constant=constant!==undefined?constant:0};Plane.prototype={constructor:Plane,set:function(normal,constant){this.normal.copy(normal);this.constant=constant;return this},setComponents:function(x,y,z,w){this.normal.set(x,y,z);this.constant=w;return this},setFromNormalAndCoplanarPoint:function(normal,point){this.normal.copy(normal);this.constant=-point.dot(this.normal);return this},setFromCoplanarPoints:function(){var v1=new Vector3Module.Vector3;var v2=new Vector3Module.Vector3;return function(a,b,c){var normal=v1.subVectors(c,b).cross(v2.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(normal,a);return this}}(),copy:function(plane){this.normal.copy(plane.normal);this.constant=plane.constant;return this},normalize:function(){var inverseNormalLength=1/this.normal.length();this.normal.multiplyScalar(inverseNormalLength);this.constant*=inverseNormalLength;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(point){return this.normal.dot(point)+this.constant},distanceToSphere:function(sphere){return this.distanceToPoint(sphere.center)-sphere.radius},projectPoint:function(point,optionalTarget){return this.orthoPoint(point,optionalTarget).sub(point).negate()},orthoPoint:function(point,optionalTarget){var perpendicularMagnitude=this.distanceToPoint(point);var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.normal).multiplyScalar(perpendicularMagnitude)},isIntersectionLine:function(line){var startSign=this.distanceToPoint(line.start);var endSign=this.distanceToPoint(line.end);return startSign<0&&endSign>0||endSign<0&&startSign>0},intersectLine:function(){var v1=new Vector3Module.Vector3;return function(line,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;var direction=line.delta(v1);var denominator=this.normal.dot(direction);if(denominator==0){if(this.distanceToPoint(line.start)==0){return result.copy(line.start)}return undefined}var t=-(line.start.dot(this.normal)+this.constant)/denominator;if(t<0||t>1){return undefined}return result.copy(direction).multiplyScalar(t).add(line.start)}}(),coplanarPoint:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var v1=new Vector3Module.Vector3;var v2=new Vector3Module.Vector3;var m1=new Matrix3Module.Matrix3;return function(matrix,optionalNormalMatrix){var normalMatrix=optionalNormalMatrix||m1.getNormalMatrix(matrix);var newNormal=v1.copy(this.normal).applyMatrix3(normalMatrix);var newCoplanarPoint=this.coplanarPoint(v2);newCoplanarPoint.applyMatrix4(matrix);this.setFromNormalAndCoplanarPoint(newNormal,newCoplanarPoint);return this}}(),translate:function(offset){this.constant=this.constant-offset.dot(this.normal);return this},equals:function(plane){return plane.normal.equals(this.normal)&&plane.constant==this.constant},clone:function(){return(new Plane).copy(this)}};Plane.prototype.isPlane=true;exports.Plane=Plane},{"./Matrix3":12,"./Vector3":20}],15:[function(require,module,exports){var Three=require("../Three");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Quaternion;var instance;Quaternion=function(x,y,z,w){this._x=x||0;this._y=y||0;this._z=z||0;this._w=w!==undefined?w:1};Quaternion.prototype={constructor:Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get w(){return this._w},set w(value){this._w=value;this.onChangeCallback()},set:function(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this.onChangeCallback();return this},copy:function(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this.onChangeCallback();return this},setFromEuler:function(euler,update){if((!!(instance=euler)&&!!instance.isEuler)===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var c1=Math.cos(euler._x/2);var c2=Math.cos(euler._y/2);var c3=Math.cos(euler._z/2);var s1=Math.sin(euler._x/2);var s2=Math.sin(euler._y/2);var s3=Math.sin(euler._z/2);if(euler.order==="XYZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="YXZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="ZXY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="ZYX"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="YZX"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="XZY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}if(update!==false)this.onChangeCallback();return this},setFromAxisAngle:function(axis,angle){var halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this.onChangeCallback();return this},setFromRotationMatrix:function(m){var te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33,s;if(trace>0){s=.5/Math.sqrt(trace+1);this._w=.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s;this._x=.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s}else if(m22>m33){s=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=.25*s;this._z=(m23+m32)/s}else{s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=.25*s}this.onChangeCallback();return this},setFromUnitVectors:function(){var v1,r;var EPS=1e-6;return function(vFrom,vTo){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);r=vFrom.dot(vTo)+1;if(r<EPS){r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){v1.set(-vFrom.y,vFrom.x,0)}else{v1.set(0,-vFrom.z,vFrom.y)}}else{v1.crossVectors(vFrom,vTo)}this._x=v1.x;this._y=v1.y;this._z=v1.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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)},normalize:function(){var l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1}else{l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l}this.onChangeCallback();return this},multiply:function(q,p){if(p!==undefined){Three.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(q,p)}return this.multiplyQuaternions(this,q)},multiplyQuaternions:function(a,b){var qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;var qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.onChangeCallback();return this},multiplyVector3:function(vector){Three.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return vector.applyQuaternion(this)},slerp:function(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);var x=this._x,y=this._y,z=this._z,w=this._w;var cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta}else{this.copy(qb)}if(cosHalfTheta>=1){this._w=w;this._x=x;this._y=y;this._z=z;return this}var halfTheta=Math.acos(cosHalfTheta);var sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){this._w=.5*(w+this._w);this._x=.5*(x+this._x);this._y=.5*(y+this._y);this._z=.5*(z+this._z);return this}var ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this.onChangeCallback();return this},equals:function(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w},fromArray:function(array,offset){if(offset===undefined)offset=0;this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Quaternion(this._x,this._y,this._z,this._w)}};Quaternion.slerp=function(qa,qb,qm,t){return qm.copy(qa).slerp(qb,t)};Quaternion.prototype.isQuaternion=true;exports.Quaternion=Quaternion},{"../Three":1,"./Vector3":20}],16:[function(require,module,exports){var Vector3Module=require("./Vector3");var Ray;Ray=function(origin,direction){this.origin=origin!==undefined?origin:new Vector3Module.Vector3;this.direction=direction!==undefined?direction:new Vector3Module.Vector3};Ray.prototype={constructor:Ray,set:function(origin,direction){this.origin.copy(origin);this.direction.copy(direction);return this},copy:function(ray){this.origin.copy(ray.origin);this.direction.copy(ray.direction);return this},at:function(t,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var v1=new Vector3Module.Vector3;return function(t){this.origin.copy(this.at(t,v1));return this}}(),closestPointToPoint:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;result.subVectors(point,this.origin);var directionDistance=result.dot(this.direction);if(directionDistance<0){return result.copy(this.origin)}return result.copy(this.direction).multiplyScalar(directionDistance).add(this.origin)},distanceToPoint:function(){var v1=new Vector3Module.Vector3;return function(point){var directionDistance=v1.subVectors(point,this.origin).dot(this.direction);if(directionDistance<0){return this.origin.distanceTo(point)}v1.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);return v1.distanceTo(point)}}(),distanceSqToSegment:function(){var segCenter=new Vector3Module.Vector3;var segDir=new Vector3Module.Vector3;var diff=new Vector3Module.Vector3;return function(v0,v1,optionalPointOnRay,optionalPointOnSegment){segCenter.copy(v0).add(v1).multiplyScalar(.5);segDir.copy(v1).sub(v0).normalize();diff.copy(this.origin).sub(segCenter);var segExtent=v0.distanceTo(v1)*.5;var a01=-this.direction.dot(segDir);var b0=diff.dot(this.direction);var b1=-diff.dot(segDir);var c=diff.lengthSq();var det=Math.abs(1-a01*a01);var s0,s1,sqrDist,extDet;if(det>0){s0=a01*b1-b0;s1=a01*b0-b1;extDet=segExtent*det;if(s0>=0){if(s1>=-extDet){if(s1<=extDet){var invDet=1/det;s0*=invDet;s1*=invDet;sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c}else{s1=segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}}else{s1=-segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}}else{if(s1<=-extDet){s0=Math.max(0,-(-a01*segExtent+b0));s1=s0>0?-segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c}else if(s1<=extDet){s0=0;s1=Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=s1*(s1+2*b1)+c}else{s0=Math.max(0,-(a01*segExtent+b0));s1=s0>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c}}}else{s1=a01>0?-segExtent:segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}if(optionalPointOnRay){optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin)}if(optionalPointOnSegment){optionalPointOnSegment.copy(segDir).multiplyScalar(s1).add(segCenter)}return sqrDist}}(),isIntersectionSphere:function(sphere){return this.distanceToPoint(sphere.center)<=sphere.radius},intersectSphere:function(){var v1=new Vector3Module.Vector3;return function(sphere,optionalTarget){v1.subVectors(sphere.center,this.origin);var tca=v1.dot(this.direction);var d2=v1.dot(v1)-tca*tca;var radius2=sphere.radius*sphere.radius;if(d2>radius2)return null;var thc=Math.sqrt(radius2-d2);var t0=tca-thc;var t1=tca+thc;if(t0<0&&t1<0)return null;if(t0<0)return this.at(t1,optionalTarget);return this.at(t0,optionalTarget)}}(),isIntersectionPlane:function(plane){var distToPoint=plane.distanceToPoint(this.origin);if(distToPoint===0){return true}var denominator=plane.normal.dot(this.direction);if(denominator*distToPoint<0){return true}return false},distanceToPlane:function(plane){var denominator=plane.normal.dot(this.direction);if(denominator==0){if(plane.distanceToPoint(this.origin)==0){return 0}return null}var t=-(this.origin.dot(plane.normal)+plane.constant)/denominator;return t>=0?t:null},intersectPlane:function(plane,optionalTarget){var t=this.distanceToPlane(plane);if(t===null){return null}return this.at(t,optionalTarget)},isIntersectionBox:function(){var v=new Vector3Module.Vector3;return function(box){return this.intersectBox(box,v)!==null}}(),intersectBox:function(box,optionalTarget){var tmin,tmax,tymin,tymax,tzmin,tzmax;var invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/this.direction.z;var origin=this.origin;if(invdirx>=0){tmin=(box.min.x-origin.x)*invdirx;tmax=(box.max.x-origin.x)*invdirx}else{tmin=(box.max.x-origin.x)*invdirx;tmax=(box.min.x-origin.x)*invdirx}if(invdiry>=0){tymin=(box.min.y-origin.y)*invdiry;tymax=(box.max.y-origin.y)*invdiry}else{tymin=(box.max.y-origin.y)*invdiry;tymax=(box.min.y-origin.y)*invdiry}if(tmin>tymax||tymin>tmax)return null;if(tymin>tmin||tmin!==tmin)tmin=tymin;if(tymax<tmax||tmax!==tmax)tmax=tymax;if(invdirz>=0){tzmin=(box.min.z-origin.z)*invdirz;tzmax=(box.max.z-origin.z)*invdirz}else{tzmin=(box.max.z-origin.z)*invdirz;tzmax=(box.min.z-origin.z)*invdirz}if(tmin>tzmax||tzmin>tmax)return null;if(tzmin>tmin||tmin!==tmin)tmin=tzmin;if(tzmax<tmax||tmax!==tmax)tmax=tzmax;if(tmax<0)return null;return this.at(tmin>=0?tmin:tmax,optionalTarget)},intersectTriangle:function(){var diff=new Vector3Module.Vector3;var edge1=new Vector3Module.Vector3;var edge2=new Vector3Module.Vector3;var normal=new Vector3Module.Vector3;return function(a,b,c,backfaceCulling,optionalTarget){edge1.subVectors(b,a);edge2.subVectors(c,a);normal.crossVectors(edge1,edge2);var DdN=this.direction.dot(normal);var sign;if(DdN>0){if(backfaceCulling)return null;sign=1}else if(DdN<0){sign=-1;DdN=-DdN}else{return null}diff.subVectors(this.origin,a);var DdQxE2=sign*this.direction.dot(edge2.crossVectors(diff,edge2));if(DdQxE2<0){return null}var DdE1xQ=sign*this.direction.dot(edge1.cross(diff));if(DdE1xQ<0){return null}if(DdQxE2+DdE1xQ>DdN){return null}var QdN=-sign*diff.dot(normal);if(QdN<0){return null}return this.at(QdN/DdN,optionalTarget)}}(),applyMatrix4:function(matrix4){this.direction.add(this.origin).applyMatrix4(matrix4);this.origin.applyMatrix4(matrix4);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(ray){return ray.origin.equals(this.origin)&&ray.direction.equals(this.direction)},clone:function(){return(new Ray).copy(this)}};Ray.prototype.isRay=true;exports.Ray=Ray},{"./Vector3":20}],17:[function(require,module,exports){var Box3Module,getBox3Module=function(){return Box3Module=require("./Box3")};var Vector3Module=require("./Vector3");var Sphere;Sphere=function(center,radius){this.center=center!==undefined?center:new Vector3Module.Vector3;this.radius=radius!==undefined?radius:0};Sphere.prototype={constructor:Sphere,set:function(center,radius){this.center.copy(center);this.radius=radius;return this},setFromPoints:function(){var box;return function(points,optionalCenter){if(box===undefined)box=new((Box3Module||getBox3Module()).Box3);var center=this.center;if(optionalCenter!==undefined){center.copy(optionalCenter)}else{box.setFromPoints(points).center(center)}var maxRadiusSq=0;for(var i=0,il=points.length;i<il;i++){maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(points[i]))}this.radius=Math.sqrt(maxRadiusSq);return this}}(),copy:function(sphere){this.center.copy(sphere.center);this.radius=sphere.radius;return this},empty:function(){return this.radius<=0},containsPoint:function(point){return point.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(point){return point.distanceTo(this.center)-this.radius},intersectsSphere:function(sphere){var radiusSum=this.radius+sphere.radius;return sphere.center.distanceToSquared(this.center)<=radiusSum*radiusSum},clampPoint:function(point,optionalTarget){var deltaLengthSq=this.center.distanceToSquared(point);var result=optionalTarget||new Vector3Module.Vector3;result.copy(point);if(deltaLengthSq>this.radius*this.radius){result.sub(this.center).normalize();result.multiplyScalar(this.radius).add(this.center)}return result},getBoundingBox:function(optionalTarget){var box=optionalTarget||new((Box3Module||getBox3Module()).Box3);box.set(this.center,this.center);box.expandByScalar(this.radius);return box},applyMatrix4:function(matrix){this.center.applyMatrix4(matrix);this.radius=this.radius*matrix.getMaxScaleOnAxis();return this},translate:function(offset){this.center.add(offset);return this},equals:function(sphere){return sphere.center.equals(this.center)&&sphere.radius===this.radius},clone:function(){return(new Sphere).copy(this)}};Sphere.prototype.isSphere=true;exports.Sphere=Sphere},{"./Box3":8,"./Vector3":20}],18:[function(require,module,exports){var PlaneModule=require("./Plane");var Vector3Module=require("./Vector3");var Triangle;Triangle=function(a,b,c){this.a=a!==undefined?a:new Vector3Module.Vector3;this.b=b!==undefined?b:new Vector3Module.Vector3;this.c=c!==undefined?c:new Vector3Module.Vector3};Triangle.normal=function(){var v0=new Vector3Module.Vector3;return function(a,b,c,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;result.subVectors(c,b);v0.subVectors(a,b);result.cross(v0);var resultLengthSq=result.lengthSq();if(resultLengthSq>0){return result.multiplyScalar(1/Math.sqrt(resultLengthSq))}return result.set(0,0,0)}}();Triangle.barycoordFromPoint=function(){var v0=new Vector3Module.Vector3;var v1=new Vector3Module.Vector3;var v2=new Vector3Module.Vector3;return function(point,a,b,c,optionalTarget){v0.subVectors(c,a);v1.subVectors(b,a);v2.subVectors(point,a);var dot00=v0.dot(v0);var dot01=v0.dot(v1);var dot02=v0.dot(v2);var dot11=v1.dot(v1);var dot12=v1.dot(v2);var denom=dot00*dot11-dot01*dot01;var result=optionalTarget||new Vector3Module.Vector3;if(denom==0){return result.set(-2,-1,-1)}var invDenom=1/denom;var u=(dot11*dot02-dot01*dot12)*invDenom;var v=(dot00*dot12-dot01*dot02)*invDenom;return result.set(1-u-v,v,u)}}();Triangle.containsPoint=function(){var v1=new Vector3Module.Vector3;return function(point,a,b,c){var result=Triangle.barycoordFromPoint(point,a,b,c,v1);return result.x>=0&&result.y>=0&&result.x+result.y<=1}}();Triangle.prototype={constructor:Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(points,i0,i1,i2){this.a.copy(points[i0]);this.b.copy(points[i1]);this.c.copy(points[i2]);return this},copy:function(triangle){this.a.copy(triangle.a);this.b.copy(triangle.b);this.c.copy(triangle.c);return this},area:function(){var v0=new Vector3Module.Vector3;var v1=new Vector3Module.Vector3;return function(){v0.subVectors(this.c,this.b);v1.subVectors(this.a,this.b);return v0.cross(v1).length()*.5}}(),midpoint:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3);
},normal:function(optionalTarget){return Triangle.normal(this.a,this.b,this.c,optionalTarget)},plane:function(optionalTarget){var result=optionalTarget||new PlaneModule.Plane;return result.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(point,optionalTarget){return Triangle.barycoordFromPoint(point,this.a,this.b,this.c,optionalTarget)},containsPoint:function(point){return Triangle.containsPoint(point,this.a,this.b,this.c)},equals:function(triangle){return triangle.a.equals(this.a)&&triangle.b.equals(this.b)&&triangle.c.equals(this.c)},clone:function(){return(new Triangle).copy(this)}};Triangle.prototype.isTriangle=true;exports.Triangle=Triangle},{"./Plane":14,"./Vector3":20}],19:[function(require,module,exports){var Three=require("../Three");var Vector2;Vector2=function(x,y){this.x=x||0;this.y=y||0};Vector2.prototype={constructor:Vector2,set:function(x,y){this.x=x;this.y=y;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;return this},addScalar:function(s){this.x+=s;this.y+=s;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},sub:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;return this},subScalar:function(s){this.x-=s;this.y-=s;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(v){this.x*=v.x;this.y*=v.y;return this},multiplyScalar:function(s){this.x*=s;this.y*=s;return this},divide:function(v){this.x/=v.x;this.y/=v.y;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar}else{this.x=0;this.y=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector2;max=new Vector2}min.set(minVal,minVal);max.set(maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(v){return this.x*v.x+this.y*v.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(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x,dy=this.y-v.y;return dx*dx+dy*dy},setLength:function(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];return this},clone:function(){return new Vector2(this.x,this.y)}};Vector2.prototype.isVector2=true;exports.Vector2=Vector2},{"../Three":1}],20:[function(require,module,exports){var MathModule=require("./Math");var Matrix4Module,getMatrix4Module=function(){return Matrix4Module=require("./Matrix4")};var QuaternionModule,getQuaternionModule=function(){return QuaternionModule=require("./Quaternion")};var Three=require("../Three");var Vector3;var instance;Vector3=function(x,y,z){this.x=x||0;this.y=y||0;this.z=z||0};Vector3.prototype={constructor:Vector3,set:function(x,y,z){this.x=x;this.y=y;this.z=z;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(v,w)}this.x*=v.x;this.y*=v.y;this.z*=v.z;return this},multiplyScalar:function(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;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},applyEuler:function(){var quaternion;return function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromEuler(euler));return this}}(),applyAxisAngle:function(){var quaternion;return function(axis,angle){if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromAxisAngle(axis,angle));return this}}(),applyMatrix3:function(m){var x=this.x;var y=this.y;var z=this.z;var e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this},applyMatrix4:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];return this},applyProjection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;var d=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*d;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*d;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*d;return this},applyQuaternion:function(q){var x=this.x;var y=this.y;var z=this.z;var qx=q.x;var qy=q.y;var qz=q.z;var qw=q.w;var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;this.x=ix*qw+iw*-qx+iy*-qz-iz*-qy;this.y=iy*qw+iw*-qy+iz*-qx-ix*-qz;this.z=iz*qw+iw*-qz+ix*-qy-iy*-qx;return this},project:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.projectionMatrix,matrix.getInverse(camera.matrixWorld));return this.applyProjection(matrix)}}(),unproject:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.matrixWorld,matrix.getInverse(camera.projectionMatrix));return this.applyProjection(matrix)}}(),transformDirection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;this.normalize();return this},divide:function(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar}else{this.x=0;this.y=0;this.z=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector3;max=new Vector3}min.set(minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},cross:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(v,w)}var x=this.x,y=this.y,z=this.z;this.x=y*v.z-z*v.y;this.y=z*v.x-x*v.z;this.z=x*v.y-y*v.x;return this},crossVectors:function(a,b){var ax=a.x,ay=a.y,az=a.z;var bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this},projectOnVector:function(){var v1,dot;return function(vector){if(v1===undefined)v1=new Vector3;v1.copy(vector).normalize();dot=this.dot(v1);return this.copy(v1).multiplyScalar(dot)}}(),projectOnPlane:function(){var v1;return function(planeNormal){if(v1===undefined)v1=new Vector3;v1.copy(this).projectOnVector(planeNormal);return this.sub(v1)}}(),reflect:function(){var v1;return function(normal){if(v1===undefined)v1=new Vector3;return this.sub(v1.copy(normal).multiplyScalar(2*this.dot(normal)))}}(),angleTo:function(v){var theta=this.dot(v)/(this.length()*v.length());return Math.acos(MathModule.Math.clamp(theta,-1,1))},distanceTo:function(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x;var dy=this.y-v.y;var dz=this.z-v.z;return dx*dx+dy*dy+dz*dz},setEulerFromRotationMatrix:function(m,order){Three.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(q,order){Three.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(m){Three.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(m)},getScaleFromMatrix:function(m){Three.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(m)},getColumnFromMatrix:function(index,matrix){Three.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(index,matrix)},setFromMatrixPosition:function(m){this.x=m.elements[12];this.y=m.elements[13];this.z=m.elements[14];return this},setFromMatrixScale:function(m){var sx=this.set(m.elements[0],m.elements[1],m.elements[2]).length();var sy=this.set(m.elements[4],m.elements[5],m.elements[6]).length();var sz=this.set(m.elements[8],m.elements[9],m.elements[10]).length();this.x=sx;this.y=sy;this.z=sz;return this},setFromMatrixColumn: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){return v.x===this.x&&v.y===this.y&&v.z===this.z},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];return this},clone:function(){return new Vector3(this.x,this.y,this.z)}};Vector3.prototype.isVector3=true;exports.Vector3=Vector3},{"../Three":1,"./Math":11,"./Matrix4":13,"./Quaternion":15}],21:[function(require,module,exports){var Three=require("../Three");var Vector4;Vector4=function(x,y,z,w){this.x=x||0;this.y=y||0;this.z=z||0;this.w=w!==undefined?w:1};Vector4.prototype={constructor:Vector4,set:function(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setW:function(w){this.w=w;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;this.w=v.w!==undefined?v.w:1;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;this.w+=v.w;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;this.w+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;this.w-=v.w;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;this.w-=s;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(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;this.w*=scalar;return this},applyMatrix4:function(m){var x=this.x;var y=this.y;var z=this.z;var w=this.w;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12]*w;this.y=e[1]*x+e[5]*y+e[9]*z+e[13]*w;this.z=e[2]*x+e[6]*y+e[10]*z+e[14]*w;this.w=e[3]*x+e[7]*y+e[11]*z+e[15]*w;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar;this.w*=invScalar}else{this.x=0;this.y=0;this.z=0;this.w=1}return this},setAxisAngleFromQuaternion:function(q){this.w=2*Math.acos(q.w);var s=Math.sqrt(1-q.w*q.w);if(s<1e-4){this.x=1;this.y=0;this.z=0}else{this.x=q.x/s;this.y=q.y/s;this.z=q.z/s}return this},setAxisAngleFromRotationMatrix:function(m){var angle,x,y,z,epsilon=.01,epsilon2=.1,te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(Math.abs(m12-m21)<epsilon&&Math.abs(m13-m31)<epsilon&&Math.abs(m23-m32)<epsilon){if(Math.abs(m12+m21)<epsilon2&&Math.abs(m13+m31)<epsilon2&&Math.abs(m23+m32)<epsilon2&&Math.abs(m11+m22+m33-3)<epsilon2){this.set(1,0,0,0);return this}angle=Math.PI;var xx=(m11+1)/2;var yy=(m22+1)/2;var zz=(m33+1)/2;var xy=(m12+m21)/4;var xz=(m13+m31)/4;var yz=(m23+m32)/4;if(xx>yy&&xx>zz){if(xx<epsilon){x=0;y=.707106781;z=.707106781}else{x=Math.sqrt(xx);y=xy/x;z=xz/x}}else if(yy>zz){if(yy<epsilon){x=.707106781;y=0;z=.707106781}else{y=Math.sqrt(yy);x=xy/y;z=yz/y}}else{if(zz<epsilon){x=.707106781;y=.707106781;z=0}else{z=Math.sqrt(zz);x=xz/z;y=yz/z}}this.set(x,y,z,angle);return this}var s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));if(Math.abs(s)<.001)s=1;this.x=(m32-m23)/s;this.y=(m13-m31)/s;this.z=(m21-m12)/s;this.w=Math.acos((m11+m22+m33-1)/2);return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}if(this.w>v.w){this.w=v.w}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}if(this.w<v.w){this.w=v.w}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}if(this.w<min.w){this.w=min.w}else if(this.w>max.w){this.w=max.w}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector4;max=new Vector4}min.set(minVal,minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;this.w+=(v.w-this.w)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this.w},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];this.w=array[offset+3];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;array[offset+3]=this.w;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];this.w=attribute.array[index+3];return this},clone:function(){return new Vector4(this.x,this.y,this.z,this.w)}};Vector4.prototype.isVector4=true;exports.Vector4=Vector4},{"../Three":1}],"three.cjs/objects/Mesh":[function(require,module,exports){var TriangleModule=require("../math/Triangle");var Face3Module=require("../core/Face3");var Vector3Module=require("../math/Vector3");var SphereModule=require("../math/Sphere");var RayModule=require("../math/Ray");var Matrix4Module=require("../math/Matrix4");var Three=require("../Three");var MeshBasicMaterialModule=require("../materials/MeshBasicMaterial");var GeometryModule=require("../core/Geometry");var Object3DModule=require("../core/Object3D");var Mesh;var instance;Mesh=function(geometry,material){Object3DModule.Object3D.call(this);this.type="Mesh";this.geometry=geometry!==undefined?geometry:new GeometryModule.Geometry;this.material=material!==undefined?material:new MeshBasicMaterialModule.MeshBasicMaterial({color:Math.random()*16777215});this.updateMorphTargets()};Mesh.prototype=Object.create(Object3DModule.Object3D.prototype);Mesh.prototype.constructor=Mesh;Mesh.prototype.updateMorphTargets=function(){if(this.geometry.morphTargets!==undefined&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var m=0,ml=this.geometry.morphTargets.length;m<ml;m++){this.morphTargetInfluences.push(0);this.morphTargetDictionary[this.geometry.morphTargets[m].name]=m}}};Mesh.prototype.getMorphTargetIndexByName=function(name){if(this.morphTargetDictionary[name]!==undefined){return this.morphTargetDictionary[name]}Three.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+name+" does not exist. Returning 0.");return 0};Mesh.prototype.raycast=function(){var inverseMatrix=new Matrix4Module.Matrix4;var ray=new RayModule.Ray;var sphere=new SphereModule.Sphere;var vA=new Vector3Module.Vector3;var vB=new Vector3Module.Vector3;var vC=new Vector3Module.Vector3;return function(raycaster,intersects){var geometry=this.geometry;if(geometry.boundingSphere===null)geometry.computeBoundingSphere();sphere.copy(geometry.boundingSphere);sphere.applyMatrix4(this.matrixWorld);if(raycaster.ray.isIntersectionSphere(sphere)===false){return}inverseMatrix.getInverse(this.matrixWorld);ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);if(geometry.boundingBox!==null){if(ray.isIntersectionBox(geometry.boundingBox)===false){return}}if(!!(instance=geometry)&&!!instance.isBufferGeometry){var material=this.material;if(material===undefined)return;var attributes=geometry.attributes;var a,b,c;var precision=raycaster.precision;if(attributes.index!==undefined){var indices=attributes.index.array;var positions=attributes.position.array;var offsets=geometry.offsets;if(offsets.length===0){offsets=[{start:0,count:indices.length,index:0}]}for(var oi=0,ol=offsets.length;oi<ol;++oi){var start=offsets[oi].start;var count=offsets[oi].count;var index=offsets[oi].index;for(var i=start,il=start+count;i<il;i+=3){a=index+indices[i];b=index+indices[i+1];c=index+indices[i+2];vA.fromArray(positions,a*3);vB.fromArray(positions,b*3);vC.fromArray(positions,c*3);if(material.side===Three.BackSide){var intersectionPoint=ray.intersectTriangle(vC,vB,vA,true)}else{var intersectionPoint=ray.intersectTriangle(vA,vB,vC,material.side!==Three.DoubleSide)}if(intersectionPoint===null)continue;intersectionPoint.applyMatrix4(this.matrixWorld);var distance=raycaster.ray.origin.distanceTo(intersectionPoint);if(distance<precision||distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:intersectionPoint,face:new Face3Module.Face3(a,b,c,TriangleModule.Triangle.normal(vA,vB,vC)),faceIndex:null,object:this})}}}else{var positions=attributes.position.array;for(var i=0,j=0,il=positions.length;i<il;i+=3,j+=9){a=i;b=i+1;c=i+2;vA.fromArray(positions,j);vB.fromArray(positions,j+3);vC.fromArray(positions,j+6);if(material.side===Three.BackSide){var intersectionPoint=ray.intersectTriangle(vC,vB,vA,true)}else{var intersectionPoint=ray.intersectTriangle(vA,vB,vC,material.side!==Three.DoubleSide)}if(intersectionPoint===null)continue;intersectionPoint.applyMatrix4(this.matrixWorld);var distance=raycaster.ray.origin.distanceTo(intersectionPoint);if(distance<precision||distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:intersectionPoint,face:new Face3Module.Face3(a,b,c,TriangleModule.Triangle.normal(vA,vB,vC)),faceIndex:null,object:this})}}}else if(!!(instance=geometry)&&!!instance.isGeometry){var isFaceMaterial=!!(instance=this.material)&&!!instance.isMeshFaceMaterial;var objectMaterials=isFaceMaterial===true?this.material.materials:null;var a,b,c;var precision=raycaster.precision;var vertices=geometry.vertices;for(var f=0,fl=geometry.faces.length;f<fl;f++){var face=geometry.faces[f];var material=isFaceMaterial===true?objectMaterials[face.materialIndex]:this.material;if(material===undefined)continue;a=vertices[face.a];b=vertices[face.b];c=vertices[face.c];if(material.morphTargets===true){var morphTargets=geometry.morphTargets;var morphInfluences=this.morphTargetInfluences;vA.set(0,0,0);vB.set(0,0,0);vC.set(0,0,0);for(var t=0,tl=morphTargets.length;t<tl;t++){var influence=morphInfluences[t];if(influence===0)continue;var targets=morphTargets[t].vertices;vA.x+=(targets[face.a].x-a.x)*influence;vA.y+=(targets[face.a].y-a.y)*influence;vA.z+=(targets[face.a].z-a.z)*influence;vB.x+=(targets[face.b].x-b.x)*influence;vB.y+=(targets[face.b].y-b.y)*influence;vB.z+=(targets[face.b].z-b.z)*influence;vC.x+=(targets[face.c].x-c.x)*influence;vC.y+=(targets[face.c].y-c.y)*influence;vC.z+=(targets[face.c].z-c.z)*influence}vA.add(a);vB.add(b);vC.add(c);a=vA;b=vB;c=vC}if(material.side===Three.BackSide){var intersectionPoint=ray.intersectTriangle(c,b,a,true)}else{var intersectionPoint=ray.intersectTriangle(a,b,c,material.side!==Three.DoubleSide)}if(intersectionPoint===null)continue;intersectionPoint.applyMatrix4(this.matrixWorld);var distance=raycaster.ray.origin.distanceTo(intersectionPoint);if(distance<precision||distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:intersectionPoint,face:face,faceIndex:f,object:this})}}}}();Mesh.prototype.clone=function(object,recursive){if(object===undefined)object=new Mesh(this.geometry,this.material);Object3DModule.Object3D.prototype.clone.call(this,object,recursive);return object};Mesh.prototype.isMesh=true;exports.Mesh=Mesh},{"../Three":1,"../core/Face3":3,"../core/Geometry":4,"../core/Object3D":5,"../materials/MeshBasicMaterial":7,"../math/Matrix4":13,"../math/Ray":16,"../math/Sphere":17,"../math/Triangle":18,"../math/Vector3":20}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var THREE={REVISION:"71"};if(typeof module==="object"){module.exports=THREE}THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};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.MinEquation=103;THREE.MaxEquation=104;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=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;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.HalfFloatType=1025;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.RGBEFormat=THREE.RGBAFormat;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.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.GeometryIdCount=0;THREE.Object3DIdCount=0;THREE.MaterialIdCount=0;THREE.TextureIdCount=0;THREE.LineStrip=0;THREE.LinePieces=1;THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(vector,camera){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}}},{}],2:[function(require,module,exports){var Vector3Module=require("../math/Vector3");var QuaternionModule=require("../math/Quaternion");var Matrix4Module=require("../math/Matrix4");
var Object3DModule=require("../core/Object3D");var Camera;Camera=function(){Object3DModule.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new Matrix4Module.Matrix4;this.projectionMatrix=new Matrix4Module.Matrix4};Camera.prototype=Object.create(Object3DModule.Object3D.prototype);Camera.prototype.constructor=Camera;Camera.prototype.getWorldDirection=function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,-1).applyQuaternion(quaternion)}}();Camera.prototype.lookAt=function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(this.position,vector,this.up);this.quaternion.setFromRotationMatrix(m1)}}();Camera.prototype.clone=function(camera){if(camera===undefined)camera=new Camera;Object3DModule.Object3D.prototype.clone.call(this,camera);camera.matrixWorldInverse.copy(this.matrixWorldInverse);camera.projectionMatrix.copy(this.projectionMatrix);return camera};Camera.prototype.isCamera=true;exports.Camera=Camera},{"../core/Object3D":8,"../math/Matrix4":22,"../math/Quaternion":24,"../math/Vector3":28}],3:[function(require,module,exports){var CameraModule=require("./Camera");var OrthographicCamera;OrthographicCamera=function(left,right,top,bottom,near,far){CameraModule.Camera.call(this);this.type="OrthographicCamera";this.zoom=1;this.left=left;this.right=right;this.top=top;this.bottom=bottom;this.near=near!==undefined?near:.1;this.far=far!==undefined?far:2e3;this.updateProjectionMatrix()};OrthographicCamera.prototype=Object.create(CameraModule.Camera.prototype);OrthographicCamera.prototype.constructor=OrthographicCamera;OrthographicCamera.prototype.updateProjectionMatrix=function(){var dx=(this.right-this.left)/(2*this.zoom);var dy=(this.top-this.bottom)/(2*this.zoom);var cx=(this.right+this.left)/2;var cy=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(cx-dx,cx+dx,cy+dy,cy-dy,this.near,this.far)};OrthographicCamera.prototype.clone=function(){var camera=new OrthographicCamera;CameraModule.Camera.prototype.clone.call(this,camera);camera.zoom=this.zoom;camera.left=this.left;camera.right=this.right;camera.top=this.top;camera.bottom=this.bottom;camera.near=this.near;camera.far=this.far;camera.projectionMatrix.copy(this.projectionMatrix);return camera};OrthographicCamera.prototype.isOrthographicCamera=true;exports.OrthographicCamera=OrthographicCamera},{"./Camera":2}],4:[function(require,module,exports){var MathModule=require("../math/Math");var CameraModule=require("./Camera");var PerspectiveCamera;PerspectiveCamera=function(fov,aspect,near,far){CameraModule.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=fov!==undefined?fov:50;this.aspect=aspect!==undefined?aspect:1;this.near=near!==undefined?near:.1;this.far=far!==undefined?far:2e3;this.updateProjectionMatrix()};PerspectiveCamera.prototype=Object.create(CameraModule.Camera.prototype);PerspectiveCamera.prototype.constructor=PerspectiveCamera;PerspectiveCamera.prototype.setLens=function(focalLength,frameHeight){if(frameHeight===undefined)frameHeight=24;this.fov=2*MathModule.Math.radToDeg(Math.atan(frameHeight/(focalLength*2)));this.updateProjectionMatrix()};PerspectiveCamera.prototype.setViewOffset=function(fullWidth,fullHeight,x,y,width,height){this.fullWidth=fullWidth;this.fullHeight=fullHeight;this.x=x;this.y=y;this.width=width;this.height=height;this.updateProjectionMatrix()};PerspectiveCamera.prototype.updateProjectionMatrix=function(){var fov=MathModule.Math.radToDeg(2*Math.atan(Math.tan(MathModule.Math.degToRad(this.fov)*.5)/this.zoom));if(this.fullWidth){var aspect=this.fullWidth/this.fullHeight;var top=Math.tan(MathModule.Math.degToRad(fov*.5))*this.near;var bottom=-top;var left=aspect*bottom;var right=aspect*top;var width=Math.abs(right-left);var height=Math.abs(top-bottom);this.projectionMatrix.makeFrustum(left+this.x*width/this.fullWidth,left+(this.x+this.width)*width/this.fullWidth,top-(this.y+this.height)*height/this.fullHeight,top-this.y*height/this.fullHeight,this.near,this.far)}else{this.projectionMatrix.makePerspective(fov,this.aspect,this.near,this.far)}};PerspectiveCamera.prototype.clone=function(){var camera=new PerspectiveCamera;CameraModule.Camera.prototype.clone.call(this,camera);camera.zoom=this.zoom;camera.fov=this.fov;camera.aspect=this.aspect;camera.near=this.near;camera.far=this.far;camera.projectionMatrix.copy(this.projectionMatrix);return camera};PerspectiveCamera.prototype.isPerspectiveCamera=true;exports.PerspectiveCamera=PerspectiveCamera},{"../math/Math":20,"./Camera":2}],5:[function(require,module,exports){var EventDispatcher;EventDispatcher=function(){};EventDispatcher.prototype={constructor:EventDispatcher,apply:function(object){object.addEventListener=EventDispatcher.prototype.addEventListener;object.hasEventListener=EventDispatcher.prototype.hasEventListener;object.removeEventListener=EventDispatcher.prototype.removeEventListener;object.dispatchEvent=EventDispatcher.prototype.dispatchEvent},addEventListener:function(type,listener){if(this._listeners===undefined)this._listeners={};var listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[]}if(listeners[type].indexOf(listener)===-1){listeners[type].push(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 listenerArray=listeners[type];if(listenerArray!==undefined){var index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1)}}},dispatchEvent:function(event){if(this._listeners===undefined)return;var listeners=this._listeners;var listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;var array=[];var length=listenerArray.length;for(var i=0;i<length;i++){array[i]=listenerArray[i]}for(var i=0;i<length;i++){array[i].call(this,event)}}}};EventDispatcher.prototype.isEventDispatcher=true;exports.EventDispatcher=EventDispatcher},{}],6:[function(require,module,exports){var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Face3;var toString=Object.prototype.toString;var instance;Face3=function(a,b,c,normal,color,materialIndex){this.a=a;this.b=b;this.c=c;this.normal=!!(instance=normal)&&!!instance.isVector3?normal:new Vector3Module.Vector3;this.vertexNormals=toString.call(normal).slice(8,-1)==="Array"?normal:[];this.color=!!(instance=color)&&!!instance.isColor?color:new ColorModule.Color;this.vertexColors=toString.call(color).slice(8,-1)==="Array"?color:[];this.vertexTangents=[];this.materialIndex=materialIndex!==undefined?materialIndex:0};Face3.prototype={constructor:Face3,clone:function(){var face=new Face3(this.a,this.b,this.c);face.normal.copy(this.normal);face.color.copy(this.color);face.materialIndex=this.materialIndex;for(var i=0,il=this.vertexNormals.length;i<il;i++){face.vertexNormals[i]=this.vertexNormals[i].clone()}for(var i=0,il=this.vertexColors.length;i<il;i++){face.vertexColors[i]=this.vertexColors[i].clone()}for(var i=0,il=this.vertexTangents.length;i<il;i++){face.vertexTangents[i]=this.vertexTangents[i].clone()}return face}};Face3.prototype.isFace3=true;exports.Face3=Face3},{"../math/Color":17,"../math/Vector3":28}],7:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var SphereModule=require("../math/Sphere");var Box3Module=require("../math/Box3");var Vector4Module=require("../math/Vector4");var Matrix4Module=require("../math/Matrix4");var Face3Module=require("./Face3");var Vector2Module=require("../math/Vector2");var ColorModule=require("../math/Color");var Vector3Module=require("../math/Vector3");var Matrix3Module=require("../math/Matrix3");var MathModule=require("../math/Math");var Three=require("../Three");var Geometry;var instance;Geometry=function(){Object.defineProperty(this,"id",{value:Three.GeometryIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingBox=null;this.boundingSphere=null;this.hasTangents=false;this.dynamic=true;this.verticesNeedUpdate=false;this.elementsNeedUpdate=false;this.uvsNeedUpdate=false;this.normalsNeedUpdate=false;this.tangentsNeedUpdate=false;this.colorsNeedUpdate=false;this.lineDistancesNeedUpdate=false;this.groupsNeedUpdate=false};Geometry.prototype={constructor:Geometry,applyMatrix:function(matrix){var normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix);for(var i=0,il=this.vertices.length;i<il;i++){var vertex=this.vertices[i];vertex.applyMatrix4(matrix)}for(var i=0,il=this.faces.length;i<il;i++){var face=this.faces[i];face.normal.applyMatrix3(normalMatrix).normalize();for(var j=0,jl=face.vertexNormals.length;j<jl;j++){face.vertexNormals[j].applyMatrix3(normalMatrix).normalize()}}if(this.boundingBox!==null){this.computeBoundingBox()}if(this.boundingSphere!==null){this.computeBoundingSphere()}this.verticesNeedUpdate=true;this.normalsNeedUpdate=true},fromBufferGeometry:function(geometry){var scope=this;var attributes=geometry.attributes;var vertices=attributes.position.array;var indices=attributes.index!==undefined?attributes.index.array:undefined;var normals=attributes.normal!==undefined?attributes.normal.array:undefined;var colors=attributes.color!==undefined?attributes.color.array:undefined;var uvs=attributes.uv!==undefined?attributes.uv.array:undefined;var tempNormals=[];var tempUVs=[];for(var i=0,j=0;i<vertices.length;i+=3,j+=2){scope.vertices.push(new Vector3Module.Vector3(vertices[i],vertices[i+1],vertices[i+2]));if(normals!==undefined){tempNormals.push(new Vector3Module.Vector3(normals[i],normals[i+1],normals[i+2]))}if(colors!==undefined){scope.colors.push(new ColorModule.Color(colors[i],colors[i+1],colors[i+2]))}if(uvs!==undefined){tempUVs.push(new Vector2Module.Vector2(uvs[j],uvs[j+1]))}}var addFace=function(a,b,c){var vertexNormals=normals!==undefined?[tempNormals[a].clone(),tempNormals[b].clone(),tempNormals[c].clone()]:[];var vertexColors=colors!==undefined?[scope.colors[a].clone(),scope.colors[b].clone(),scope.colors[c].clone()]:[];scope.faces.push(new Face3Module.Face3(a,b,c,vertexNormals,vertexColors));if(uvs!==undefined){scope.faceVertexUvs[0].push([tempUVs[a].clone(),tempUVs[b].clone(),tempUVs[c].clone()])}};if(indices!==undefined){var drawcalls=geometry.drawcalls;if(drawcalls.length>0){for(var i=0;i<drawcalls.length;i++){var drawcall=drawcalls[i];var start=drawcall.start;var count=drawcall.count;var index=drawcall.index;for(var j=start,jl=start+count;j<jl;j+=3){addFace(index+indices[j],index+indices[j+1],index+indices[j+2])}}}else{for(var i=0;i<indices.length;i+=3){addFace(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0;i<vertices.length/3;i+=3){addFace(i,i+1,i+2)}}this.computeFaceNormals();if(geometry.boundingBox!==null){this.boundingBox=geometry.boundingBox.clone()}if(geometry.boundingSphere!==null){this.boundingSphere=geometry.boundingSphere.clone()}return this},center:function(){this.computeBoundingBox();var offset=this.boundingBox.center().negate();this.applyMatrix((new Matrix4Module.Matrix4).setPosition(offset));return offset},computeFaceNormals:function(){var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(var f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f];var vA=this.vertices[face.a];var vB=this.vertices[face.b];var vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);cb.normalize();face.normal.copy(cb)}},computeVertexNormals:function(areaWeighted){var v,vl,f,fl,face,vertices;vertices=new Array(this.vertices.length);for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v]=new Vector3Module.Vector3}if(areaWeighted){var vA,vB,vC;var cb=new Vector3Module.Vector3,ab=new Vector3Module.Vector3;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vA=this.vertices[face.a];vB=this.vertices[face.b];vC=this.vertices[face.c];cb.subVectors(vC,vB);ab.subVectors(vA,vB);cb.cross(ab);vertices[face.a].add(cb);vertices[face.b].add(cb);vertices[face.c].add(cb)}}else{for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];vertices[face.a].add(face.normal);vertices[face.b].add(face.normal);vertices[face.c].add(face.normal)}}for(v=0,vl=this.vertices.length;v<vl;v++){vertices[v].normalize()}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.vertexNormals[0]=vertices[face.a].clone();face.vertexNormals[1]=vertices[face.b].clone();face.vertexNormals[2]=vertices[face.c].clone()}},computeMorphNormals:function(){var i,il,f,fl,face;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];if(!face.__originalFaceNormal){face.__originalFaceNormal=face.normal.clone()}else{face.__originalFaceNormal.copy(face.normal)}if(!face.__originalVertexNormals)face.__originalVertexNormals=[];for(i=0,il=face.vertexNormals.length;i<il;i++){if(!face.__originalVertexNormals[i]){face.__originalVertexNormals[i]=face.vertexNormals[i].clone()}else{face.__originalVertexNormals[i].copy(face.vertexNormals[i])}}}var tmpGeo=new Geometry;tmpGeo.faces=this.faces;for(i=0,il=this.morphTargets.length;i<il;i++){if(!this.morphNormals[i]){this.morphNormals[i]={};this.morphNormals[i].faceNormals=[];this.morphNormals[i].vertexNormals=[];var dstNormalsFace=this.morphNormals[i].faceNormals;var dstNormalsVertex=this.morphNormals[i].vertexNormals;var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){faceNormal=new Vector3Module.Vector3;vertexNormals={a:new Vector3Module.Vector3,b:new Vector3Module.Vector3,c:new Vector3Module.Vector3};dstNormalsFace.push(faceNormal);dstNormalsVertex.push(vertexNormals)}}var morphNormals=this.morphNormals[i];tmpGeo.vertices=this.morphTargets[i].vertices;tmpGeo.computeFaceNormals();tmpGeo.computeVertexNormals();var faceNormal,vertexNormals;for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];faceNormal=morphNormals.faceNormals[f];vertexNormals=morphNormals.vertexNormals[f];faceNormal.copy(face.normal);vertexNormals.a.copy(face.vertexNormals[0]);vertexNormals.b.copy(face.vertexNormals[1]);vertexNormals.c.copy(face.vertexNormals[2])}}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];face.normal=face.__originalFaceNormal;face.vertexNormals=face.__originalVertexNormals}},computeTangents:function(){var f,fl,v,vl,i,vertexIndex,face,uv,vA,vB,vC,uvA,uvB,uvC,x1,x2,y1,y2,z1,z2,s1,s2,t1,t2,r,t,test,tan1=[],tan2=[],sdir=new Vector3Module.Vector3,tdir=new Vector3Module.Vector3,tmp=new Vector3Module.Vector3,tmp2=new Vector3Module.Vector3,n=new Vector3Module.Vector3,w;for(v=0,vl=this.vertices.length;v<vl;v++){tan1[v]=new Vector3Module.Vector3;tan2[v]=new Vector3Module.Vector3}function handleTriangle(context,a,b,c,ua,ub,uc){vA=context.vertices[a];vB=context.vertices[b];vC=context.vertices[c];uvA=uv[ua];uvB=uv[ub];uvC=uv[uc];x1=vB.x-vA.x;x2=vC.x-vA.x;y1=vB.y-vA.y;y2=vC.y-vA.y;z1=vB.z-vA.z;z2=vC.z-vA.z;s1=uvB.x-uvA.x;s2=uvC.x-uvA.x;t1=uvB.y-uvA.y;t2=uvC.y-uvA.y;r=1/(s1*t2-s2*t1);sdir.set((t2*x1-t1*x2)*r,(t2*y1-t1*y2)*r,(t2*z1-t1*z2)*r);tdir.set((s1*x2-s2*x1)*r,(s1*y2-s2*y1)*r,(s1*z2-s2*z1)*r);tan1[a].add(sdir);tan1[b].add(sdir);tan1[c].add(sdir);tan2[a].add(tdir);tan2[b].add(tdir);tan2[c].add(tdir)}for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];uv=this.faceVertexUvs[0][f];handleTriangle(this,face.a,face.b,face.c,0,1,2)}var faceIndex=["a","b","c","d"];for(f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f];for(i=0;i<Math.min(face.vertexNormals.length,3);i++){n.copy(face.vertexNormals[i]);vertexIndex=face[faceIndex[i]];t=tan1[vertexIndex];tmp.copy(t);tmp.sub(n.multiplyScalar(n.dot(t))).normalize();tmp2.crossVectors(face.vertexNormals[i],t);test=tmp2.dot(tan2[vertexIndex]);w=test<0?-1:1;face.vertexTangents[i]=new Vector4Module.Vector4(tmp.x,tmp.y,tmp.z,w)}}this.hasTangents=true},computeLineDistances:function(){var d=0;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){if(i>0){d+=vertices[i].distanceTo(vertices[i-1])}this.lineDistances[i]=d}},computeBoundingBox:function(){if(this.boundingBox===null){this.boundingBox=new Box3Module.Box3}this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){if(this.boundingSphere===null){this.boundingSphere=new SphereModule.Sphere}this.boundingSphere.setFromPoints(this.vertices)},merge:function(geometry,matrix,materialIndexOffset){if((!!(instance=geometry)&&!!instance.isGeometry)===false){Three.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",geometry);return}var normalMatrix,vertexOffset=this.vertices.length,vertices1=this.vertices,vertices2=geometry.vertices,faces1=this.faces,faces2=geometry.faces,uvs1=this.faceVertexUvs[0],uvs2=geometry.faceVertexUvs[0];if(materialIndexOffset===undefined)materialIndexOffset=0;if(matrix!==undefined){normalMatrix=(new Matrix3Module.Matrix3).getNormalMatrix(matrix)}for(var i=0,il=vertices2.length;i<il;i++){var vertex=vertices2[i];var vertexCopy=vertex.clone();if(matrix!==undefined)vertexCopy.applyMatrix4(matrix);vertices1.push(vertexCopy)}for(i=0,il=faces2.length;i<il;i++){var face=faces2[i],faceCopy,normal,color,faceVertexNormals=face.vertexNormals,faceVertexColors=face.vertexColors;faceCopy=new Face3Module.Face3(face.a+vertexOffset,face.b+vertexOffset,face.c+vertexOffset);faceCopy.normal.copy(face.normal);if(normalMatrix!==undefined){faceCopy.normal.applyMatrix3(normalMatrix).normalize()}for(var j=0,jl=faceVertexNormals.length;j<jl;j++){normal=faceVertexNormals[j].clone();if(normalMatrix!==undefined){normal.applyMatrix3(normalMatrix).normalize()}faceCopy.vertexNormals.push(normal)}faceCopy.color.copy(face.color);for(var j=0,jl=faceVertexColors.length;j<jl;j++){color=faceVertexColors[j];faceCopy.vertexColors.push(color.clone())}faceCopy.materialIndex=face.materialIndex+materialIndexOffset;faces1.push(faceCopy)}for(i=0,il=uvs2.length;i<il;i++){var uv=uvs2[i],uvCopy=[];if(uv===undefined){continue}for(var j=0,jl=uv.length;j<jl;j++){uvCopy.push(uv[j].clone())}uvs1.push(uvCopy)}},mergeMesh:function(mesh){if((!!(instance=mesh)&&!!instance.isMesh)===false){Three.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",mesh);return}mesh.matrixAutoUpdate&&mesh.updateMatrix();this.merge(mesh.geometry,mesh.matrix)},mergeVertices:function(){var verticesMap={};var unique=[],changes=[];var v,key;var precisionPoints=4;var precision=Math.pow(10,precisionPoints);var i,il,face;var indices,j,jl;for(i=0,il=this.vertices.length;i<il;i++){v=this.vertices[i];key=Math.round(v.x*precision)+"_"+Math.round(v.y*precision)+"_"+Math.round(v.z*precision);if(verticesMap[key]===undefined){verticesMap[key]=i;unique.push(this.vertices[i]);changes[i]=unique.length-1}else{changes[i]=changes[verticesMap[key]]}}var faceIndicesToRemove=[];for(i=0,il=this.faces.length;i<il;i++){face=this.faces[i];face.a=changes[face.a];face.b=changes[face.b];face.c=changes[face.c];indices=[face.a,face.b,face.c];var dupIndex=-1;for(var n=0;n<3;n++){if(indices[n]==indices[(n+1)%3]){dupIndex=n;faceIndicesToRemove.push(i);break}}}for(i=faceIndicesToRemove.length-1;i>=0;i--){var idx=faceIndicesToRemove[i];this.faces.splice(idx,1);for(j=0,jl=this.faceVertexUvs.length;j<jl;j++){this.faceVertexUvs[j].splice(idx,1)}}var diff=this.vertices.length-unique.length;this.vertices=unique;return diff},toJSON:function(){var output={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(this.parameters!==undefined){var parameters=this.parameters;for(var key in parameters){if(parameters[key]!==undefined)output[key]=parameters[key]}return output}var vertices=[];for(var i=0;i<this.vertices.length;i++){var vertex=this.vertices[i];vertices.push(vertex.x,vertex.y,vertex.z)}var faces=[];var normals=[];var normalsHash={};var colors=[];var colorsHash={};var uvs=[];var uvsHash={};for(var i=0;i<this.faces.length;i++){var face=this.faces[i];var hasMaterial=false;var hasFaceUv=false;var hasFaceVertexUv=this.faceVertexUvs[0][i]!==undefined;var hasFaceNormal=face.normal.length()>0;var hasFaceVertexNormal=face.vertexNormals.length>0;var hasFaceColor=face.color.r!==1||face.color.g!==1||face.color.b!==1;var hasFaceVertexColor=face.vertexColors.length>0;var faceType=0;faceType=setBit(faceType,0,0);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);faces.push(faceType);faces.push(face.a,face.b,face.c);if(hasFaceVertexUv){var faceVertexUvs=this.faceVertexUvs[0][i];faces.push(getUvIndex(faceVertexUvs[0]),getUvIndex(faceVertexUvs[1]),getUvIndex(faceVertexUvs[2]))}if(hasFaceNormal){faces.push(getNormalIndex(face.normal))}if(hasFaceVertexNormal){var vertexNormals=face.vertexNormals;faces.push(getNormalIndex(vertexNormals[0]),getNormalIndex(vertexNormals[1]),getNormalIndex(vertexNormals[2]))}if(hasFaceColor){faces.push(getColorIndex(face.color))}if(hasFaceVertexColor){var vertexColors=face.vertexColors;faces.push(getColorIndex(vertexColors[0]),getColorIndex(vertexColors[1]),getColorIndex(vertexColors[2]))}}function setBit(value,position,enabled){return enabled?value|1<<position:value&~(1<<position)}function getNormalIndex(normal){var hash=normal.x.toString()+normal.y.toString()+normal.z.toString();if(normalsHash[hash]!==undefined){return normalsHash[hash]}normalsHash[hash]=normals.length/3;normals.push(normal.x,normal.y,normal.z);return normalsHash[hash]}function getColorIndex(color){var hash=color.r.toString()+color.g.toString()+color.b.toString();if(colorsHash[hash]!==undefined){return colorsHash[hash]}colorsHash[hash]=colors.length;colors.push(color.getHex());return colorsHash[hash]}function getUvIndex(uv){var hash=uv.x.toString()+uv.y.toString();if(uvsHash[hash]!==undefined){return uvsHash[hash]}uvsHash[hash]=uvs.length/2;uvs.push(uv.x,uv.y);return uvsHash[hash]}output.data={};output.data.vertices=vertices;output.data.normals=normals;if(colors.length>0)output.data.colors=colors;if(uvs.length>0)output.data.uvs=[uvs];output.data.faces=faces;return output},clone:function(){var geometry=new Geometry;var vertices=this.vertices;for(var i=0,il=vertices.length;i<il;i++){geometry.vertices.push(vertices[i].clone())}var faces=this.faces;for(var i=0,il=faces.length;i<il;i++){geometry.faces.push(faces[i].clone())}for(var i=0,il=this.faceVertexUvs.length;i<il;i++){var faceVertexUvs=this.faceVertexUvs[i];if(geometry.faceVertexUvs[i]===undefined){geometry.faceVertexUvs[i]=[]}for(var j=0,jl=faceVertexUvs.length;j<jl;j++){var uvs=faceVertexUvs[j],uvsCopy=[];for(var k=0,kl=uvs.length;k<kl;k++){var uv=uvs[k];uvsCopy.push(uv.clone())}geometry.faceVertexUvs[i].push(uvsCopy)}}return geometry},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Geometry.prototype);Geometry.prototype.isGeometry=true;exports.Geometry=Geometry},{"../Three":1,"../math/Box3":16,"../math/Color":17,"../math/Math":20,"../math/Matrix3":21,"../math/Matrix4":22,"../math/Sphere":26,"../math/Vector2":27,"../math/Vector3":28,"../math/Vector4":29,"./EventDispatcher":5,"./Face3":6}],8:[function(require,module,exports){var EventDispatcherModule=require("./EventDispatcher");var Matrix4Module=require("../math/Matrix4");var QuaternionModule=require("../math/Quaternion");var EulerModule=require("../math/Euler");var Vector3Module=require("../math/Vector3");var MathModule=require("../math/Math");var Three=require("../Three");var Object3D;var instance;Object3D=function(){Object.defineProperty(this,"id",{value:Three.Object3DIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Object3D";this.parent=undefined;this.children=[];this.up=Object3D.DefaultUp.clone();var position=new Vector3Module.Vector3;var rotation=new EulerModule.Euler;var quaternion=new QuaternionModule.Quaternion;var scale=new Vector3Module.Vector3(1,1,1);var onRotationChange=function(){quaternion.setFromEuler(rotation,false)};var onQuaternionChange=function(){rotation.setFromQuaternion(quaternion,undefined,false)};rotation.onChange(onRotationChange);quaternion.onChange(onQuaternionChange);Object.defineProperties(this,{position:{enumerable:true,value:position},rotation:{enumerable:true,value:rotation},quaternion:{enumerable:true,value:quaternion},scale:{enumerable:true,value:scale}});this.rotationAutoUpdate=true;this.matrix=new Matrix4Module.Matrix4;this.matrixWorld=new Matrix4Module.Matrix4;this.matrixAutoUpdate=true;this.matrixWorldNeedsUpdate=false;this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.userData={}};Object3D.DefaultUp=new Vector3Module.Vector3(0,1,0);Object3D.prototype={constructor:Object3D,get eulerOrder(){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(value){Three.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=value},get useQuaternion(){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(value){Three.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(matrix){this.matrix.multiplyMatrices(matrix,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(axis,angle){this.quaternion.setFromAxisAngle(axis,angle)},setRotationFromEuler:function(euler){this.quaternion.setFromEuler(euler,true)},setRotationFromMatrix:function(m){this.quaternion.setFromRotationMatrix(m)},setRotationFromQuaternion:function(q){this.quaternion.copy(q)},rotateOnAxis:function(){var q1=new QuaternionModule.Quaternion;return function(axis,angle){q1.setFromAxisAngle(axis,angle);this.quaternion.multiply(q1);return this}}(),rotateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(angle){return this.rotateOnAxis(v1,angle)}}(),rotateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(angle){return this.rotateOnAxis(v1,angle)}}(),translateOnAxis:function(){var v1=new Vector3Module.Vector3;return function(axis,distance){v1.copy(axis).applyQuaternion(this.quaternion);this.position.add(v1.multiplyScalar(distance));return this}}(),translate:function(distance,axis){Three.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(axis,distance)},translateX:function(){var v1=new Vector3Module.Vector3(1,0,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateY:function(){var v1=new Vector3Module.Vector3(0,1,0);return function(distance){return this.translateOnAxis(v1,distance)}}(),translateZ:function(){var v1=new Vector3Module.Vector3(0,0,1);return function(distance){return this.translateOnAxis(v1,distance)}}(),localToWorld:function(vector){return vector.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var m1=new Matrix4Module.Matrix4;return function(vector){return vector.applyMatrix4(m1.getInverse(this.matrixWorld))}}(),lookAt:function(){var m1=new Matrix4Module.Matrix4;return function(vector){m1.lookAt(vector,this.position,this.up);this.quaternion.setFromRotationMatrix(m1)}}(),add:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.add(arguments[i])}return this}if(object===this){Three.error("THREE.Object3D.add: object can't be added as a child of itself.",object);return this}if(!!(instance=object)&&!!instance.isObject3D){if(object.parent!==undefined){object.parent.remove(object)}object.parent=this;object.dispatchEvent({type:"added"});this.children.push(object)}else{Three.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",object)}return this},remove:function(object){if(arguments.length>1){for(var i=0;i<arguments.length;i++){this.remove(arguments[i])}}var index=this.children.indexOf(object);if(index!==-1){object.parent=undefined;object.dispatchEvent({type:"removed"});this.children.splice(index,1)}},getChildByName:function(name){Three.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(name)},getObjectById:function(id){return this.getObjectByProperty("id",id)},getObjectByName:function(name){return this.getObjectByProperty("name",name)},getObjectByProperty:function(name,value){if(this[name]===value)return this;for(var i=0,l=this.children.length;i<l;i++){var child=this.children[i];var object=child.getObjectByProperty(name,value);if(object!==undefined){return object}}return undefined},getWorldPosition:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);return result.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var position=new Vector3Module.Vector3;var scale=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new QuaternionModule.Quaternion;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,result,scale);return result}}(),getWorldRotation:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new EulerModule.Euler;this.getWorldQuaternion(quaternion);return result.setFromQuaternion(quaternion,this.rotation.order,false)}}(),getWorldScale:function(){var position=new Vector3Module.Vector3;var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.updateMatrixWorld(true);this.matrixWorld.decompose(position,quaternion,result);return result}}(),getWorldDirection:function(){var quaternion=new QuaternionModule.Quaternion;return function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;this.getWorldQuaternion(quaternion);return result.set(0,0,1).applyQuaternion(quaternion)}}(),raycast:function(){},traverse:function(callback){callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverse(callback)}},traverseVisible:function(callback){if(this.visible===false)return;callback(this);for(var i=0,l=this.children.length;i<l;i++){this.children[i].traverseVisible(callback)}},traverseAncestors:function(callback){if(this.parent){callback(this.parent);this.parent.traverseAncestors(callback)}},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(force){if(this.matrixAutoUpdate===true)this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||force===true){if(this.parent===undefined){this.matrixWorld.copy(this.matrix)}else{this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)}this.matrixWorldNeedsUpdate=false;force=true}for(var i=0,l=this.children.length;i<l;i++){this.children[i].updateMatrixWorld(force)}},toJSON:function(){var output={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}};var geometries={};var parseGeometry=function(geometry){if(output.geometries===undefined){output.geometries=[]}if(geometries[geometry.uuid]===undefined){var json=geometry.toJSON();delete json.metadata;geometries[geometry.uuid]=json;output.geometries.push(json)}return geometry.uuid};var materials={};var parseMaterial=function(material){if(output.materials===undefined){output.materials=[]}if(materials[material.uuid]===undefined){var json=material.toJSON();delete json.metadata;materials[material.uuid]=json;
output.materials.push(json)}return material.uuid};var parseObject=function(object){var data={};data.uuid=object.uuid;data.type=object.type;if(object.name!=="")data.name=object.name;if(JSON.stringify(object.userData)!=="{}")data.userData=object.userData;if(object.visible!==true)data.visible=object.visible;if(!!(instance=object)&&!!instance.isPerspectiveCamera){data.fov=object.fov;data.aspect=object.aspect;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isOrthographicCamera){data.left=object.left;data.right=object.right;data.top=object.top;data.bottom=object.bottom;data.near=object.near;data.far=object.far}else if(!!(instance=object)&&!!instance.isAmbientLight){data.color=object.color.getHex()}else if(!!(instance=object)&&!!instance.isDirectionalLight){data.color=object.color.getHex();data.intensity=object.intensity}else if(!!(instance=object)&&!!instance.isPointLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isSpotLight){data.color=object.color.getHex();data.intensity=object.intensity;data.distance=object.distance;data.angle=object.angle;data.exponent=object.exponent;data.decay=object.decay}else if(!!(instance=object)&&!!instance.isHemisphereLight){data.color=object.color.getHex();data.groundColor=object.groundColor.getHex()}else if(!!(instance=object)&&!!instance.isMesh||!!(instance=object)&&!!instance.isLine||!!(instance=object)&&!!instance.isPointCloud){data.geometry=parseGeometry(object.geometry);data.material=parseMaterial(object.material);if(!!(instance=object)&&!!instance.isLine)data.mode=object.mode}else if(!!(instance=object)&&!!instance.isSprite){data.material=parseMaterial(object.material)}data.matrix=object.matrix.toArray();if(object.children.length>0){data.children=[];for(var i=0;i<object.children.length;i++){data.children.push(parseObject(object.children[i]))}}return data};output.object=parseObject(this);return output},clone:function(object,recursive){if(object===undefined)object=new Object3D;if(recursive===undefined)recursive=true;object.name=this.name;object.up.copy(this.up);object.position.copy(this.position);object.quaternion.copy(this.quaternion);object.scale.copy(this.scale);object.rotationAutoUpdate=this.rotationAutoUpdate;object.matrix.copy(this.matrix);object.matrixWorld.copy(this.matrixWorld);object.matrixAutoUpdate=this.matrixAutoUpdate;object.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;object.visible=this.visible;object.castShadow=this.castShadow;object.receiveShadow=this.receiveShadow;object.frustumCulled=this.frustumCulled;object.userData=JSON.parse(JSON.stringify(this.userData));if(recursive===true){for(var i=0;i<this.children.length;i++){var child=this.children[i];object.add(child.clone())}}return object}};EventDispatcherModule.EventDispatcher.prototype.apply(Object3D.prototype);Object3D.prototype.isObject3D=true;exports.Object3D=Object3D},{"../Three":1,"../math/Euler":18,"../math/Math":20,"../math/Matrix4":22,"../math/Quaternion":24,"../math/Vector3":28,"./EventDispatcher":5}],9:[function(require,module,exports){var QuaternionModule=require("../../math/Quaternion");var Vector3Module=require("../../math/Vector3");var Object3DModule=require("../../core/Object3D");var Gyroscope;Gyroscope=function(){Object3DModule.Object3D.call(this)};Gyroscope.prototype=Object.create(Object3DModule.Object3D.prototype);Gyroscope.prototype.constructor=Gyroscope;Gyroscope.prototype.updateMatrixWorld=function(){var translationObject=new Vector3Module.Vector3;var quaternionObject=new QuaternionModule.Quaternion;var scaleObject=new Vector3Module.Vector3;var translationWorld=new Vector3Module.Vector3;var quaternionWorld=new QuaternionModule.Quaternion;var scaleWorld=new Vector3Module.Vector3;return function(force){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||force){if(this.parent){this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(translationWorld,quaternionWorld,scaleWorld);this.matrix.decompose(translationObject,quaternionObject,scaleObject);this.matrixWorld.compose(translationWorld,quaternionObject,scaleWorld)}else{this.matrixWorld.copy(this.matrix)}this.matrixWorldNeedsUpdate=false;force=true}for(var i=0,l=this.children.length;i<l;i++){this.children[i].updateMatrixWorld(force)}}}();Gyroscope.prototype.isGyroscope=true;exports.Gyroscope=Gyroscope},{"../../core/Object3D":8,"../../math/Quaternion":24,"../../math/Vector3":28}],10:[function(require,module,exports){var CameraModule=require("../../cameras/Camera");var LineModule=require("../../objects/Line");var ColorModule=require("../../math/Color");var Vector3Module=require("../../math/Vector3");var Three=require("../../Three");var LineBasicMaterialModule=require("../../materials/LineBasicMaterial");var GeometryModule=require("../../core/Geometry");var CameraHelper;CameraHelper=function(camera){var geometry=new GeometryModule.Geometry;var material=new LineBasicMaterialModule.LineBasicMaterial({color:16777215,vertexColors:Three.FaceColors});var pointMap={};var hexFrustum=16755200;var hexCone=16711680;var hexUp=43775;var hexTarget=16777215;var hexCross=3355443;addLine("n1","n2",hexFrustum);addLine("n2","n4",hexFrustum);addLine("n4","n3",hexFrustum);addLine("n3","n1",hexFrustum);addLine("f1","f2",hexFrustum);addLine("f2","f4",hexFrustum);addLine("f4","f3",hexFrustum);addLine("f3","f1",hexFrustum);addLine("n1","f1",hexFrustum);addLine("n2","f2",hexFrustum);addLine("n3","f3",hexFrustum);addLine("n4","f4",hexFrustum);addLine("p","n1",hexCone);addLine("p","n2",hexCone);addLine("p","n3",hexCone);addLine("p","n4",hexCone);addLine("u1","u2",hexUp);addLine("u2","u3",hexUp);addLine("u3","u1",hexUp);addLine("c","t",hexTarget);addLine("p","c",hexCross);addLine("cn1","cn2",hexCross);addLine("cn3","cn4",hexCross);addLine("cf1","cf2",hexCross);addLine("cf3","cf4",hexCross);function addLine(a,b,hex){addPoint(a,hex);addPoint(b,hex)}function addPoint(id,hex){geometry.vertices.push(new Vector3Module.Vector3);geometry.colors.push(new ColorModule.Color(hex));if(pointMap[id]===undefined){pointMap[id]=[]}pointMap[id].push(geometry.vertices.length-1)}LineModule.Line.call(this,geometry,material,Three.LinePieces);this.camera=camera;this.matrix=camera.matrixWorld;this.matrixAutoUpdate=false;this.pointMap=pointMap;this.update()};CameraHelper.prototype=Object.create(LineModule.Line.prototype);CameraHelper.prototype.constructor=CameraHelper;CameraHelper.prototype.update=function(){var geometry,pointMap;var vector=new Vector3Module.Vector3;var camera=new CameraModule.Camera;var setPoint=function(point,x,y,z){vector.set(x,y,z).unproject(camera);var points=pointMap[point];if(points!==undefined){for(var i=0,il=points.length;i<il;i++){geometry.vertices[points[i]].copy(vector)}}};return function(){geometry=this.geometry;pointMap=this.pointMap;var w=1,h=1;camera.projectionMatrix.copy(this.camera.projectionMatrix);setPoint("c",0,0,-1);setPoint("t",0,0,1);setPoint("n1",-w,-h,-1);setPoint("n2",w,-h,-1);setPoint("n3",-w,h,-1);setPoint("n4",w,h,-1);setPoint("f1",-w,-h,1);setPoint("f2",w,-h,1);setPoint("f3",-w,h,1);setPoint("f4",w,h,1);setPoint("u1",w*.7,h*1.1,-1);setPoint("u2",-w*.7,h*1.1,-1);setPoint("u3",0,h*2,-1);setPoint("cf1",-w,0,1);setPoint("cf2",w,0,1);setPoint("cf3",0,-h,1);setPoint("cf4",0,h,1);setPoint("cn1",-w,0,-1);setPoint("cn2",w,0,-1);setPoint("cn3",0,-h,-1);setPoint("cn4",0,h,-1);geometry.verticesNeedUpdate=true}}();CameraHelper.prototype.isCameraHelper=true;exports.CameraHelper=CameraHelper},{"../../Three":1,"../../cameras/Camera":2,"../../core/Geometry":7,"../../materials/LineBasicMaterial":13,"../../math/Color":17,"../../math/Vector3":28,"../../objects/Line":30}],11:[function(require,module,exports){var Vector3Module=require("../math/Vector3");var Object3DModule=require("../core/Object3D");var LightModule=require("./Light");var DirectionalLight;DirectionalLight=function(color,intensity){LightModule.Light.call(this,color);this.type="DirectionalLight";this.position.set(0,1,0);this.target=new Object3DModule.Object3D;this.intensity=intensity!==undefined?intensity:1;this.castShadow=false;this.onlyShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5e3;this.shadowCameraLeft=-500;this.shadowCameraRight=500;this.shadowCameraTop=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapWidth=512;this.shadowMapHeight=512;this.shadowCascade=false;this.shadowCascadeOffset=new Vector3Module.Vector3(0,0,-1e3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,.99,.998];this.shadowCascadeFarZ=[.99,.998,1];this.shadowCascadeArray=[];this.shadowMap=null;this.shadowMapSize=null;this.shadowCamera=null;this.shadowMatrix=null};DirectionalLight.prototype=Object.create(LightModule.Light.prototype);DirectionalLight.prototype.constructor=DirectionalLight;DirectionalLight.prototype.clone=function(){var light=new DirectionalLight;LightModule.Light.prototype.clone.call(this,light);light.target=this.target.clone();light.intensity=this.intensity;light.castShadow=this.castShadow;light.onlyShadow=this.onlyShadow;light.shadowCameraNear=this.shadowCameraNear;light.shadowCameraFar=this.shadowCameraFar;light.shadowCameraLeft=this.shadowCameraLeft;light.shadowCameraRight=this.shadowCameraRight;light.shadowCameraTop=this.shadowCameraTop;light.shadowCameraBottom=this.shadowCameraBottom;light.shadowCameraVisible=this.shadowCameraVisible;light.shadowBias=this.shadowBias;light.shadowDarkness=this.shadowDarkness;light.shadowMapWidth=this.shadowMapWidth;light.shadowMapHeight=this.shadowMapHeight;light.shadowCascade=this.shadowCascade;light.shadowCascadeOffset.copy(this.shadowCascadeOffset);light.shadowCascadeCount=this.shadowCascadeCount;light.shadowCascadeBias=this.shadowCascadeBias.slice(0);light.shadowCascadeWidth=this.shadowCascadeWidth.slice(0);light.shadowCascadeHeight=this.shadowCascadeHeight.slice(0);light.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0);light.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0);return light};DirectionalLight.prototype.isDirectionalLight=true;exports.DirectionalLight=DirectionalLight},{"../core/Object3D":8,"../math/Vector3":28,"./Light":12}],12:[function(require,module,exports){var ColorModule=require("../math/Color");var Object3DModule=require("../core/Object3D");var Light;Light=function(color){Object3DModule.Object3D.call(this);this.type="Light";this.color=new ColorModule.Color(color)};Light.prototype=Object.create(Object3DModule.Object3D.prototype);Light.prototype.constructor=Light;Light.prototype.clone=function(light){if(light===undefined)light=new Light;Object3DModule.Object3D.prototype.clone.call(this,light);light.color.copy(this.color);return light};Light.prototype.isLight=true;exports.Light=Light},{"../core/Object3D":8,"../math/Color":17}],13:[function(require,module,exports){var Three=require("../Three");var ColorModule=require("../math/Color");var MaterialModule=require("./Material");var LineBasicMaterial;LineBasicMaterial=function(parameters){MaterialModule.Material.call(this);this.type="LineBasicMaterial";this.color=new ColorModule.Color(16777215);this.linewidth=1;this.linecap="round";this.linejoin="round";this.vertexColors=Three.NoColors;this.fog=true;this.setValues(parameters)};LineBasicMaterial.prototype=Object.create(MaterialModule.Material.prototype);LineBasicMaterial.prototype.constructor=LineBasicMaterial;LineBasicMaterial.prototype.clone=function(){var material=new LineBasicMaterial;MaterialModule.Material.prototype.clone.call(this,material);material.color.copy(this.color);material.linewidth=this.linewidth;material.linecap=this.linecap;material.linejoin=this.linejoin;material.vertexColors=this.vertexColors;material.fog=this.fog;return material};LineBasicMaterial.prototype.isLineBasicMaterial=true;exports.LineBasicMaterial=LineBasicMaterial},{"../Three":1,"../math/Color":17,"./Material":14}],14:[function(require,module,exports){var EventDispatcherModule=require("../core/EventDispatcher");var MathModule=require("../math/Math");var Three=require("../Three");var Material;var instance;Material=function(){Object.defineProperty(this,"id",{value:Three.MaterialIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.type="Material";this.side=Three.FrontSide;this.opacity=1;this.transparent=false;this.blending=Three.NormalBlending;this.blendSrc=Three.SrcAlphaFactor;this.blendDst=Three.OneMinusSrcAlphaFactor;this.blendEquation=Three.AddEquation;this.blendSrcAlpha=null;this.blendDstAlpha=null;this.blendEquationAlpha=null;this.depthTest=true;this.depthWrite=true;this.colorWrite=true;this.polygonOffset=false;this.polygonOffsetFactor=0;this.polygonOffsetUnits=0;this.alphaTest=0;this.overdraw=0;this.visible=true;this._needsUpdate=true};Material.prototype={constructor:Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(value){if(value===true)this.update();this._needsUpdate=value},setValues:function(values){if(values===undefined)return;for(var key in values){var newValue=values[key];if(newValue===undefined){Three.warn("THREE.Material: '"+key+"' parameter is undefined.");continue}if(key in this){var currentValue=this[key];if(!!(instance=currentValue)&&!!instance.isColor){currentValue.set(newValue)}else if(!!(instance=currentValue)&&!!instance.isVector3&&(!!(instance=newValue)&&!!instance.isVector3)){currentValue.copy(newValue)}else if(key=="overdraw"){this[key]=Number(newValue)}else{this[key]=newValue}}}},toJSON:function(){var output={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")output.name=this.name;if(!!(instance=this)&&!!instance.isMeshBasicMaterial){output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshLambertMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshPhongMaterial){output.color=this.color.getHex();output.emissive=this.emissive.getHex();output.specular=this.specular.getHex();output.shininess=this.shininess;if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.shading!==Three.SmoothShading)output.shading=this.shading;if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshNormalMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isMeshDepthMaterial){if(this.blending!==Three.NormalBlending)output.blending=this.blending;if(this.side!==Three.FrontSide)output.side=this.side}else if(!!(instance=this)&&!!instance.isPointCloudMaterial){output.size=this.size;output.sizeAttenuation=this.sizeAttenuation;output.color=this.color.getHex();if(this.vertexColors!==Three.NoColors)output.vertexColors=this.vertexColors;if(this.blending!==Three.NormalBlending)output.blending=this.blending}else if(!!(instance=this)&&!!instance.isShaderMaterial){output.uniforms=this.uniforms;output.vertexShader=this.vertexShader;output.fragmentShader=this.fragmentShader}else if(!!(instance=this)&&!!instance.isSpriteMaterial){output.color=this.color.getHex()}if(this.opacity<1)output.opacity=this.opacity;if(this.transparent!==false)output.transparent=this.transparent;if(this.wireframe!==false)output.wireframe=this.wireframe;return output},clone:function(material){if(material===undefined)material=new Material;material.name=this.name;material.side=this.side;material.opacity=this.opacity;material.transparent=this.transparent;material.blending=this.blending;material.blendSrc=this.blendSrc;material.blendDst=this.blendDst;material.blendEquation=this.blendEquation;material.blendSrcAlpha=this.blendSrcAlpha;material.blendDstAlpha=this.blendDstAlpha;material.blendEquationAlpha=this.blendEquationAlpha;material.depthTest=this.depthTest;material.depthWrite=this.depthWrite;material.polygonOffset=this.polygonOffset;material.polygonOffsetFactor=this.polygonOffsetFactor;material.polygonOffsetUnits=this.polygonOffsetUnits;material.alphaTest=this.alphaTest;material.overdraw=this.overdraw;material.visible=this.visible;return material},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Material.prototype);Material.prototype.isMaterial=true;exports.Material=Material},{"../Three":1,"../core/EventDispatcher":5,"../math/Math":20}],15:[function(require,module,exports){var UniformsUtilsModule=require("../renderers/shaders/UniformsUtils");var Three=require("../Three");var MaterialModule=require("./Material");var ShaderMaterial;ShaderMaterial=function(parameters){MaterialModule.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.attributes=null;this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.shading=Three.SmoothShading;this.linewidth=1;this.wireframe=false;this.wireframeLinewidth=1;this.fog=false;this.lights=false;this.vertexColors=Three.NoColors;this.skinning=false;this.morphTargets=false;this.morphNormals=false;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=undefined;this.setValues(parameters)};ShaderMaterial.prototype=Object.create(MaterialModule.Material.prototype);ShaderMaterial.prototype.constructor=ShaderMaterial;ShaderMaterial.prototype.clone=function(){var material=new ShaderMaterial;MaterialModule.Material.prototype.clone.call(this,material);material.fragmentShader=this.fragmentShader;material.vertexShader=this.vertexShader;material.uniforms=UniformsUtilsModule.UniformsUtils.clone(this.uniforms);material.attributes=this.attributes;material.defines=this.defines;material.shading=this.shading;material.wireframe=this.wireframe;material.wireframeLinewidth=this.wireframeLinewidth;material.fog=this.fog;material.lights=this.lights;material.vertexColors=this.vertexColors;material.skinning=this.skinning;material.morphTargets=this.morphTargets;material.morphNormals=this.morphNormals;return material};ShaderMaterial.prototype.isShaderMaterial=true;exports.ShaderMaterial=ShaderMaterial},{"../Three":1,"../renderers/shaders/UniformsUtils":35,"./Material":14}],16:[function(require,module,exports){var SphereModule,getSphereModule=function(){return SphereModule=require("./Sphere")};var Vector3Module=require("./Vector3");var Box3;var instance;Box3=function(min,max){this.min=min!==undefined?min:new Vector3Module.Vector3(Infinity,Infinity,Infinity);this.max=max!==undefined?max:new Vector3Module.Vector3(-Infinity,-Infinity,-Infinity)};Box3.prototype={constructor:Box3,set:function(min,max){this.min.copy(min);this.max.copy(max);return this},setFromPoints:function(points){this.makeEmpty();for(var i=0,il=points.length;i<il;i++){this.expandByPoint(points[i])}return this},setFromCenterAndSize:function(){var v1=new Vector3Module.Vector3;return function(center,size){var halfSize=v1.copy(size).multiplyScalar(.5);this.min.copy(center).sub(halfSize);this.max.copy(center).add(halfSize);return this}}(),setFromObject:function(){var v1=new Vector3Module.Vector3;return function(object){var scope=this;object.updateMatrixWorld(true);this.makeEmpty();object.traverse(function(node){var geometry=node.geometry;if(geometry!==undefined){if(!!(instance=geometry)&&!!instance.isGeometry){var vertices=geometry.vertices;for(var i=0,il=vertices.length;i<il;i++){v1.copy(vertices[i]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}else if(!!(instance=geometry)&&!!instance.isBufferGeometry&&geometry.attributes["position"]!==undefined){var positions=geometry.attributes["position"].array;for(var i=0,il=positions.length;i<il;i+=3){v1.set(positions[i],positions[i+1],positions[i+2]);v1.applyMatrix4(node.matrixWorld);scope.expandByPoint(v1)}}}});return this}}(),copy:function(box){this.min.copy(box.min);this.max.copy(box.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(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.subVectors(this.max,this.min)},expandByPoint:function(point){this.min.min(point);this.max.max(point);return this},expandByVector:function(vector){this.min.sub(vector);this.max.add(vector);return this},expandByScalar:function(scalar){this.min.addScalar(-scalar);this.max.addScalar(scalar);return this},containsPoint:function(point){if(point.x<this.min.x||point.x>this.max.x||point.y<this.min.y||point.y>this.max.y||point.z<this.min.z||point.z>this.max.z){return false}return true},containsBox:function(box){if(this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<=box.min.z&&box.max.z<=this.max.z){return true}return false},getParameter:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.set((point.x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min.y),(point.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(box){if(box.max.x<this.min.x||box.min.x>this.max.x||box.max.y<this.min.y||box.min.y>this.max.y||box.max.z<this.min.z||box.min.z>this.max.z){return false}return true},clampPoint:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(point).clamp(this.min,this.max)},distanceToPoint:function(){var v1=new Vector3Module.Vector3;return function(point){var clampedPoint=v1.copy(point).clamp(this.min,this.max);return clampedPoint.sub(point).length()}}(),getBoundingSphere:function(){var v1=new Vector3Module.Vector3;return function(optionalTarget){var result=optionalTarget||new((SphereModule||getSphereModule()).Sphere);result.center=this.center();result.radius=this.size(v1).length()*.5;return result}}(),intersect:function(box){this.min.max(box.min);this.max.min(box.max);return this},union:function(box){this.min.min(box.min);this.max.max(box.max);return this},applyMatrix4:function(){var points=[new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3,new Vector3Module.Vector3];return function(matrix){points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix);points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix);points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix);points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix);points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix);points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix);points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix);points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix);this.makeEmpty();this.setFromPoints(points);return this}}(),translate:function(offset){this.min.add(offset);this.max.add(offset);return this},equals:function(box){return box.min.equals(this.min)&&box.max.equals(this.max)},clone:function(){return(new Box3).copy(this)}};Box3.prototype.isBox3=true;exports.Box3=Box3},{"./Sphere":26,"./Vector3":28}],17:[function(require,module,exports){var ColorKeywords;var Color;var instance;Color=function(color){if(arguments.length===3){return this.setRGB(arguments[0],arguments[1],arguments[2])}return this.set(color)};Color.prototype={constructor:Color,r:1,g:1,b:1,set:function(value){if(!!(instance=value)&&!!instance.isColor){this.copy(value)}else if(typeof value==="number"){this.setHex(value)}else if(typeof value==="string"){this.setStyle(value)}return this},setHex:function(hex){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;return this},setRGB:function(r,g,b){this.r=r;this.g=g;this.b=b;return this},setHSL:function(h,s,l){if(s===0){this.r=this.g=this.b=l}else{var hue2rgb=function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*6*(2/3-t);return p};var p=l<=.5?l*(1+s):l+s-l*s;var q=2*l-p;this.r=hue2rgb(q,p,h+1/3);this.g=hue2rgb(q,p,h);this.b=hue2rgb(q,p,h-1/3)}return this},setStyle:function(style){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(style)){var color=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(style);this.r=Math.min(255,parseInt(color[1],10))/255;this.g=Math.min(255,parseInt(color[2],10))/255;this.b=Math.min(255,parseInt(color[3],10))/255;return this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(style)){var color=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(style);this.r=Math.min(100,parseInt(color[1],10))/100;this.g=Math.min(100,parseInt(color[2],10))/100;this.b=Math.min(100,parseInt(color[3],10))/100;return this}if(/^\#([0-9a-f]{6})$/i.test(style)){var color=/^\#([0-9a-f]{6})$/i.exec(style);this.setHex(parseInt(color[1],16));return this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(style)){var color=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(style);this.setHex(parseInt(color[1]+color[1]+color[2]+color[2]+color[3]+color[3],16));return this}if(/^(\w+)$/i.test(style)){this.setHex(ColorKeywords[style]);return this}},copy:function(color){this.r=color.r;this.g=color.g;this.b=color.b;return this},copyGammaToLinear:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;this.r=Math.pow(color.r,gammaFactor);this.g=Math.pow(color.g,gammaFactor);this.b=Math.pow(color.b,gammaFactor);return this},copyLinearToGamma:function(color,gammaFactor){if(gammaFactor===undefined)gammaFactor=2;var safeInverse=gammaFactor>0?1/gammaFactor:1;this.r=Math.pow(color.r,safeInverse);this.g=Math.pow(color.g,safeInverse);this.b=Math.pow(color.b,safeInverse);return this},convertGammaToLinear:function(){var r=this.r,g=this.g,b=this.b;this.r=r*r;this.g=g*g;this.b=b*b;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 this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(optionalTarget){var hsl=optionalTarget||{h:0,s:0,l:0};var r=this.r,g=this.g,b=this.b;var max=Math.max(r,g,b);var min=Math.min(r,g,b);var hue,saturation;var lightness=(min+max)/2;if(min===max){hue=0;saturation=0}else{var delta=max-min;saturation=lightness<=.5?delta/(max+min):delta/(2-max-min);switch(max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4;break}hue/=6}hsl.h=hue;hsl.s=saturation;hsl.l=lightness;return hsl},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(h,s,l){var hsl=this.getHSL();hsl.h+=h;hsl.s+=s;hsl.l+=l;this.setHSL(hsl.h,hsl.s,hsl.l);return this},add:function(color){this.r+=color.r;this.g+=color.g;this.b+=color.b;return this},addColors:function(color1,color2){this.r=color1.r+color2.r;this.g=color1.g+color2.g;this.b=color1.b+color2.b;return this},addScalar:function(s){this.r+=s;this.g+=s;this.b+=s;return this},multiply:function(color){this.r*=color.r;this.g*=color.g;this.b*=color.b;return this},multiplyScalar:function(s){this.r*=s;this.g*=s;this.b*=s;return this},lerp:function(color,alpha){this.r+=(color.r-this.r)*alpha;this.g+=(color.g-this.g)*alpha;this.b+=(color.b-this.b)*alpha;return this},equals:function(c){return c.r===this.r&&c.g===this.g&&c.b===this.b},fromArray:function(array){this.r=array[0];this.g=array[1];this.b=array[2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.r;array[offset+1]=this.g;array[offset+2]=this.b;return array},clone:function(){return(new Color).setRGB(this.r,this.g,this.b)}};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};Color.prototype.isColor=true;exports.Color=Color;exports.ColorKeywords=ColorKeywords},{}],18:[function(require,module,exports){var Vector3Module=require("./Vector3");var QuaternionModule=require("./Quaternion");var Matrix4Module=require("./Matrix4");var Three=require("../Three");var MathModule=require("./Math");var Euler;Euler=function(x,y,z,order){this._x=x||0;this._y=y||0;this._z=z||0;this._order=order||Euler.DefaultOrder};Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Euler.DefaultOrder="XYZ";Euler.prototype={constructor:Euler,_x:0,_y:0,_z:0,_order:Euler.DefaultOrder,get x(){return this._x;
},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get order(){return this._order},set order(value){this._order=value;this.onChangeCallback()},set:function(x,y,z,order){this._x=x;this._y=y;this._z=z;this._order=order||this._order;this.onChangeCallback();return this},copy:function(euler){this._x=euler._x;this._y=euler._y;this._z=euler._z;this._order=euler._order;this.onChangeCallback();return this},setFromRotationMatrix:function(m,order,update){var clamp=MathModule.Math.clamp;var te=m.elements;var m11=te[0],m12=te[4],m13=te[8];var m21=te[1],m22=te[5],m23=te[9];var m31=te[2],m32=te[6],m33=te[10];order=order||this._order;if(order==="XYZ"){this._y=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<.99999){this._x=Math.atan2(-m23,m33);this._z=Math.atan2(-m12,m11)}else{this._x=Math.atan2(m32,m22);this._z=0}}else if(order==="YXZ"){this._x=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<.99999){this._y=Math.atan2(m13,m33);this._z=Math.atan2(m21,m22)}else{this._y=Math.atan2(-m31,m11);this._z=0}}else if(order==="ZXY"){this._x=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<.99999){this._y=Math.atan2(-m31,m33);this._z=Math.atan2(-m12,m22)}else{this._y=0;this._z=Math.atan2(m21,m11)}}else if(order==="ZYX"){this._y=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<.99999){this._x=Math.atan2(m32,m33);this._z=Math.atan2(m21,m11)}else{this._x=0;this._z=Math.atan2(-m12,m22)}}else if(order==="YZX"){this._z=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<.99999){this._x=Math.atan2(-m23,m22);this._y=Math.atan2(-m31,m11)}else{this._x=0;this._y=Math.atan2(m13,m33)}}else if(order==="XZY"){this._z=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<.99999){this._x=Math.atan2(m32,m22);this._y=Math.atan2(m13,m11)}else{this._x=Math.atan2(-m23,m33);this._y=0}}else{Three.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+order)}this._order=order;if(update!==false)this.onChangeCallback();return this},setFromQuaternion:function(){var matrix;return function(q,order,update){if(matrix===undefined)matrix=new Matrix4Module.Matrix4;matrix.makeRotationFromQuaternion(q);this.setFromRotationMatrix(matrix,order,update);return this}}(),setFromVector3:function(v,order){return this.set(v.x,v.y,v.z,order||this._order)},reorder:function(){var q=new QuaternionModule.Quaternion;return function(newOrder){q.setFromEuler(this);this.setFromQuaternion(q,newOrder)}}(),equals:function(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order},fromArray:function(array){this._x=array[0];this._y=array[1];this._z=array[2];if(array[3]!==undefined)this._order=array[3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._order;return array},toVector3:function(optionalResult){if(optionalResult){return optionalResult.set(this._x,this._y,this._z)}else{return new Vector3Module.Vector3(this._x,this._y,this._z)}},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Euler(this._x,this._y,this._z,this._order)}};Euler.prototype.isEuler=true;exports.Euler=Euler},{"../Three":1,"./Math":20,"./Matrix4":22,"./Quaternion":24,"./Vector3":28}],19:[function(require,module,exports){var Vector3Module=require("./Vector3");var SphereModule=require("./Sphere");var PlaneModule=require("./Plane");var Frustum;Frustum=function(p0,p1,p2,p3,p4,p5){this.planes=[p0!==undefined?p0:new PlaneModule.Plane,p1!==undefined?p1:new PlaneModule.Plane,p2!==undefined?p2:new PlaneModule.Plane,p3!==undefined?p3:new PlaneModule.Plane,p4!==undefined?p4:new PlaneModule.Plane,p5!==undefined?p5:new PlaneModule.Plane]};Frustum.prototype={constructor:Frustum,set:function(p0,p1,p2,p3,p4,p5){var planes=this.planes;planes[0].copy(p0);planes[1].copy(p1);planes[2].copy(p2);planes[3].copy(p3);planes[4].copy(p4);planes[5].copy(p5);return this},copy:function(frustum){var planes=this.planes;for(var i=0;i<6;i++){planes[i].copy(frustum.planes[i])}return this},setFromMatrix:function(m){var planes=this.planes;var me=m.elements;var me0=me[0],me1=me[1],me2=me[2],me3=me[3];var me4=me[4],me5=me[5],me6=me[6],me7=me[7];var me8=me[8],me9=me[9],me10=me[10],me11=me[11];var me12=me[12],me13=me[13],me14=me[14],me15=me[15];planes[0].setComponents(me3-me0,me7-me4,me11-me8,me15-me12).normalize();planes[1].setComponents(me3+me0,me7+me4,me11+me8,me15+me12).normalize();planes[2].setComponents(me3+me1,me7+me5,me11+me9,me15+me13).normalize();planes[3].setComponents(me3-me1,me7-me5,me11-me9,me15-me13).normalize();planes[4].setComponents(me3-me2,me7-me6,me11-me10,me15-me14).normalize();planes[5].setComponents(me3+me2,me7+me6,me11+me10,me15+me14).normalize();return this},intersectsObject:function(){var sphere=new SphereModule.Sphere;return function(object){var geometry=object.geometry;if(geometry.boundingSphere===null)geometry.computeBoundingSphere();sphere.copy(geometry.boundingSphere);sphere.applyMatrix4(object.matrixWorld);return this.intersectsSphere(sphere)}}(),intersectsSphere:function(sphere){var planes=this.planes;var center=sphere.center;var negRadius=-sphere.radius;for(var i=0;i<6;i++){var distance=planes[i].distanceToPoint(center);if(distance<negRadius){return false}}return true},intersectsBox:function(){var p1=new Vector3Module.Vector3,p2=new Vector3Module.Vector3;return function(box){var planes=this.planes;for(var i=0;i<6;i++){var plane=planes[i];p1.x=plane.normal.x>0?box.min.x:box.max.x;p2.x=plane.normal.x>0?box.max.x:box.min.x;p1.y=plane.normal.y>0?box.min.y:box.max.y;p2.y=plane.normal.y>0?box.max.y:box.min.y;p1.z=plane.normal.z>0?box.min.z:box.max.z;p2.z=plane.normal.z>0?box.max.z:box.min.z;var d1=plane.distanceToPoint(p1);var d2=plane.distanceToPoint(p2);if(d1<0&&d2<0){return false}}return true}}(),containsPoint:function(point){var planes=this.planes;for(var i=0;i<6;i++){if(planes[i].distanceToPoint(point)<0){return false}}return true},clone:function(){return(new Frustum).copy(this)}};Frustum.prototype.isFrustum=true;exports.Frustum=Frustum},{"./Plane":23,"./Sphere":26,"./Vector3":28}],20:[function(require,module,exports){var _Math;_Math={generateUUID:function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var uuid=new Array(36);var rnd=0,r;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){uuid[i]="-"}else if(i==14){uuid[i]="4"}else{if(rnd<=2)rnd=33554432+Math.random()*16777216|0;r=rnd&15;rnd=rnd>>4;uuid[i]=chars[i==19?r&3|8:r]}}return uuid.join("")}}(),clamp:function(x,a,b){return x<a?a:x>b?b:x},sign:Math.sign||function(x){return x<0?-1:x>0?1:+x},clampBottom:function(x,a){return x<a?a:x},mapLinear:function(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1)},smoothstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x)},smootherstep:function(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(low,high){return Math.floor(this.randFloat(low,high))},randFloat:function(low,high){return low+Math.random()*(high-low)},randFloatSpread:function(range){return range*(.5-Math.random())},degToRad:function(){var degreeToRadiansFactor=Math.PI/180;return function(degrees){return degrees*degreeToRadiansFactor}}(),radToDeg:function(){var radianToDegreesFactor=180/Math.PI;return function(radians){return radians*radianToDegreesFactor}}(),isPowerOfTwo:function(value){return(value&value-1)===0&&value!==0},nextPowerOfTwo:function(value){value--;value|=value>>1;value|=value>>2;value|=value>>4;value|=value>>8;value|=value>>16;value++;return value}};exports.Math=_Math},{}],21:[function(require,module,exports){var Vector3Module=require("./Vector3");var Three=require("../Three");var Matrix3;Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}};Matrix3.prototype={constructor:Matrix3,set:function(n11,n12,n13,n21,n22,n23,n31,n32,n33){var te=this.elements;te[0]=n11;te[3]=n12;te[6]=n13;te[1]=n21;te[4]=n22;te[7]=n23;te[2]=n31;te[5]=n32;te[8]=n33;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(m){var me=m.elements;this.set(me[0],me[3],me[6],me[1],me[4],me[7],me[2],me[5],me[8]);return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return vector.applyMatrix3(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1=new Vector3Module.Vector3;return function(array,offset,length){if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix3(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[3]*=s;te[6]*=s;te[1]*=s;te[4]*=s;te[7]*=s;te[2]*=s;te[5]*=s;te[8]*=s;return this},determinant:function(){var te=this.elements;var a=te[0],b=te[1],c=te[2],d=te[3],e=te[4],f=te[5],g=te[6],h=te[7],i=te[8];return a*e*i-a*f*h-b*d*i+b*f*g+c*d*h-c*e*g},getInverse:function(matrix,throwOnInvertible){var me=matrix.elements;var te=this.elements;te[0]=me[10]*me[5]-me[6]*me[9];te[1]=-me[10]*me[1]+me[2]*me[9];te[2]=me[6]*me[1]-me[2]*me[5];te[3]=-me[10]*me[4]+me[6]*me[8];te[4]=me[10]*me[0]-me[2]*me[8];te[5]=-me[6]*me[0]+me[2]*me[4];te[6]=me[9]*me[4]-me[5]*me[8];te[7]=-me[9]*me[0]+me[1]*me[8];te[8]=me[5]*me[0]-me[1]*me[4];var det=me[0]*te[0]+me[1]*te[3]+me[2]*te[6];if(det===0){var msg="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},transpose:function(){var tmp,m=this.elements;tmp=m[1];m[1]=m[3];m[3]=tmp;tmp=m[2];m[2]=m[6];m[6]=tmp;tmp=m[5];m[5]=m[7];m[7]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];return array},getNormalMatrix:function(m){this.getInverse(m).transpose();return this},transposeIntoArray:function(r){var m=this.elements;r[0]=m[0];r[1]=m[3];r[2]=m[6];r[3]=m[1];r[4]=m[4];r[5]=m[7];r[6]=m[2];r[7]=m[5];r[8]=m[8];return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8]]},clone:function(){return(new Matrix3).fromArray(this.elements)}};Matrix3.prototype.isMatrix3=true;exports.Matrix3=Matrix3},{"../Three":1,"./Vector3":28}],22:[function(require,module,exports){var MathModule=require("./Math");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Three=require("../Three");var Matrix4;var instance;Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){Three.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};Matrix4.prototype={constructor:Matrix4,set:function(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){var te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;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(m){this.elements.set(m.elements);return this},extractPosition:function(m){Three.warn("THREE.Matrix4: .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},extractBasis:function(xAxis,yAxis,zAxis){var te=this.elements;xAxis.set(te[0],te[1],te[2]);yAxis.set(te[4],te[5],te[6]);zAxis.set(te[8],te[9],te[10]);return this},makeBasis:function(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this},extractRotation:function(){var v1;return function(m){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);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}}(),makeRotationFromEuler:function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var te=this.elements;var x=euler.x,y=euler.y,z=euler.z;var a=Math.cos(x),b=Math.sin(x);var c=Math.cos(y),d=Math.sin(y);var e=Math.cos(z),f=Math.sin(z);if(euler.order==="XYZ"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c}else if(euler.order==="YXZ"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c}else if(euler.order==="ZXY"){var ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c}else if(euler.order==="ZYX"){var ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c}else if(euler.order==="YZX"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f}else if(euler.order==="XZY"){var ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac}te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},setRotationFromQuaternion:function(q){Three.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(q)},makeRotationFromQuaternion:function(q){var te=this.elements;var x=q.x,y=q.y,z=q.z,w=q.w;var x2=x+x,y2=y+y,z2=z+z;var xx=x*x2,xy=x*y2,xz=x*z2;var yy=y*y2,yz=y*z2,zz=z*z2;var wx=w*x2,wy=w*y2,wz=w*z2;te[0]=1-(yy+zz);te[4]=xy-wz;te[8]=xz+wy;te[1]=xy+wz;te[5]=1-(xx+zz);te[9]=yz-wx;te[2]=xz-wy;te[6]=yz+wx;te[10]=1-(xx+yy);te[3]=0;te[7]=0;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this},lookAt:function(){var x,y,z;return function(eye,target,up){if(x===undefined)x=new((Vector3Module||getVector3Module()).Vector3);if(y===undefined)y=new((Vector3Module||getVector3Module()).Vector3);if(z===undefined)z=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;z.subVectors(eye,target).normalize();if(z.length()===0){z.z=1}x.crossVectors(up,z).normalize();if(x.length()===0){z.x+=1e-4;x.crossVectors(up,z).normalize()}y.crossVectors(z,x);te[0]=x.x;te[4]=y.x;te[8]=z.x;te[1]=x.y;te[5]=y.y;te[9]=z.y;te[2]=x.z;te[6]=y.z;te[10]=z.z;return this}}(),multiply:function(m,n){if(n!==undefined){Three.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(m,n)}return this.multiplyMatrices(this,m)},multiplyMatrices:function(a,b){var ae=a.elements;var be=b.elements;var te=this.elements;var a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];var a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];var a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];var a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];var b11=be[0],b12=be[4],b13=be[8],b14=be[12];var b21=be[1],b22=be[5],b23=be[9],b24=be[13];var b31=be[2],b32=be[6],b33=be[10],b34=be[14];var b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this},multiplyToArray:function(a,b,r){var te=this.elements;this.multiplyMatrices(a,b);r[0]=te[0];r[1]=te[1];r[2]=te[2];r[3]=te[3];r[4]=te[4];r[5]=te[5];r[6]=te[6];r[7]=te[7];r[8]=te[8];r[9]=te[9];r[10]=te[10];r[11]=te[11];r[12]=te[12];r[13]=te[13];r[14]=te[14];r[15]=te[15];return this},multiplyScalar:function(s){var te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this},multiplyVector3:function(vector){Three.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return vector.applyProjection(this)},multiplyVector4:function(vector){Three.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},multiplyVector3Array:function(a){Three.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var v1;return function(array,offset,length){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);if(offset===undefined)offset=0;if(length===undefined)length=array.length;for(var i=0,j=offset;i<length;i+=3,j+=3){v1.x=array[j];v1.y=array[j+1];v1.z=array[j+2];v1.applyMatrix4(this);array[j]=v1.x;array[j+1]=v1.y;array[j+2]=v1.z}return array}}(),rotateAxis:function(v){Three.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");v.transformDirection(this)},crossVector:function(vector){Three.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return vector.applyMatrix4(this)},determinant:function(){var te=this.elements;var n11=te[0],n12=te[4],n13=te[8],n14=te[12];var n21=te[1],n22=te[5],n23=te[9],n24=te[13];var n31=te[2],n32=te[6],n33=te[10],n34=te[14];var n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)},transpose:function(){var te=this.elements;var tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this},flattenToArrayOffset:function(array,offset){var te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array},getPosition:function(){var v1;return function(){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);Three.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var te=this.elements;return v1.set(te[12],te[13],te[14])}}(),setPosition:function(v){var te=this.elements;te[12]=v.x;te[13]=v.y;te[14]=v.z;return this},getInverse:function(m,throwOnInvertible){var te=this.elements;var me=m.elements;var n11=me[0],n12=me[4],n13=me[8],n14=me[12];var n21=me[1],n22=me[5],n23=me[9],n24=me[13];var n31=me[2],n32=me[6],n33=me[10],n34=me[14];var n41=me[3],n42=me[7],n43=me[11],n44=me[15];te[0]=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44;te[4]=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44;te[8]=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44;te[12]=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;te[1]=n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44;te[5]=n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44;te[9]=n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44;te[13]=n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34;te[2]=n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44;te[6]=n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44;te[10]=n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44;te[14]=n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34;te[3]=n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43;te[7]=n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43;te[11]=n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43;te[15]=n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33;var det=n11*te[0]+n21*te[4]+n31*te[8]+n41*te[12];if(det==0){var msg="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(throwOnInvertible||false){throw new Error(msg)}else{Three.warn(msg)}this.identity();return this}this.multiplyScalar(1/det);return this},translate:function(v){Three.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(angle){Three.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(angle){Three.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(angle){Three.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(axis,angle){Three.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(v){var te=this.elements;var x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this},getMaxScaleOnAxis:function(){var te=this.elements;var scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];var scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];var scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,Math.max(scaleYSq,scaleZSq)))},makeTranslation:function(x,y,z){this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);return this},makeRotationX:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this},makeRotationY:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this},makeRotationZ:function(theta){var c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(axis,angle){var c=Math.cos(angle);var s=Math.sin(angle);var t=1-c;var x=axis.x,y=axis.y,z=axis.z;var tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this},makeScale:function(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this},compose:function(position,quaternion,scale){this.makeRotationFromQuaternion(quaternion);this.scale(scale);this.setPosition(position);return this},decompose:function(){var vector;var matrix=new Matrix4;return function(position,quaternion,scale){if(vector===undefined)vector=new((Vector3Module||getVector3Module()).Vector3);var te=this.elements;var sx=vector.set(te[0],te[1],te[2]).length();var sy=vector.set(te[4],te[5],te[6]).length();var sz=vector.set(te[8],te[9],te[10]).length();var det=this.determinant();if(det<0){sx=-sx}position.x=te[12];position.y=te[13];position.z=te[14];matrix.elements.set(this.elements);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix.elements[0]*=invSX;matrix.elements[1]*=invSX;matrix.elements[2]*=invSX;matrix.elements[4]*=invSY;matrix.elements[5]*=invSY;matrix.elements[6]*=invSY;matrix.elements[8]*=invSZ;matrix.elements[9]*=invSZ;matrix.elements[10]*=invSZ;quaternion.setFromRotationMatrix(matrix);scale.x=sx;scale.y=sy;scale.z=sz;return this}}(),makeFrustum:function(left,right,bottom,top,near,far){var te=this.elements;var x=2*near/(right-left);var y=2*near/(top-bottom);var a=(right+left)/(right-left);var b=(top+bottom)/(top-bottom);var c=-(far+near)/(far-near);var d=-2*far*near/(far-near);te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this},makePerspective:function(fov,aspect,near,far){var ymax=near*Math.tan(MathModule.Math.degToRad(fov*.5));var ymin=-ymax;var xmin=ymin*aspect;var xmax=ymax*aspect;return this.makeFrustum(xmin,xmax,ymin,ymax,near,far)},makeOrthographic:function(left,right,top,bottom,near,far){var te=this.elements;var w=right-left;var h=top-bottom;var p=far-near;var x=(right+left)/w;var y=(top+bottom)/h;var z=(far+near)/p;te[0]=2/w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2/h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=-2/p;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this},fromArray:function(array){this.elements.set(array);return this},toArray:function(){var te=this.elements;return[te[0],te[1],te[2],te[3],te[4],te[5],te[6],te[7],te[8],te[9],te[10],te[11],te[12],te[13],te[14],te[15]]},clone:function(){return(new Matrix4).fromArray(this.elements)}};Matrix4.prototype.isMatrix4=true;exports.Matrix4=Matrix4},{"../Three":1,"./Math":20,"./Vector3":28}],23:[function(require,module,exports){var Matrix3Module=require("./Matrix3");var Vector3Module=require("./Vector3");var Plane;Plane=function(normal,constant){this.normal=normal!==undefined?normal:new Vector3Module.Vector3(1,0,0);this.constant=constant!==undefined?constant:0};Plane.prototype={constructor:Plane,set:function(normal,constant){this.normal.copy(normal);this.constant=constant;return this},setComponents:function(x,y,z,w){this.normal.set(x,y,z);this.constant=w;return this},setFromNormalAndCoplanarPoint:function(normal,point){this.normal.copy(normal);this.constant=-point.dot(this.normal);return this},setFromCoplanarPoints:function(){var v1=new Vector3Module.Vector3;var v2=new Vector3Module.Vector3;return function(a,b,c){var normal=v1.subVectors(c,b).cross(v2.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(normal,a);return this}}(),copy:function(plane){this.normal.copy(plane.normal);this.constant=plane.constant;return this},normalize:function(){var inverseNormalLength=1/this.normal.length();this.normal.multiplyScalar(inverseNormalLength);this.constant*=inverseNormalLength;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(point){return this.normal.dot(point)+this.constant},distanceToSphere:function(sphere){return this.distanceToPoint(sphere.center)-sphere.radius},projectPoint:function(point,optionalTarget){return this.orthoPoint(point,optionalTarget).sub(point).negate()},orthoPoint:function(point,optionalTarget){var perpendicularMagnitude=this.distanceToPoint(point);var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.normal).multiplyScalar(perpendicularMagnitude)},isIntersectionLine:function(line){var startSign=this.distanceToPoint(line.start);var endSign=this.distanceToPoint(line.end);return startSign<0&&endSign>0||endSign<0&&startSign>0},intersectLine:function(){var v1=new Vector3Module.Vector3;return function(line,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;var direction=line.delta(v1);var denominator=this.normal.dot(direction);if(denominator==0){if(this.distanceToPoint(line.start)==0){return result.copy(line.start)}return undefined}var t=-(line.start.dot(this.normal)+this.constant)/denominator;if(t<0||t>1){return undefined}return result.copy(direction).multiplyScalar(t).add(line.start)}}(),coplanarPoint:function(optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var v1=new Vector3Module.Vector3;var v2=new Vector3Module.Vector3;var m1=new Matrix3Module.Matrix3;return function(matrix,optionalNormalMatrix){var normalMatrix=optionalNormalMatrix||m1.getNormalMatrix(matrix);var newNormal=v1.copy(this.normal).applyMatrix3(normalMatrix);var newCoplanarPoint=this.coplanarPoint(v2);newCoplanarPoint.applyMatrix4(matrix);this.setFromNormalAndCoplanarPoint(newNormal,newCoplanarPoint);return this}}(),translate:function(offset){this.constant=this.constant-offset.dot(this.normal);return this},equals:function(plane){return plane.normal.equals(this.normal)&&plane.constant==this.constant},clone:function(){return(new Plane).copy(this)}};Plane.prototype.isPlane=true;exports.Plane=Plane},{"./Matrix3":21,"./Vector3":28}],24:[function(require,module,exports){var Three=require("../Three");var Vector3Module,getVector3Module=function(){return Vector3Module=require("./Vector3")};var Quaternion;var instance;Quaternion=function(x,y,z,w){this._x=x||0;this._y=y||0;this._z=z||0;this._w=w!==undefined?w:1};Quaternion.prototype={constructor:Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(value){this._x=value;this.onChangeCallback()},get y(){return this._y},set y(value){this._y=value;this.onChangeCallback()},get z(){return this._z},set z(value){this._z=value;this.onChangeCallback()},get w(){return this._w},set w(value){this._w=value;this.onChangeCallback()},set:function(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this.onChangeCallback();return this},copy:function(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this.onChangeCallback();return this},setFromEuler:function(euler,update){if((!!(instance=euler)&&!!instance.isEuler)===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var c1=Math.cos(euler._x/2);var c2=Math.cos(euler._y/2);var c3=Math.cos(euler._z/2);var s1=Math.sin(euler._x/2);var s2=Math.sin(euler._y/2);var s3=Math.sin(euler._z/2);if(euler.order==="XYZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="YXZ"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="ZXY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="ZYX"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}else if(euler.order==="YZX"){this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3}else if(euler.order==="XZY"){this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3}if(update!==false)this.onChangeCallback();return this},setFromAxisAngle:function(axis,angle){var halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this.onChangeCallback();return this},setFromRotationMatrix:function(m){var te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33,s;
if(trace>0){s=.5/Math.sqrt(trace+1);this._w=.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s}else if(m11>m22&&m11>m33){s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s;this._x=.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s}else if(m22>m33){s=2*Math.sqrt(1+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=.25*s;this._z=(m23+m32)/s}else{s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=.25*s}this.onChangeCallback();return this},setFromUnitVectors:function(){var v1,r;var EPS=1e-6;return function(vFrom,vTo){if(v1===undefined)v1=new((Vector3Module||getVector3Module()).Vector3);r=vFrom.dot(vTo)+1;if(r<EPS){r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){v1.set(-vFrom.y,vFrom.x,0)}else{v1.set(0,-vFrom.z,vFrom.y)}}else{v1.crossVectors(vFrom,vTo)}this._x=v1.x;this._y=v1.y;this._z=v1.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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)},normalize:function(){var l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1}else{l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l}this.onChangeCallback();return this},multiply:function(q,p){if(p!==undefined){Three.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(q,p)}return this.multiplyQuaternions(this,q)},multiplyQuaternions:function(a,b){var qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;var qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.onChangeCallback();return this},multiplyVector3:function(vector){Three.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return vector.applyQuaternion(this)},slerp:function(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);var x=this._x,y=this._y,z=this._z,w=this._w;var cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta}else{this.copy(qb)}if(cosHalfTheta>=1){this._w=w;this._x=x;this._y=y;this._z=z;return this}var halfTheta=Math.acos(cosHalfTheta);var sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){this._w=.5*(w+this._w);this._x=.5*(x+this._x);this._y=.5*(y+this._y);this._z=.5*(z+this._z);return this}var ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this.onChangeCallback();return this},equals:function(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w},fromArray:function(array,offset){if(offset===undefined)offset=0;this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this.onChangeCallback();return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array},onChange:function(callback){this.onChangeCallback=callback;return this},onChangeCallback:function(){},clone:function(){return new Quaternion(this._x,this._y,this._z,this._w)}};Quaternion.slerp=function(qa,qb,qm,t){return qm.copy(qa).slerp(qb,t)};Quaternion.prototype.isQuaternion=true;exports.Quaternion=Quaternion},{"../Three":1,"./Vector3":28}],25:[function(require,module,exports){var Vector3Module=require("./Vector3");var Ray;Ray=function(origin,direction){this.origin=origin!==undefined?origin:new Vector3Module.Vector3;this.direction=direction!==undefined?direction:new Vector3Module.Vector3};Ray.prototype={constructor:Ray,set:function(origin,direction){this.origin.copy(origin);this.direction.copy(direction);return this},copy:function(ray){this.origin.copy(ray.origin);this.direction.copy(ray.direction);return this},at:function(t,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;return result.copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var v1=new Vector3Module.Vector3;return function(t){this.origin.copy(this.at(t,v1));return this}}(),closestPointToPoint:function(point,optionalTarget){var result=optionalTarget||new Vector3Module.Vector3;result.subVectors(point,this.origin);var directionDistance=result.dot(this.direction);if(directionDistance<0){return result.copy(this.origin)}return result.copy(this.direction).multiplyScalar(directionDistance).add(this.origin)},distanceToPoint:function(){var v1=new Vector3Module.Vector3;return function(point){var directionDistance=v1.subVectors(point,this.origin).dot(this.direction);if(directionDistance<0){return this.origin.distanceTo(point)}v1.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);return v1.distanceTo(point)}}(),distanceSqToSegment:function(){var segCenter=new Vector3Module.Vector3;var segDir=new Vector3Module.Vector3;var diff=new Vector3Module.Vector3;return function(v0,v1,optionalPointOnRay,optionalPointOnSegment){segCenter.copy(v0).add(v1).multiplyScalar(.5);segDir.copy(v1).sub(v0).normalize();diff.copy(this.origin).sub(segCenter);var segExtent=v0.distanceTo(v1)*.5;var a01=-this.direction.dot(segDir);var b0=diff.dot(this.direction);var b1=-diff.dot(segDir);var c=diff.lengthSq();var det=Math.abs(1-a01*a01);var s0,s1,sqrDist,extDet;if(det>0){s0=a01*b1-b0;s1=a01*b0-b1;extDet=segExtent*det;if(s0>=0){if(s1>=-extDet){if(s1<=extDet){var invDet=1/det;s0*=invDet;s1*=invDet;sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c}else{s1=segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}}else{s1=-segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}}else{if(s1<=-extDet){s0=Math.max(0,-(-a01*segExtent+b0));s1=s0>0?-segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c}else if(s1<=extDet){s0=0;s1=Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=s1*(s1+2*b1)+c}else{s0=Math.max(0,-(a01*segExtent+b0));s1=s0>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c}}}else{s1=a01>0?-segExtent:segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c}if(optionalPointOnRay){optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin)}if(optionalPointOnSegment){optionalPointOnSegment.copy(segDir).multiplyScalar(s1).add(segCenter)}return sqrDist}}(),isIntersectionSphere:function(sphere){return this.distanceToPoint(sphere.center)<=sphere.radius},intersectSphere:function(){var v1=new Vector3Module.Vector3;return function(sphere,optionalTarget){v1.subVectors(sphere.center,this.origin);var tca=v1.dot(this.direction);var d2=v1.dot(v1)-tca*tca;var radius2=sphere.radius*sphere.radius;if(d2>radius2)return null;var thc=Math.sqrt(radius2-d2);var t0=tca-thc;var t1=tca+thc;if(t0<0&&t1<0)return null;if(t0<0)return this.at(t1,optionalTarget);return this.at(t0,optionalTarget)}}(),isIntersectionPlane:function(plane){var distToPoint=plane.distanceToPoint(this.origin);if(distToPoint===0){return true}var denominator=plane.normal.dot(this.direction);if(denominator*distToPoint<0){return true}return false},distanceToPlane:function(plane){var denominator=plane.normal.dot(this.direction);if(denominator==0){if(plane.distanceToPoint(this.origin)==0){return 0}return null}var t=-(this.origin.dot(plane.normal)+plane.constant)/denominator;return t>=0?t:null},intersectPlane:function(plane,optionalTarget){var t=this.distanceToPlane(plane);if(t===null){return null}return this.at(t,optionalTarget)},isIntersectionBox:function(){var v=new Vector3Module.Vector3;return function(box){return this.intersectBox(box,v)!==null}}(),intersectBox:function(box,optionalTarget){var tmin,tmax,tymin,tymax,tzmin,tzmax;var invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/this.direction.z;var origin=this.origin;if(invdirx>=0){tmin=(box.min.x-origin.x)*invdirx;tmax=(box.max.x-origin.x)*invdirx}else{tmin=(box.max.x-origin.x)*invdirx;tmax=(box.min.x-origin.x)*invdirx}if(invdiry>=0){tymin=(box.min.y-origin.y)*invdiry;tymax=(box.max.y-origin.y)*invdiry}else{tymin=(box.max.y-origin.y)*invdiry;tymax=(box.min.y-origin.y)*invdiry}if(tmin>tymax||tymin>tmax)return null;if(tymin>tmin||tmin!==tmin)tmin=tymin;if(tymax<tmax||tmax!==tmax)tmax=tymax;if(invdirz>=0){tzmin=(box.min.z-origin.z)*invdirz;tzmax=(box.max.z-origin.z)*invdirz}else{tzmin=(box.max.z-origin.z)*invdirz;tzmax=(box.min.z-origin.z)*invdirz}if(tmin>tzmax||tzmin>tmax)return null;if(tzmin>tmin||tmin!==tmin)tmin=tzmin;if(tzmax<tmax||tmax!==tmax)tmax=tzmax;if(tmax<0)return null;return this.at(tmin>=0?tmin:tmax,optionalTarget)},intersectTriangle:function(){var diff=new Vector3Module.Vector3;var edge1=new Vector3Module.Vector3;var edge2=new Vector3Module.Vector3;var normal=new Vector3Module.Vector3;return function(a,b,c,backfaceCulling,optionalTarget){edge1.subVectors(b,a);edge2.subVectors(c,a);normal.crossVectors(edge1,edge2);var DdN=this.direction.dot(normal);var sign;if(DdN>0){if(backfaceCulling)return null;sign=1}else if(DdN<0){sign=-1;DdN=-DdN}else{return null}diff.subVectors(this.origin,a);var DdQxE2=sign*this.direction.dot(edge2.crossVectors(diff,edge2));if(DdQxE2<0){return null}var DdE1xQ=sign*this.direction.dot(edge1.cross(diff));if(DdE1xQ<0){return null}if(DdQxE2+DdE1xQ>DdN){return null}var QdN=-sign*diff.dot(normal);if(QdN<0){return null}return this.at(QdN/DdN,optionalTarget)}}(),applyMatrix4:function(matrix4){this.direction.add(this.origin).applyMatrix4(matrix4);this.origin.applyMatrix4(matrix4);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(ray){return ray.origin.equals(this.origin)&&ray.direction.equals(this.direction)},clone:function(){return(new Ray).copy(this)}};Ray.prototype.isRay=true;exports.Ray=Ray},{"./Vector3":28}],26:[function(require,module,exports){var Box3Module,getBox3Module=function(){return Box3Module=require("./Box3")};var Vector3Module=require("./Vector3");var Sphere;Sphere=function(center,radius){this.center=center!==undefined?center:new Vector3Module.Vector3;this.radius=radius!==undefined?radius:0};Sphere.prototype={constructor:Sphere,set:function(center,radius){this.center.copy(center);this.radius=radius;return this},setFromPoints:function(){var box;return function(points,optionalCenter){if(box===undefined)box=new((Box3Module||getBox3Module()).Box3);var center=this.center;if(optionalCenter!==undefined){center.copy(optionalCenter)}else{box.setFromPoints(points).center(center)}var maxRadiusSq=0;for(var i=0,il=points.length;i<il;i++){maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(points[i]))}this.radius=Math.sqrt(maxRadiusSq);return this}}(),copy:function(sphere){this.center.copy(sphere.center);this.radius=sphere.radius;return this},empty:function(){return this.radius<=0},containsPoint:function(point){return point.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(point){return point.distanceTo(this.center)-this.radius},intersectsSphere:function(sphere){var radiusSum=this.radius+sphere.radius;return sphere.center.distanceToSquared(this.center)<=radiusSum*radiusSum},clampPoint:function(point,optionalTarget){var deltaLengthSq=this.center.distanceToSquared(point);var result=optionalTarget||new Vector3Module.Vector3;result.copy(point);if(deltaLengthSq>this.radius*this.radius){result.sub(this.center).normalize();result.multiplyScalar(this.radius).add(this.center)}return result},getBoundingBox:function(optionalTarget){var box=optionalTarget||new((Box3Module||getBox3Module()).Box3);box.set(this.center,this.center);box.expandByScalar(this.radius);return box},applyMatrix4:function(matrix){this.center.applyMatrix4(matrix);this.radius=this.radius*matrix.getMaxScaleOnAxis();return this},translate:function(offset){this.center.add(offset);return this},equals:function(sphere){return sphere.center.equals(this.center)&&sphere.radius===this.radius},clone:function(){return(new Sphere).copy(this)}};Sphere.prototype.isSphere=true;exports.Sphere=Sphere},{"./Box3":16,"./Vector3":28}],27:[function(require,module,exports){var Three=require("../Three");var Vector2;Vector2=function(x,y){this.x=x||0;this.y=y||0};Vector2.prototype={constructor:Vector2,set:function(x,y){this.x=x;this.y=y;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;return this},addScalar:function(s){this.x+=s;this.y+=s;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},sub:function(v,w){if(w!==undefined){Three.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;return this},subScalar:function(s){this.x-=s;this.y-=s;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(v){this.x*=v.x;this.y*=v.y;return this},multiplyScalar:function(s){this.x*=s;this.y*=s;return this},divide:function(v){this.x/=v.x;this.y/=v.y;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar}else{this.x=0;this.y=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector2;max=new Vector2}min.set(minVal,minVal);max.set(maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(v){return this.x*v.x+this.y*v.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(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x,dy=this.y-v.y;return dx*dx+dy*dy},setLength:function(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];return this},clone:function(){return new Vector2(this.x,this.y)}};Vector2.prototype.isVector2=true;exports.Vector2=Vector2},{"../Three":1}],28:[function(require,module,exports){var MathModule=require("./Math");var Matrix4Module,getMatrix4Module=function(){return Matrix4Module=require("./Matrix4")};var QuaternionModule,getQuaternionModule=function(){return QuaternionModule=require("./Quaternion")};var Three=require("../Three");var Vector3;var instance;Vector3=function(x,y,z){this.x=x||0;this.y=y||0;this.z=z||0};Vector3.prototype={constructor:Vector3,set:function(x,y,z){this.x=x;this.y=y;this.z=z;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(v,w)}this.x*=v.x;this.y*=v.y;this.z*=v.z;return this},multiplyScalar:function(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;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},applyEuler:function(){var quaternion;return function(euler){if((!!(instance=euler)&&!!instance.isEuler)===false){Three.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromEuler(euler));return this}}(),applyAxisAngle:function(){var quaternion;return function(axis,angle){if(quaternion===undefined)quaternion=new((QuaternionModule||getQuaternionModule()).Quaternion);this.applyQuaternion(quaternion.setFromAxisAngle(axis,angle));return this}}(),applyMatrix3:function(m){var x=this.x;var y=this.y;var z=this.z;var e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this},applyMatrix4:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12];this.y=e[1]*x+e[5]*y+e[9]*z+e[13];this.z=e[2]*x+e[6]*y+e[10]*z+e[14];return this},applyProjection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;var d=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*d;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*d;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*d;return this},applyQuaternion:function(q){var x=this.x;var y=this.y;var z=this.z;var qx=q.x;var qy=q.y;var qz=q.z;var qw=q.w;var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;this.x=ix*qw+iw*-qx+iy*-qz-iz*-qy;this.y=iy*qw+iw*-qy+iz*-qx-ix*-qz;this.z=iz*qw+iw*-qz+ix*-qy-iy*-qx;return this},project:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.projectionMatrix,matrix.getInverse(camera.matrixWorld));return this.applyProjection(matrix)}}(),unproject:function(){var matrix;return function(camera){if(matrix===undefined)matrix=new((Matrix4Module||getMatrix4Module()).Matrix4);matrix.multiplyMatrices(camera.matrixWorld,matrix.getInverse(camera.projectionMatrix));return this.applyProjection(matrix)}}(),transformDirection:function(m){var x=this.x,y=this.y,z=this.z;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;this.normalize();return this},divide:function(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar}else{this.x=0;this.y=0;this.z=0}return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector3;max=new Vector3}min.set(minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.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(l){var oldLength=this.length();if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},cross:function(v,w){if(w!==undefined){Three.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(v,w)}var x=this.x,y=this.y,z=this.z;this.x=y*v.z-z*v.y;this.y=z*v.x-x*v.z;this.z=x*v.y-y*v.x;return this},crossVectors:function(a,b){var ax=a.x,ay=a.y,az=a.z;var bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this},projectOnVector:function(){var v1,dot;return function(vector){if(v1===undefined)v1=new Vector3;v1.copy(vector).normalize();dot=this.dot(v1);return this.copy(v1).multiplyScalar(dot)}}(),projectOnPlane:function(){var v1;return function(planeNormal){if(v1===undefined)v1=new Vector3;v1.copy(this).projectOnVector(planeNormal);return this.sub(v1)}}(),reflect:function(){var v1;return function(normal){if(v1===undefined)v1=new Vector3;return this.sub(v1.copy(normal).multiplyScalar(2*this.dot(normal)))}}(),angleTo:function(v){var theta=this.dot(v)/(this.length()*v.length());return Math.acos(MathModule.Math.clamp(theta,-1,1))},distanceTo:function(v){return Math.sqrt(this.distanceToSquared(v))},distanceToSquared:function(v){var dx=this.x-v.x;var dy=this.y-v.y;var dz=this.z-v.z;return dx*dx+dy*dy+dz*dz},setEulerFromRotationMatrix:function(m,order){Three.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(q,order){Three.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(m){Three.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(m)},getScaleFromMatrix:function(m){Three.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(m)},getColumnFromMatrix:function(index,matrix){Three.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(index,matrix)},setFromMatrixPosition:function(m){this.x=m.elements[12];this.y=m.elements[13];this.z=m.elements[14];return this},setFromMatrixScale:function(m){var sx=this.set(m.elements[0],m.elements[1],m.elements[2]).length();var sy=this.set(m.elements[4],m.elements[5],m.elements[6]).length();var sz=this.set(m.elements[8],m.elements[9],m.elements[10]).length();this.x=sx;this.y=sy;this.z=sz;return this},setFromMatrixColumn: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){return v.x===this.x&&v.y===this.y&&v.z===this.z},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];return this},clone:function(){return new Vector3(this.x,this.y,this.z)}};Vector3.prototype.isVector3=true;exports.Vector3=Vector3},{"../Three":1,"./Math":20,"./Matrix4":22,"./Quaternion":24}],29:[function(require,module,exports){var Three=require("../Three");var Vector4;Vector4=function(x,y,z,w){this.x=x||0;this.y=y||0;this.z=z||0;this.w=w!==undefined?w:1};Vector4.prototype={constructor:Vector4,set:function(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this},setX:function(x){this.x=x;return this},setY:function(y){this.y=y;return this},setZ:function(z){this.z=z;return this},setW:function(w){this.w=w;return this},setComponent:function(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw new Error("index is out of range: "+index)}},getComponent:function(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+index)}},copy:function(v){this.x=v.x;this.y=v.y;this.z=v.z;this.w=v.w!==undefined?v.w:1;return this},add:function(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(v,w)}this.x+=v.x;this.y+=v.y;this.z+=v.z;this.w+=v.w;return this},addScalar:function(s){this.x+=s;this.y+=s;this.z+=s;this.w+=s;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(v,w){if(w!==undefined){Three.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(v,w)}this.x-=v.x;this.y-=v.y;this.z-=v.z;this.w-=v.w;return this},subScalar:function(s){this.x-=s;this.y-=s;this.z-=s;this.w-=s;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(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;this.w*=scalar;return this},applyMatrix4:function(m){var x=this.x;var y=this.y;var z=this.z;var w=this.w;var e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12]*w;this.y=e[1]*x+e[5]*y+e[9]*z+e[13]*w;this.z=e[2]*x+e[6]*y+e[10]*z+e[14]*w;this.w=e[3]*x+e[7]*y+e[11]*z+e[15]*w;return this},divideScalar:function(scalar){if(scalar!==0){var invScalar=1/scalar;this.x*=invScalar;this.y*=invScalar;this.z*=invScalar;this.w*=invScalar}else{this.x=0;this.y=0;this.z=0;this.w=1}return this},setAxisAngleFromQuaternion:function(q){this.w=2*Math.acos(q.w);var s=Math.sqrt(1-q.w*q.w);if(s<1e-4){this.x=1;this.y=0;this.z=0}else{this.x=q.x/s;this.y=q.y/s;this.z=q.z/s}return this},setAxisAngleFromRotationMatrix:function(m){var angle,x,y,z,epsilon=.01,epsilon2=.1,te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(Math.abs(m12-m21)<epsilon&&Math.abs(m13-m31)<epsilon&&Math.abs(m23-m32)<epsilon){if(Math.abs(m12+m21)<epsilon2&&Math.abs(m13+m31)<epsilon2&&Math.abs(m23+m32)<epsilon2&&Math.abs(m11+m22+m33-3)<epsilon2){this.set(1,0,0,0);return this}angle=Math.PI;var xx=(m11+1)/2;var yy=(m22+1)/2;var zz=(m33+1)/2;var xy=(m12+m21)/4;var xz=(m13+m31)/4;var yz=(m23+m32)/4;if(xx>yy&&xx>zz){if(xx<epsilon){x=0;y=.707106781;z=.707106781}else{x=Math.sqrt(xx);y=xy/x;z=xz/x}}else if(yy>zz){if(yy<epsilon){x=.707106781;y=0;z=.707106781}else{y=Math.sqrt(yy);x=xy/y;z=yz/y}}else{if(zz<epsilon){x=.707106781;y=.707106781;z=0}else{z=Math.sqrt(zz);x=xz/z;y=yz/z}}this.set(x,y,z,angle);return this}var s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));if(Math.abs(s)<.001)s=1;this.x=(m32-m23)/s;this.y=(m13-m31)/s;this.z=(m21-m12)/s;this.w=Math.acos((m11+m22+m33-1)/2);return this},min:function(v){if(this.x>v.x){this.x=v.x}if(this.y>v.y){this.y=v.y}if(this.z>v.z){this.z=v.z}if(this.w>v.w){this.w=v.w}return this},max:function(v){if(this.x<v.x){this.x=v.x}if(this.y<v.y){this.y=v.y}if(this.z<v.z){this.z=v.z}if(this.w<v.w){this.w=v.w}return this},clamp:function(min,max){if(this.x<min.x){this.x=min.x}else if(this.x>max.x){this.x=max.x}if(this.y<min.y){this.y=min.y}else if(this.y>max.y){this.y=max.y}if(this.z<min.z){this.z=min.z}else if(this.z>max.z){this.z=max.z}if(this.w<min.w){this.w=min.w}else if(this.w>max.w){this.w=max.w}return this},clampScalar:function(){var min,max;return function(minVal,maxVal){if(min===undefined){min=new Vector4;max=new Vector4}min.set(minVal,minVal,minVal,minVal);max.set(maxVal,maxVal,maxVal,maxVal);return this.clamp(min,max)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x);this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y);this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z);this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.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(l){var oldLength=this.length();
if(oldLength!==0&&l!==oldLength){this.multiplyScalar(l/oldLength)}return this},lerp:function(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;this.w+=(v.w-this.w)*alpha;return this},lerpVectors:function(v1,v2,alpha){this.subVectors(v2,v1).multiplyScalar(alpha).add(v1);return this},equals:function(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this.w},fromArray:function(array,offset){if(offset===undefined)offset=0;this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];this.w=array[offset+3];return this},toArray:function(array,offset){if(array===undefined)array=[];if(offset===undefined)offset=0;array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;array[offset+3]=this.w;return array},fromAttribute:function(attribute,index,offset){if(offset===undefined)offset=0;index=index*attribute.itemSize+offset;this.x=attribute.array[index];this.y=attribute.array[index+1];this.z=attribute.array[index+2];this.w=attribute.array[index+3];return this},clone:function(){return new Vector4(this.x,this.y,this.z,this.w)}};Vector4.prototype.isVector4=true;exports.Vector4=Vector4},{"../Three":1}],30:[function(require,module,exports){var Vector3Module=require("../math/Vector3");var SphereModule=require("../math/Sphere");var RayModule=require("../math/Ray");var Matrix4Module=require("../math/Matrix4");var Three=require("../Three");var LineBasicMaterialModule=require("../materials/LineBasicMaterial");var GeometryModule=require("../core/Geometry");var Object3DModule=require("../core/Object3D");var Line;var instance;Line=function(geometry,material,mode){Object3DModule.Object3D.call(this);this.type="Line";this.geometry=geometry!==undefined?geometry:new GeometryModule.Geometry;this.material=material!==undefined?material:new LineBasicMaterialModule.LineBasicMaterial({color:Math.random()*16777215});this.mode=mode!==undefined?mode:Three.LineStrip};Line.prototype=Object.create(Object3DModule.Object3D.prototype);Line.prototype.constructor=Line;Line.prototype.raycast=function(){var inverseMatrix=new Matrix4Module.Matrix4;var ray=new RayModule.Ray;var sphere=new SphereModule.Sphere;return function(raycaster,intersects){var precision=raycaster.linePrecision;var precisionSq=precision*precision;var geometry=this.geometry;if(geometry.boundingSphere===null)geometry.computeBoundingSphere();sphere.copy(geometry.boundingSphere);sphere.applyMatrix4(this.matrixWorld);if(raycaster.ray.isIntersectionSphere(sphere)===false){return}inverseMatrix.getInverse(this.matrixWorld);ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);var vStart=new Vector3Module.Vector3;var vEnd=new Vector3Module.Vector3;var interSegment=new Vector3Module.Vector3;var interRay=new Vector3Module.Vector3;var step=this.mode===Three.LineStrip?1:2;if(!!(instance=geometry)&&!!instance.isBufferGeometry){var attributes=geometry.attributes;if(attributes.index!==undefined){var indices=attributes.index.array;var positions=attributes.position.array;var offsets=geometry.offsets;if(offsets.length===0){offsets=[{start:0,count:indices.length,index:0}]}for(var oi=0;oi<offsets.length;oi++){var start=offsets[oi].start;var count=offsets[oi].count;var index=offsets[oi].index;for(var i=start;i<start+count-1;i+=step){var a=index+indices[i];var b=index+indices[i+1];vStart.fromArray(positions,a*3);vEnd.fromArray(positions,b*3);var distSq=ray.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(distSq>precisionSq)continue;var distance=ray.origin.distanceTo(interRay);if(distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i,offsetIndex:oi,face:null,faceIndex:null,object:this})}}}else{var positions=attributes.position.array;for(var i=0;i<positions.length/3-1;i+=step){vStart.fromArray(positions,3*i);vEnd.fromArray(positions,3*i+3);var distSq=ray.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(distSq>precisionSq)continue;var distance=ray.origin.distanceTo(interRay);if(distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else if(!!(instance=geometry)&&!!instance.isGeometry){var vertices=geometry.vertices;var nbVertices=vertices.length;for(var i=0;i<nbVertices-1;i+=step){var distSq=ray.distanceSqToSegment(vertices[i],vertices[i+1],interRay,interSegment);if(distSq>precisionSq)continue;var distance=ray.origin.distanceTo(interRay);if(distance<raycaster.near||distance>raycaster.far)continue;intersects.push({distance:distance,point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}}();Line.prototype.clone=function(object){if(object===undefined)object=new Line(this.geometry,this.material,this.mode);Object3DModule.Object3D.prototype.clone.call(this,object);return object};Line.prototype.isLine=true;exports.Line=Line},{"../Three":1,"../core/Geometry":7,"../core/Object3D":8,"../materials/LineBasicMaterial":13,"../math/Matrix4":22,"../math/Ray":25,"../math/Sphere":26,"../math/Vector3":28}],31:[function(require,module,exports){var EventDispatcherModule=require("../core/EventDispatcher");var Vector2Module=require("../math/Vector2");var Three=require("../Three");var WebGLRenderTarget;WebGLRenderTarget=function(width,height,options){this.width=width;this.height=height;options=options||{};this.wrapS=options.wrapS!==undefined?options.wrapS:Three.ClampToEdgeWrapping;this.wrapT=options.wrapT!==undefined?options.wrapT:Three.ClampToEdgeWrapping;this.magFilter=options.magFilter!==undefined?options.magFilter:Three.LinearFilter;this.minFilter=options.minFilter!==undefined?options.minFilter:Three.LinearMipMapLinearFilter;this.anisotropy=options.anisotropy!==undefined?options.anisotropy:1;this.offset=new Vector2Module.Vector2(0,0);this.repeat=new Vector2Module.Vector2(1,1);this.format=options.format!==undefined?options.format:Three.RGBAFormat;this.type=options.type!==undefined?options.type:Three.UnsignedByteType;this.depthBuffer=options.depthBuffer!==undefined?options.depthBuffer:true;this.stencilBuffer=options.stencilBuffer!==undefined?options.stencilBuffer:true;this.generateMipmaps=true;this.shareDepthFrom=options.shareDepthFrom!==undefined?options.shareDepthFrom:null};WebGLRenderTarget.prototype={constructor:WebGLRenderTarget,setSize:function(width,height){this.width=width;this.height=height},clone:function(){var tmp=new WebGLRenderTarget(this.width,this.height);tmp.wrapS=this.wrapS;tmp.wrapT=this.wrapT;tmp.magFilter=this.magFilter;tmp.minFilter=this.minFilter;tmp.anisotropy=this.anisotropy;tmp.offset.copy(this.offset);tmp.repeat.copy(this.repeat);tmp.format=this.format;tmp.type=this.type;tmp.depthBuffer=this.depthBuffer;tmp.stencilBuffer=this.stencilBuffer;tmp.generateMipmaps=this.generateMipmaps;tmp.shareDepthFrom=this.shareDepthFrom;return tmp},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(WebGLRenderTarget.prototype);WebGLRenderTarget.prototype.isWebGLRenderTarget=true;exports.WebGLRenderTarget=WebGLRenderTarget},{"../Three":1,"../core/EventDispatcher":5,"../math/Vector2":27}],32:[function(require,module,exports){var ShaderChunk;ShaderChunk={alphatest_fragment:"#ifdef ALPHATEST\r\n\r\n if ( diffuseColor.a < ALPHATEST ) discard;\r\n\r\n#endif\r\n",alphamap_fragment:"#ifdef USE_ALPHAMAP\r\n\r\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\r\n\r\n#endif\r\n",color_fragment:"#ifdef USE_COLOR\r\n\r\n diffuseColor.rgb *= vColor;\r\n\r\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\r\n\r\n uniform sampler2D alphaMap;\r\n\r\n#endif\r\n",color_pars_fragment:"#ifdef USE_COLOR\r\n\r\n varying vec3 vColor;\r\n\r\n#endif\r\n",color_pars_vertex:"#ifdef USE_COLOR\r\n\r\n varying vec3 vColor;\r\n\r\n#endif",color_vertex:"#ifdef USE_COLOR\r\n\r\n vColor.xyz = inputToLinear( color.xyz );\r\n\r\n#endif",defaultnormal_vertex:"#ifdef USE_SKINNING\r\n\r\n vec3 objectNormal = skinnedNormal.xyz;\r\n\r\n#elif defined( USE_MORPHNORMALS )\r\n\r\n vec3 objectNormal = morphedNormal;\r\n\r\n#else\r\n\r\n vec3 objectNormal = normal;\r\n\r\n#endif\r\n\r\n#ifdef FLIP_SIDED\r\n\r\n objectNormal = -objectNormal;\r\n\r\n#endif\r\n\r\nvec3 transformedNormal = normalMatrix * objectNormal;\r\n",envmap_pars_fragment:"#ifdef USE_ENVMAP\r\n\r\n uniform float reflectivity;\r\n #ifdef ENVMAP_TYPE_CUBE\r\n uniform samplerCube envMap;\r\n #else\r\n uniform sampler2D envMap;\r\n #endif\r\n uniform float flipEnvMap;\r\n\r\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\r\n\r\n uniform float refractionRatio;\r\n\r\n #else\r\n\r\n varying vec3 vReflect;\r\n\r\n #endif\r\n\r\n#endif\r\n",default_vertex:"#ifdef USE_SKINNING\r\n\r\n vec4 mvPosition = modelViewMatrix * skinned;\r\n\r\n#elif defined( USE_MORPHTARGETS )\r\n\r\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\r\n\r\n#else\r\n\r\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\r\n\r\n#endif\r\n\r\ngl_Position = projectionMatrix * mvPosition;\r\n",envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\r\n\r\n varying vec3 vReflect;\r\n\r\n uniform float refractionRatio;\r\n\r\n#endif\r\n",envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\r\n\r\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\r\n\r\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\r\n\r\n #ifdef ENVMAP_MODE_REFLECTION\r\n\r\n vReflect = reflect( cameraToVertex, worldNormal );\r\n\r\n #else\r\n\r\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\r\n\r\n #endif\r\n\r\n#endif\r\n",fog_pars_fragment:"#ifdef USE_FOG\r\n\r\n uniform vec3 fogColor;\r\n\r\n #ifdef FOG_EXP2\r\n\r\n uniform float fogDensity;\r\n\r\n #else\r\n\r\n uniform float fogNear;\r\n uniform float fogFar;\r\n #endif\r\n\r\n#endif",fog_fragment:"#ifdef USE_FOG\r\n\r\n #ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\r\n\r\n #else\r\n\r\n float depth = gl_FragCoord.z / gl_FragCoord.w;\r\n\r\n #endif\r\n\r\n #ifdef FOG_EXP2\r\n\r\n float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\r\n fogFactor = whiteCompliment( fogFactor );\r\n\r\n #else\r\n\r\n float fogFactor = smoothstep( fogNear, fogFar, depth );\r\n\r\n #endif\r\n \r\n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\r\n\r\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\r\n\r\n varying vec2 vUv2;\r\n uniform sampler2D lightMap;\r\n\r\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\r\n\r\n varying vec2 vUv2;\r\n\r\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\r\n\r\n vUv2 = uv2;\r\n\r\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\r\n\r\n uniform sampler2D bumpMap;\r\n uniform float bumpScale;\r\n\r\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\r\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\r\n\r\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\r\n\r\n vec2 dHdxy_fwd() {\r\n\r\n vec2 dSTdx = dFdx( vUv );\r\n vec2 dSTdy = dFdy( vUv );\r\n\r\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\r\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\r\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\r\n\r\n return vec2( dBx, dBy );\r\n\r\n }\r\n\r\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\r\n\r\n vec3 vSigmaX = dFdx( surf_pos );\r\n vec3 vSigmaY = dFdy( surf_pos );\r\n vec3 vN = surf_norm; // normalized\r\n\r\n vec3 R1 = cross( vSigmaY, vN );\r\n vec3 R2 = cross( vN, vSigmaX );\r\n\r\n float fDet = dot( vSigmaX, R1 );\r\n\r\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\r\n return normalize( abs( fDet ) * surf_norm - vGrad );\r\n\r\n }\r\n\r\n#endif\r\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\r\n\r\n outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\r\n\r\n#endif",common:"#define PI 3.14159\r\n#define PI2 6.28318\r\n#define RECIPROCAL_PI2 0.15915494\r\n#define LOG2 1.442695\r\n#define EPSILON 1e-6\r\n\r\nfloat square( in float a ) { return a*a; }\r\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\r\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\r\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\r\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\r\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\r\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\r\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\r\nfloat average( in float a ) { return a; }\r\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\r\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\r\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\r\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\r\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\r\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\r\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\r\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\r\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\r\n}\r\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\r\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\r\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\r\n}\r\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\r\n float distance = dot( planeNormal, point-pointOnPlane );\r\n return point - distance * planeNormal;\r\n}\r\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\r\n return sign( dot( point - pointOnPlane, planeNormal ) );\r\n}\r\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\r\n return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\r\n}\r\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\r\n if ( decayExponent > 0.0 ) {\r\n return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\r\n }\r\n return 1.0;\r\n}\r\n\r\nvec3 inputToLinear( in vec3 a ) {\r\n#ifdef GAMMA_INPUT\r\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\r\n#else\r\n return a;\r\n#endif\r\n}\r\nvec3 linearToOutput( in vec3 a ) {\r\n#ifdef GAMMA_OUTPUT\r\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\r\n#else\r\n return a;\r\n#endif\r\n}\r\n",envmap_fragment:"#ifdef USE_ENVMAP\r\n\r\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\r\n\r\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\r\n\r\n // Transforming Normal Vectors with the Inverse Transformation\r\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\r\n\r\n #ifdef ENVMAP_MODE_REFLECTION\r\n\r\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\r\n\r\n #else\r\n\r\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\r\n\r\n #endif\r\n\r\n #else\r\n\r\n vec3 reflectVec = vReflect;\r\n\r\n #endif\r\n\r\n #ifdef DOUBLE_SIDED\r\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n #else\r\n float flipNormal = 1.0;\r\n #endif\r\n\r\n #ifdef ENVMAP_TYPE_CUBE\r\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\r\n\r\n #elif defined( ENVMAP_TYPE_EQUIREC )\r\n vec2 sampleUV;\r\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\r\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\r\n vec4 envColor = texture2D( envMap, sampleUV );\r\n\r\n #elif defined( ENVMAP_TYPE_SPHERE )\r\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\r\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\r\n #endif\r\n\r\n envColor.xyz = inputToLinear( envColor.xyz );\r\n\r\n #ifdef ENVMAP_BLENDING_MULTIPLY\r\n\r\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\r\n\r\n #elif defined( ENVMAP_BLENDING_MIX )\r\n\r\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\r\n\r\n #elif defined( ENVMAP_BLENDING_ADD )\r\n\r\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\r\n\r\n #endif\r\n\r\n#endif\r\n",lights_lambert_pars_vertex:"uniform vec3 ambientLightColor;\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\r\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_HEMI_LIGHTS > 0\r\n\r\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\r\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\r\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\r\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\r\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\r\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\r\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\r\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#ifdef WRAP_AROUND\r\n\r\n uniform vec3 wrapRGB;\r\n\r\n#endif\r\n",lights_phong_vertex:"#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\r\n\r\n vWorldPosition = worldPosition.xyz;\r\n\r\n#endif",linear_to_gamma_fragment:"\r\n outgoingLight = linearToOutput( outgoingLight );\r\n",lights_phong_pars_vertex:"#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\r\n\r\n varying vec3 vWorldPosition;\r\n\r\n#endif\r\n",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\r\n\r\n uniform float logDepthBufFC;\r\n\r\n #ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n #extension GL_EXT_frag_depth : enable\r\n varying float vFragDepth;\r\n\r\n #endif\r\n\r\n#endif",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\r\n\r\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\r\n\r\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\r\n\r\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\r\n\r\n #ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n vFragDepth = 1.0 + gl_Position.w;\r\n\r\n#else\r\n\r\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\r\n\r\n #endif\r\n\r\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\r\n\r\n #ifdef USE_LOGDEPTHBUF_EXT\r\n\r\n varying float vFragDepth;\r\n\r\n #endif\r\n\r\n uniform float logDepthBufFC;\r\n\r\n#endif",map_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\r\n\r\n varying vec2 vUv;\r\n\r\n#endif\r\n\r\n#ifdef USE_MAP\r\n\r\n uniform sampler2D map;\r\n\r\n#endif",map_fragment:"#ifdef USE_MAP\r\n\r\n vec4 texelColor = texture2D( map, vUv );\r\n\r\n texelColor.xyz = inputToLinear( texelColor.xyz );\r\n\r\n diffuseColor *= texelColor;\r\n\r\n#endif",lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\r\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_HEMI_LIGHTS > 0\r\n\r\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\r\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\r\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\r\n\r\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\r\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\r\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\r\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\r\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\r\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\r\n\r\n varying vec3 vWorldPosition;\r\n\r\n#endif\r\n\r\n#ifdef WRAP_AROUND\r\n\r\n uniform vec3 wrapRGB;\r\n\r\n#endif\r\n\r\nvarying vec3 vViewPosition;\r\n\r\n#ifndef FLAT_SHADED\r\n\r\n varying vec3 vNormal;\r\n\r\n#endif\r\n",map_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\r\n\r\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\r\n\r\n#endif",lights_phong_fragment:"#ifndef FLAT_SHADED\r\n\r\n vec3 normal = normalize( vNormal );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r\n\r\n #endif\r\n\r\n#else\r\n\r\n vec3 fdx = dFdx( vViewPosition );\r\n vec3 fdy = dFdy( vViewPosition );\r\n vec3 normal = normalize( cross( fdx, fdy ) );\r\n\r\n#endif\r\n\r\nvec3 viewPosition = normalize( vViewPosition );\r\n\r\n#ifdef USE_NORMALMAP\r\n\r\n normal = perturbNormal2Arb( -vViewPosition, normal );\r\n\r\n#elif defined( USE_BUMPMAP )\r\n\r\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\r\n\r\n#endif\r\n\r\nvec3 totalDiffuseLight = vec3( 0.0 );\r\nvec3 totalSpecularLight = vec3( 0.0 );\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\r\n\r\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\r\n\r\n lVector = normalize( lVector );\r\n\r\n // diffuse\r\n\r\n float dotProduct = dot( normal, lVector );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\r\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\r\n\r\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\r\n\r\n #else\r\n\r\n float pointDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n #endif\r\n\r\n totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\r\n\r\n // specular\r\n\r\n vec3 pointHalfVector = normalize( lVector + viewPosition );\r\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\r\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\r\n\r\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\r\n\r\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\r\n totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\r\n\r\n }\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\r\n\r\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\r\n\r\n lVector = normalize( lVector );\r\n\r\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\r\n\r\n if ( spotEffect > spotLightAngleCos[ i ] ) {\r\n\r\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\r\n\r\n // diffuse\r\n\r\n float dotProduct = dot( normal, lVector );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\r\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\r\n\r\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\r\n\r\n #else\r\n\r\n float spotDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n #endif\r\n\r\n totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\r\n\r\n // specular\r\n\r\n vec3 spotHalfVector = normalize( lVector + viewPosition );\r\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\r\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\r\n\r\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\r\n\r\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\r\n totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\r\n\r\n }\r\n\r\n }\r\n\r\n#endif\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\r\n\r\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\r\n\r\n // diffuse\r\n\r\n float dotProduct = dot( normal, dirVector );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\r\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\r\n\r\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\r\n\r\n #else\r\n\r\n float dirDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n #endif\r\n\r\n totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\r\n\r\n // specular\r\n\r\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\r\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\r\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\r\n\r\n /*\r\n // fresnel term from skin shader\r\n const float F0 = 0.128;\r\n\r\n float base = 1.0 - dot( viewPosition, dirHalfVector );\r\n float exponential = pow( base, 5.0 );\r\n\r\n float fresnel = exponential + F0 * ( 1.0 - exponential );\r\n */\r\n\r\n /*\r\n // fresnel term from fresnel shader\r\n const float mFresnelBias = 0.08;\r\n const float mFresnelScale = 0.3;\r\n const float mFresnelPower = 5.0;\r\n\r\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\r\n */\r\n\r\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\r\n\r\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\r\n\r\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\r\n totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\r\n\r\n\r\n }\r\n\r\n#endif\r\n\r\n#if MAX_HEMI_LIGHTS > 0\r\n\r\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\r\n\r\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\r\n\r\n // diffuse\r\n\r\n float dotProduct = dot( normal, lVector );\r\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\r\n\r\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\r\n\r\n totalDiffuseLight += hemiColor;\r\n\r\n // specular (sky light)\r\n\r\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\r\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\r\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\r\n\r\n // specular (ground light)\r\n\r\n vec3 lVectorGround = -lVector;\r\n\r\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\r\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\r\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\r\n\r\n float dotProductGround = dot( normal, lVectorGround );\r\n\r\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\r\n\r\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\r\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\r\n totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\r\n\r\n }\r\n\r\n#endif\r\n\r\n#ifdef METAL\r\n\r\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\r\n\r\n#else\r\n\r\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\r\n\r\n#endif\r\n",map_particle_fragment:"#ifdef USE_MAP\r\n\r\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\r\n\r\n#endif\r\n",map_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\r\n\r\n varying vec2 vUv;\r\n uniform vec4 offsetRepeat;\r\n\r\n#endif\r\n",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\r\n\r\n vec3 morphedNormal = vec3( 0.0 );\r\n\r\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\r\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\r\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\r\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\r\n\r\n morphedNormal += normal;\r\n\r\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\r\n\r\n uniform vec4 offsetRepeat;\r\n uniform sampler2D map;\r\n\r\n#endif\r\n",lights_lambert_vertex:"vLightFront = vec3( 0.0 );\r\n\r\n#ifdef DOUBLE_SIDED\r\n\r\n vLightBack = vec3( 0.0 );\r\n\r\n#endif\r\n\r\ntransformedNormal = normalize( transformedNormal );\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\r\n\r\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\r\n\r\n float dotProduct = dot( transformedNormal, dirVector );\r\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\r\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\r\n\r\n #endif\r\n\r\n}\r\n\r\n#endif\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\r\n\r\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\r\n\r\n lVector = normalize( lVector );\r\n float dotProduct = dot( transformedNormal, lVector );\r\n\r\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\r\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\r\n\r\n #endif\r\n\r\n }\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\r\n\r\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\r\n\r\n if ( spotEffect > spotLightAngleCos[ i ] ) {\r\n\r\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\r\n\r\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\r\n\r\n lVector = normalize( lVector );\r\n\r\n float dotProduct = dot( transformedNormal, lVector );\r\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n #ifdef WRAP_AROUND\r\n\r\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\r\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\r\n\r\n #endif\r\n\r\n }\r\n\r\n }\r\n\r\n#endif\r\n\r\n#if MAX_HEMI_LIGHTS > 0\r\n\r\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\r\n\r\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\r\n\r\n float dotProduct = dot( transformedNormal, lVector );\r\n\r\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\r\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\r\n\r\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\r\n\r\n #ifdef DOUBLE_SIDED\r\n\r\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\r\n\r\n #endif\r\n\r\n }\r\n\r\n#endif\r\n\r\nvLightFront += ambientLightColor;\r\n\r\n#ifdef DOUBLE_SIDED\r\n\r\n vLightBack += ambientLightColor;\r\n\r\n#endif\r\n",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\r\n\r\n #ifndef USE_MORPHNORMALS\r\n\r\n uniform float morphTargetInfluences[ 8 ];\r\n\r\n #else\r\n\r\n uniform float morphTargetInfluences[ 4 ];\r\n\r\n #endif\r\n\r\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\r\n\r\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\r\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\r\n\r\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\r\n\r\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\r\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\r\n\r\n uniform float shadowDarkness[ MAX_SHADOWS ];\r\n uniform float shadowBias[ MAX_SHADOWS ];\r\n\r\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\r\n\r\n float unpackDepth( const in vec4 rgba_depth ) {\r\n\r\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\r\n float depth = dot( rgba_depth, bit_shift );\r\n return depth;\r\n\r\n }\r\n\r\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\r\n\r\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\r\n\r\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\r\n\r\n }\r\n\r\n#endif",skinbase_vertex:"#ifdef USE_SKINNING\r\n\r\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\r\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\r\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\r\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\r\n\r\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\r\n\r\n #ifdef SHADOWMAP_DEBUG\r\n\r\n vec3 frustumColors[3];\r\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\r\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\r\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\r\n\r\n #endif\r\n\r\n #ifdef SHADOWMAP_CASCADE\r\n\r\n int inFrustumCount = 0;\r\n\r\n #endif\r\n\r\n float fDepth;\r\n vec3 shadowColor = vec3( 1.0 );\r\n\r\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\r\n\r\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\r\n\r\n // if ( something && something ) breaks ATI OpenGL shader compiler\r\n // if ( all( something, something ) ) using this instead\r\n\r\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r\n bool inFrustum = all( inFrustumVec );\r\n\r\n // don't shadow pixels outside of light frustum\r\n // use just first frustum (for cascades)\r\n // don't shadow pixels behind far plane of light frustum\r\n\r\n #ifdef SHADOWMAP_CASCADE\r\n\r\n inFrustumCount += int( inFrustum );\r\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\r\n\r\n #else\r\n\r\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r\n\r\n #endif\r\n\r\n bool frustumTest = all( frustumTestVec );\r\n\r\n if ( frustumTest ) {\r\n\r\n shadowCoord.z += shadowBias[ i ];\r\n\r\n #if defined( SHADOWMAP_TYPE_PCF )\r\n\r\n // Percentage-close filtering\r\n // (9 pixel kernel)\r\n // http://fabiensanglard.net/shadowmappingPCF/\r\n\r\n float shadow = 0.0;\r\n\r\n /*\r\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\r\n // must enroll loop manually\r\n\r\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\r\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\r\n\r\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\r\n\r\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\r\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\r\n\r\n float fDepth = unpackDepth( rgbaDepth );\r\n\r\n if ( fDepth < shadowCoord.z )\r\n shadow += 1.0;\r\n\r\n }\r\n\r\n shadow /= 9.0;\r\n\r\n */\r\n\r\n const float shadowDelta = 1.0 / 9.0;\r\n\r\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\r\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\r\n\r\n float dx0 = -1.25 * xPixelOffset;\r\n float dy0 = -1.25 * yPixelOffset;\r\n float dx1 = 1.25 * xPixelOffset;\r\n float dy1 = 1.25 * yPixelOffset;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\r\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\r\n\r\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\r\n\r\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\r\n\r\n // Percentage-close filtering\r\n // (9 pixel kernel)\r\n // http://fabiensanglard.net/shadowmappingPCF/\r\n\r\n float shadow = 0.0;\r\n\r\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\r\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\r\n\r\n float dx0 = -1.0 * xPixelOffset;\r\n float dy0 = -1.0 * yPixelOffset;\r\n float dx1 = 1.0 * xPixelOffset;\r\n float dy1 = 1.0 * yPixelOffset;\r\n\r\n mat3 shadowKernel;\r\n mat3 depthKernel;\r\n\r\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\r\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\r\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\r\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\r\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\r\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\r\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\r\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\r\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\r\n\r\n vec3 shadowZ = vec3( shadowCoord.z );\r\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\r\n shadowKernel[0] *= vec3(0.25);\r\n\r\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\r\n shadowKernel[1] *= vec3(0.25);\r\n\r\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\r\n shadowKernel[2] *= vec3(0.25);\r\n\r\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\r\n\r\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\r\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\r\n\r\n vec4 shadowValues;\r\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\r\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\r\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\r\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\r\n\r\n shadow = dot( shadowValues, vec4( 1.0 ) );\r\n\r\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\r\n\r\n #else\r\n\r\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\r\n float fDepth = unpackDepth( rgbaDepth );\r\n\r\n if ( fDepth < shadowCoord.z )\r\n\r\n // spot with multiple shadows is darker\r\n\r\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\r\n\r\n // spot with multiple shadows has the same color as single shadow spot\r\n\r\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\r\n\r\n #endif\r\n\r\n }\r\n\r\n\r\n #ifdef SHADOWMAP_DEBUG\r\n\r\n #ifdef SHADOWMAP_CASCADE\r\n\r\n if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\r\n\r\n #else\r\n\r\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\r\n\r\n #endif\r\n\r\n #endif\r\n\r\n }\r\n\r\n // NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\r\n shadowColor = inputToLinear( shadowColor );\r\n\r\n outgoingLight = outgoingLight * shadowColor;\r\n\r\n#endif\r\n",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\r\n\r\n vec3 morphed = vec3( 0.0 );\r\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\r\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\r\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\r\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\r\n\r\n #ifndef USE_MORPHNORMALS\r\n\r\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\r\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\r\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\r\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\r\n\r\n #endif\r\n\r\n morphed += position;\r\n\r\n#endif",skinning_vertex:"#ifdef USE_SKINNING\r\n\r\n #ifdef USE_MORPHTARGETS\r\n\r\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\r\n\r\n #else\r\n\r\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\r\n\r\n #endif\r\n\r\n vec4 skinned = vec4( 0.0 );\r\n skinned += boneMatX * skinVertex * skinWeight.x;\r\n skinned += boneMatY * skinVertex * skinWeight.y;\r\n skinned += boneMatZ * skinVertex * skinWeight.z;\r\n skinned += boneMatW * skinVertex * skinWeight.w;\r\n skinned = bindMatrixInverse * skinned;\r\n\r\n#endif\r\n",skinnormal_vertex:"#ifdef USE_SKINNING\r\n\r\n mat4 skinMatrix = mat4( 0.0 );\r\n skinMatrix += skinWeight.x * boneMatX;\r\n skinMatrix += skinWeight.y * boneMatY;\r\n skinMatrix += skinWeight.z * boneMatZ;\r\n skinMatrix += skinWeight.w * boneMatW;\r\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\r\n\r\n #ifdef USE_MORPHNORMALS\r\n\r\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\r\n\r\n #else\r\n\r\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\r\n\r\n #endif\r\n\r\n#endif\r\n",specularmap_fragment:"float specularStrength;\r\n\r\n#ifdef USE_SPECULARMAP\r\n\r\n vec4 texelSpecular = texture2D( specularMap, vUv );\r\n specularStrength = texelSpecular.r;\r\n\r\n#else\r\n\r\n specularStrength = 1.0;\r\n\r\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\r\n\r\n uniform sampler2D normalMap;\r\n uniform vec2 normalScale;\r\n\r\n // Per-Pixel Tangent Space Normal Mapping\r\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\r\n\r\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\r\n\r\n vec3 q0 = dFdx( eye_pos.xyz );\r\n vec3 q1 = dFdy( eye_pos.xyz );\r\n vec2 st0 = dFdx( vUv.st );\r\n vec2 st1 = dFdy( vUv.st );\r\n\r\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\r\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\r\n vec3 N = normalize( surf_norm );\r\n\r\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\r\n mapN.xy = normalScale * mapN.xy;\r\n mat3 tsn = mat3( S, T, N );\r\n return normalize( tsn * mapN );\r\n\r\n }\r\n\r\n#endif\r\n",skinning_pars_vertex:"#ifdef USE_SKINNING\r\n\r\n uniform mat4 bindMatrix;\r\n uniform mat4 bindMatrixInverse;\r\n\r\n #ifdef BONE_TEXTURE\r\n\r\n uniform sampler2D boneTexture;\r\n uniform int boneTextureWidth;\r\n uniform int boneTextureHeight;\r\n\r\n mat4 getBoneMatrix( const in float i ) {\r\n\r\n float j = i * 4.0;\r\n float x = mod( j, float( boneTextureWidth ) );\r\n float y = floor( j / float( boneTextureWidth ) );\r\n\r\n float dx = 1.0 / float( boneTextureWidth );\r\n float dy = 1.0 / float( boneTextureHeight );\r\n\r\n y = dy * ( y + 0.5 );\r\n\r\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\r\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\r\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\r\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\r\n\r\n mat4 bone = mat4( v1, v2, v3, v4 );\r\n\r\n return bone;\r\n\r\n }\r\n\r\n #else\r\n\r\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\r\n\r\n mat4 getBoneMatrix( const in float i ) {\r\n\r\n mat4 bone = boneGlobalMatrices[ int(i) ];\r\n return bone;\r\n\r\n }\r\n\r\n #endif\r\n\r\n#endif\r\n",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\r\n\r\n #ifdef USE_SKINNING\r\n\r\n vec4 worldPosition = modelMatrix * skinned;\r\n\r\n #elif defined( USE_MORPHTARGETS )\r\n\r\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\r\n\r\n #else\r\n\r\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\r\n\r\n #endif\r\n\r\n#endif\r\n",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\r\n\r\n uniform sampler2D specularMap;\r\n\r\n#endif"};exports.ShaderChunk=ShaderChunk},{}],33:[function(require,module,exports){var Vector3Module=require("../../math/Vector3");var ColorModule=require("../../math/Color");var ShaderChunkModule=require("./ShaderChunk");var UniformsLibModule=require("./UniformsLib");var UniformsUtilsModule=require("./UniformsUtils");var ShaderLib;ShaderLib={basic:{uniforms:UniformsUtilsModule.UniformsUtils.merge([UniformsLibModule.UniformsLib["common"],UniformsLibModule.UniformsLib["fog"],UniformsLibModule.UniformsLib["shadowmap"]]),vertexShader:[ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["map_pars_vertex"],ShaderChunkModule.ShaderChunk["lightmap_pars_vertex"],ShaderChunkModule.ShaderChunk["envmap_pars_vertex"],ShaderChunkModule.ShaderChunk["color_pars_vertex"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["skinning_pars_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["map_vertex"],ShaderChunkModule.ShaderChunk["lightmap_vertex"],ShaderChunkModule.ShaderChunk["color_vertex"],ShaderChunkModule.ShaderChunk["skinbase_vertex"]," #ifdef USE_ENVMAP",ShaderChunkModule.ShaderChunk["morphnormal_vertex"],ShaderChunkModule.ShaderChunk["skinnormal_vertex"],ShaderChunkModule.ShaderChunk["defaultnormal_vertex"]," #endif",ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["skinning_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],ShaderChunkModule.ShaderChunk["worldpos_vertex"],ShaderChunkModule.ShaderChunk["envmap_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_fragment"],ShaderChunkModule.ShaderChunk["map_pars_fragment"],ShaderChunkModule.ShaderChunk["alphamap_pars_fragment"],ShaderChunkModule.ShaderChunk["lightmap_pars_fragment"],ShaderChunkModule.ShaderChunk["envmap_pars_fragment"],ShaderChunkModule.ShaderChunk["fog_pars_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_pars_fragment"],ShaderChunkModule.ShaderChunk["specularmap_pars_fragment"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],ShaderChunkModule.ShaderChunk["map_fragment"],ShaderChunkModule.ShaderChunk["color_fragment"],ShaderChunkModule.ShaderChunk["alphamap_fragment"],ShaderChunkModule.ShaderChunk["alphatest_fragment"],ShaderChunkModule.ShaderChunk["specularmap_fragment"]," outgoingLight = diffuseColor.rgb;",ShaderChunkModule.ShaderChunk["lightmap_fragment"],ShaderChunkModule.ShaderChunk["envmap_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_fragment"],ShaderChunkModule.ShaderChunk["linear_to_gamma_fragment"],ShaderChunkModule.ShaderChunk["fog_fragment"]," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},lambert:{uniforms:UniformsUtilsModule.UniformsUtils.merge([UniformsLibModule.UniformsLib["common"],UniformsLibModule.UniformsLib["fog"],UniformsLibModule.UniformsLib["lights"],UniformsLibModule.UniformsLib["shadowmap"],{emissive:{type:"c",value:new ColorModule.Color(0)},wrapRGB:{type:"v3",value:new Vector3Module.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;","#endif",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["map_pars_vertex"],ShaderChunkModule.ShaderChunk["lightmap_pars_vertex"],ShaderChunkModule.ShaderChunk["envmap_pars_vertex"],ShaderChunkModule.ShaderChunk["lights_lambert_pars_vertex"],ShaderChunkModule.ShaderChunk["color_pars_vertex"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["skinning_pars_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["map_vertex"],ShaderChunkModule.ShaderChunk["lightmap_vertex"],ShaderChunkModule.ShaderChunk["color_vertex"],ShaderChunkModule.ShaderChunk["morphnormal_vertex"],ShaderChunkModule.ShaderChunk["skinbase_vertex"],ShaderChunkModule.ShaderChunk["skinnormal_vertex"],ShaderChunkModule.ShaderChunk["defaultnormal_vertex"],ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["skinning_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],ShaderChunkModule.ShaderChunk["worldpos_vertex"],ShaderChunkModule.ShaderChunk["envmap_vertex"],ShaderChunkModule.ShaderChunk["lights_lambert_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform vec3 emissive;","uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;","#endif",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_fragment"],ShaderChunkModule.ShaderChunk["map_pars_fragment"],ShaderChunkModule.ShaderChunk["alphamap_pars_fragment"],ShaderChunkModule.ShaderChunk["lightmap_pars_fragment"],ShaderChunkModule.ShaderChunk["envmap_pars_fragment"],ShaderChunkModule.ShaderChunk["fog_pars_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_pars_fragment"],ShaderChunkModule.ShaderChunk["specularmap_pars_fragment"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],ShaderChunkModule.ShaderChunk["map_fragment"],ShaderChunkModule.ShaderChunk["color_fragment"],ShaderChunkModule.ShaderChunk["alphamap_fragment"],ShaderChunkModule.ShaderChunk["alphatest_fragment"],ShaderChunkModule.ShaderChunk["specularmap_fragment"]," #ifdef DOUBLE_SIDED"," if ( gl_FrontFacing )"," outgoingLight += diffuseColor.rgb * vLightFront + emissive;"," else"," outgoingLight += diffuseColor.rgb * vLightBack + emissive;"," #else"," outgoingLight += diffuseColor.rgb * vLightFront + emissive;"," #endif",ShaderChunkModule.ShaderChunk["lightmap_fragment"],ShaderChunkModule.ShaderChunk["envmap_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_fragment"],ShaderChunkModule.ShaderChunk["linear_to_gamma_fragment"],ShaderChunkModule.ShaderChunk["fog_fragment"]," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},phong:{uniforms:UniformsUtilsModule.UniformsUtils.merge([UniformsLibModule.UniformsLib["common"],UniformsLibModule.UniformsLib["bump"],UniformsLibModule.UniformsLib["normalmap"],UniformsLibModule.UniformsLib["fog"],UniformsLibModule.UniformsLib["lights"],UniformsLibModule.UniformsLib["shadowmap"],{emissive:{type:"c",value:new ColorModule.Color(0)},specular:{type:"c",value:new ColorModule.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new Vector3Module.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["map_pars_vertex"],ShaderChunkModule.ShaderChunk["lightmap_pars_vertex"],ShaderChunkModule.ShaderChunk["envmap_pars_vertex"],ShaderChunkModule.ShaderChunk["lights_phong_pars_vertex"],ShaderChunkModule.ShaderChunk["color_pars_vertex"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["skinning_pars_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["map_vertex"],ShaderChunkModule.ShaderChunk["lightmap_vertex"],ShaderChunkModule.ShaderChunk["color_vertex"],ShaderChunkModule.ShaderChunk["morphnormal_vertex"],ShaderChunkModule.ShaderChunk["skinbase_vertex"],ShaderChunkModule.ShaderChunk["skinnormal_vertex"],ShaderChunkModule.ShaderChunk["defaultnormal_vertex"],"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["skinning_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"]," vViewPosition = -mvPosition.xyz;",ShaderChunkModule.ShaderChunk["worldpos_vertex"],ShaderChunkModule.ShaderChunk["envmap_vertex"],ShaderChunkModule.ShaderChunk["lights_phong_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_fragment"],ShaderChunkModule.ShaderChunk["map_pars_fragment"],ShaderChunkModule.ShaderChunk["alphamap_pars_fragment"],ShaderChunkModule.ShaderChunk["lightmap_pars_fragment"],ShaderChunkModule.ShaderChunk["envmap_pars_fragment"],ShaderChunkModule.ShaderChunk["fog_pars_fragment"],ShaderChunkModule.ShaderChunk["lights_phong_pars_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_pars_fragment"],ShaderChunkModule.ShaderChunk["bumpmap_pars_fragment"],ShaderChunkModule.ShaderChunk["normalmap_pars_fragment"],ShaderChunkModule.ShaderChunk["specularmap_pars_fragment"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],ShaderChunkModule.ShaderChunk["map_fragment"],ShaderChunkModule.ShaderChunk["color_fragment"],ShaderChunkModule.ShaderChunk["alphamap_fragment"],ShaderChunkModule.ShaderChunk["alphatest_fragment"],ShaderChunkModule.ShaderChunk["specularmap_fragment"],ShaderChunkModule.ShaderChunk["lights_phong_fragment"],ShaderChunkModule.ShaderChunk["lightmap_fragment"],ShaderChunkModule.ShaderChunk["envmap_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_fragment"],ShaderChunkModule.ShaderChunk["linear_to_gamma_fragment"],ShaderChunkModule.ShaderChunk["fog_fragment"]," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},particle_basic:{uniforms:UniformsUtilsModule.UniformsUtils.merge([UniformsLibModule.UniformsLib["particle"],UniformsLibModule.UniformsLib["shadowmap"]]),vertexShader:["uniform float size;","uniform float scale;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["color_vertex"]," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," #ifdef USE_SIZEATTENUATION"," gl_PointSize = size * ( scale / length( mvPosition.xyz ) );"," #else"," gl_PointSize = size;"," #endif"," gl_Position = projectionMatrix * mvPosition;",ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],ShaderChunkModule.ShaderChunk["worldpos_vertex"],ShaderChunkModule.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_fragment"],ShaderChunkModule.ShaderChunk["map_particle_pars_fragment"],ShaderChunkModule.ShaderChunk["fog_pars_fragment"],ShaderChunkModule.ShaderChunk["shadowmap_pars_fragment"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( psColor, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],ShaderChunkModule.ShaderChunk["map_particle_fragment"],ShaderChunkModule.ShaderChunk["color_fragment"],ShaderChunkModule.ShaderChunk["alphatest_fragment"]," outgoingLight = diffuseColor.rgb;",ShaderChunkModule.ShaderChunk["shadowmap_fragment"],ShaderChunkModule.ShaderChunk["fog_fragment"]," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},dashed:{uniforms:UniformsUtilsModule.UniformsUtils.merge([UniformsLibModule.UniformsLib["common"],UniformsLibModule.UniformsLib["fog"],{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["color_vertex"]," vLineDistance = scale * lineDistance;"," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," gl_Position = projectionMatrix * mvPosition;",ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["color_pars_fragment"],ShaderChunkModule.ShaderChunk["fog_pars_fragment"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," if ( mod( vLineDistance, totalSize ) > dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],ShaderChunkModule.ShaderChunk["color_fragment"]," outgoingLight = diffuseColor.rgb;",ShaderChunkModule.ShaderChunk["fog_fragment"]," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"]," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {"," vNormal = normalize( normalMatrix * normal );",ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {"," gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["morphtarget_pars_vertex"],ShaderChunkModule.ShaderChunk["skinning_pars_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",ShaderChunkModule.ShaderChunk["skinbase_vertex"],ShaderChunkModule.ShaderChunk["morphtarget_vertex"],ShaderChunkModule.ShaderChunk["skinning_vertex"],ShaderChunkModule.ShaderChunk["default_vertex"],ShaderChunkModule.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:[ShaderChunkModule.ShaderChunk["common"],ShaderChunkModule.ShaderChunk["logdepthbuf_pars_fragment"],"vec4 pack_depth( const in float depth ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",ShaderChunkModule.ShaderChunk["logdepthbuf_fragment"]," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")
}};exports.ShaderLib=ShaderLib},{"../../math/Color":17,"../../math/Vector3":28,"./ShaderChunk":32,"./UniformsLib":34,"./UniformsUtils":35}],34:[function(require,module,exports){var Vector2Module=require("../../math/Vector2");var Vector4Module=require("../../math/Vector4");var ColorModule=require("../../math/Color");var UniformsLib;UniformsLib={common:{diffuse:{type:"c",value:new ColorModule.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new Vector4Module.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new Vector2Module.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new ColorModule.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new ColorModule.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new Vector4Module.Vector4(0,0,1,1)},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new ColorModule.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};exports.UniformsLib=UniformsLib},{"../../math/Color":17,"../../math/Vector2":27,"../../math/Vector4":29}],35:[function(require,module,exports){var UniformsUtils;var toString=Object.prototype.toString;var instance;UniformsUtils={merge:function(uniforms){var merged={};for(var u=0;u<uniforms.length;u++){var tmp=this.clone(uniforms[u]);for(var p in tmp){merged[p]=tmp[p]}}return merged},clone:function(uniforms_src){var uniforms_dst={};for(var u in uniforms_src){uniforms_dst[u]={};for(var p in uniforms_src[u]){var parameter_src=uniforms_src[u][p];if(!!(instance=parameter_src)&&!!instance.isColor||!!(instance=parameter_src)&&!!instance.isVector2||!!(instance=parameter_src)&&!!instance.isVector3||!!(instance=parameter_src)&&!!instance.isVector4||!!(instance=parameter_src)&&!!instance.isMatrix4||!!(instance=parameter_src)&&!!instance.isTexture){uniforms_dst[u][p]=parameter_src.clone()}else if(toString.call(parameter_src).slice(8,-1)==="Array"){uniforms_dst[u][p]=parameter_src.slice()}else{uniforms_dst[u][p]=parameter_src}}}return uniforms_dst}};exports.UniformsUtils=UniformsUtils},{}],36:[function(require,module,exports){var Three=require("../../Three");var WebGLExtensions;WebGLExtensions=function(gl){var extensions={};this.get=function(name){if(extensions[name]!==undefined){return extensions[name]}var extension;switch(name){case"EXT_texture_filter_anisotropic":extension=gl.getExtension("EXT_texture_filter_anisotropic")||gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":extension=gl.getExtension("WEBGL_compressed_texture_s3tc")||gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":extension=gl.getExtension("WEBGL_compressed_texture_pvrtc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:extension=gl.getExtension(name)}if(extension===null){Three.warn("THREE.WebGLRenderer: "+name+" extension not supported.")}extensions[name]=extension;return extension}};WebGLExtensions.prototype.isWebGLExtensions=true;exports.WebGLExtensions=WebGLExtensions},{"../../Three":1}],37:[function(require,module,exports){var WebGLShaderModule=require("./WebGLShader");var Three=require("../../Three");var instance;exports.WebGLProgram=function(){var programIdCount=0;var generateDefines=function(defines){var value,chunk,chunks=[];for(var d in defines){value=defines[d];if(value===false)continue;chunk="#define "+d+" "+value;chunks.push(chunk)}return chunks.join("\n")};var cacheUniformLocations=function(gl,program,identifiers){var uniforms={};for(var i=0,l=identifiers.length;i<l;i++){var id=identifiers[i];uniforms[id]=gl.getUniformLocation(program,id)}return uniforms};var cacheAttributeLocations=function(gl,program,identifiers){var attributes={};for(var i=0,l=identifiers.length;i<l;i++){var id=identifiers[i];attributes[id]=gl.getAttribLocation(program,id)}return attributes};return function(renderer,code,material,parameters){var _this=renderer;var _gl=_this.context;var defines=material.defines;var uniforms=material.__webglShader.uniforms;var attributes=material.attributes;var vertexShader=material.__webglShader.vertexShader;var fragmentShader=material.__webglShader.fragmentShader;var index0AttributeName=material.index0AttributeName;if(index0AttributeName===undefined&&parameters.morphTargets===true){index0AttributeName="position"}var shadowMapTypeDefine="SHADOWMAP_TYPE_BASIC";if(parameters.shadowMapType===Three.PCFShadowMap){shadowMapTypeDefine="SHADOWMAP_TYPE_PCF"}else if(parameters.shadowMapType===Three.PCFSoftShadowMap){shadowMapTypeDefine="SHADOWMAP_TYPE_PCF_SOFT"}var envMapTypeDefine="ENVMAP_TYPE_CUBE";var envMapModeDefine="ENVMAP_MODE_REFLECTION";var envMapBlendingDefine="ENVMAP_BLENDING_MULTIPLY";if(parameters.envMap){switch(material.envMap.mapping){case Three.CubeReflectionMapping:case Three.CubeRefractionMapping:envMapTypeDefine="ENVMAP_TYPE_CUBE";break;case Three.EquirectangularReflectionMapping:case Three.EquirectangularRefractionMapping:envMapTypeDefine="ENVMAP_TYPE_EQUIREC";break;case Three.SphericalReflectionMapping:envMapTypeDefine="ENVMAP_TYPE_SPHERE";break}switch(material.envMap.mapping){case Three.CubeRefractionMapping:case Three.EquirectangularRefractionMapping:envMapModeDefine="ENVMAP_MODE_REFRACTION";break}switch(material.combine){case Three.MultiplyOperation:envMapBlendingDefine="ENVMAP_BLENDING_MULTIPLY";break;case Three.MixOperation:envMapBlendingDefine="ENVMAP_BLENDING_MIX";break;case Three.AddOperation:envMapBlendingDefine="ENVMAP_BLENDING_ADD";break}}var gammaFactorDefine=renderer.gammaFactor>0?renderer.gammaFactor:1;var customDefines=generateDefines(defines);var program=_gl.createProgram();var prefix_vertex,prefix_fragment;if(!!(instance=material)&&!!instance.isRawShaderMaterial){prefix_vertex="";prefix_fragment=""}else{prefix_vertex=["precision "+parameters.precision+" float;","precision "+parameters.precision+" int;",customDefines,parameters.supportsVertexTextures?"#define VERTEX_TEXTURES":"",_this.gammaInput?"#define GAMMA_INPUT":"",_this.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+gammaFactorDefine,"#define MAX_DIR_LIGHTS "+parameters.maxDirLights,"#define MAX_POINT_LIGHTS "+parameters.maxPointLights,"#define MAX_SPOT_LIGHTS "+parameters.maxSpotLights,"#define MAX_HEMI_LIGHTS "+parameters.maxHemiLights,"#define MAX_SHADOWS "+parameters.maxShadows,"#define MAX_BONES "+parameters.maxBones,parameters.map?"#define USE_MAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap?"#define "+envMapModeDefine:"",parameters.lightMap?"#define USE_LIGHTMAP":"",parameters.bumpMap?"#define USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.vertexColors?"#define USE_COLOR":"",parameters.flatShading?"#define FLAT_SHADED":"",parameters.skinning?"#define USE_SKINNING":"",parameters.useVertexTexture?"#define BONE_TEXTURE":"",parameters.morphTargets?"#define USE_MORPHTARGETS":"",parameters.morphNormals?"#define USE_MORPHNORMALS":"",parameters.wrapAround?"#define WRAP_AROUND":"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine:"",parameters.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",parameters.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",parameters.sizeAttenuation?"#define USE_SIZEATTENUATION":"",parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",""].join("\n");prefix_fragment=["precision "+parameters.precision+" float;","precision "+parameters.precision+" int;",parameters.bumpMap||parameters.normalMap||parameters.flatShading?"#extension GL_OES_standard_derivatives : enable":"",customDefines,"#define MAX_DIR_LIGHTS "+parameters.maxDirLights,"#define MAX_POINT_LIGHTS "+parameters.maxPointLights,"#define MAX_SPOT_LIGHTS "+parameters.maxSpotLights,"#define MAX_HEMI_LIGHTS "+parameters.maxHemiLights,"#define MAX_SHADOWS "+parameters.maxShadows,parameters.alphaTest?"#define ALPHATEST "+parameters.alphaTest:"",_this.gammaInput?"#define GAMMA_INPUT":"",_this.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+gammaFactorDefine,parameters.useFog&&parameters.fog?"#define USE_FOG":"",parameters.useFog&&parameters.fogExp?"#define FOG_EXP2":"",parameters.map?"#define USE_MAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap?"#define "+envMapTypeDefine:"",parameters.envMap?"#define "+envMapModeDefine:"",parameters.envMap?"#define "+envMapBlendingDefine:"",parameters.lightMap?"#define USE_LIGHTMAP":"",parameters.bumpMap?"#define USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.vertexColors?"#define USE_COLOR":"",parameters.flatShading?"#define FLAT_SHADED":"",parameters.metal?"#define METAL":"",parameters.wrapAround?"#define WRAP_AROUND":"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine:"",parameters.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",parameters.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n")}var glVertexShader=new WebGLShaderModule.WebGLShader(_gl,_gl.VERTEX_SHADER,prefix_vertex+vertexShader);var glFragmentShader=new WebGLShaderModule.WebGLShader(_gl,_gl.FRAGMENT_SHADER,prefix_fragment+fragmentShader);_gl.attachShader(program,glVertexShader);_gl.attachShader(program,glFragmentShader);if(index0AttributeName!==undefined){_gl.bindAttribLocation(program,0,index0AttributeName)}_gl.linkProgram(program);var programLogInfo=_gl.getProgramInfoLog(program);if(_gl.getProgramParameter(program,_gl.LINK_STATUS)===false){Three.error("THREE.WebGLProgram: shader error: "+_gl.getError(),"gl.VALIDATE_STATUS",_gl.getProgramParameter(program,_gl.VALIDATE_STATUS),"gl.getPRogramInfoLog",programLogInfo)}if(programLogInfo!==""){Three.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+programLogInfo)}_gl.deleteShader(glVertexShader);_gl.deleteShader(glFragmentShader);var identifiers=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];if(parameters.useVertexTexture){identifiers.push("boneTexture");identifiers.push("boneTextureWidth");identifiers.push("boneTextureHeight")}else{identifiers.push("boneGlobalMatrices")}if(parameters.logarithmicDepthBuffer){identifiers.push("logDepthBufFC")}for(var u in uniforms){identifiers.push(u)}this.uniforms=cacheUniformLocations(_gl,program,identifiers);identifiers=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var i=0;i<parameters.maxMorphTargets;i++){identifiers.push("morphTarget"+i)}for(var i=0;i<parameters.maxMorphNormals;i++){identifiers.push("morphNormal"+i)}for(var a in attributes){identifiers.push(a)}this.attributes=cacheAttributeLocations(_gl,program,identifiers);this.attributesKeys=Object.keys(this.attributes);this.id=programIdCount++;this.code=code;this.usedTimes=1;this.program=program;this.vertexShader=glVertexShader;this.fragmentShader=glFragmentShader;return this}}();if(typeof exports.WebGLProgram==="function")exports.WebGLProgram.prototype.isWebGLProgram=true},{"../../Three":1,"./WebGLShader":38}],38:[function(require,module,exports){var Three=require("../../Three");exports.WebGLShader=function(){var addLineNumbers=function(string){var lines=string.split("\n");for(var i=0;i<lines.length;i++){lines[i]=i+1+": "+lines[i]}return lines.join("\n")};return function(gl,type,string){var shader=gl.createShader(type);gl.shaderSource(shader,string);gl.compileShader(shader);if(gl.getShaderParameter(shader,gl.COMPILE_STATUS)===false){Three.error("THREE.WebGLShader: Shader couldn't compile.")}if(gl.getShaderInfoLog(shader)!==""){Three.warn("THREE.WebGLShader: gl.getShaderInfoLog()",gl.getShaderInfoLog(shader),addLineNumbers(string))}return shader}}();if(typeof exports.WebGLShader==="function")exports.WebGLShader.prototype.isWebGLShader=true},{"../../Three":1}],39:[function(require,module,exports){var Three=require("../../Three");var WebGLState;WebGLState=function(gl,paramThreeToGL){var newAttributes=new Uint8Array(16);var enabledAttributes=new Uint8Array(16);var currentBlending=null;var currentBlendEquation=null;var currentBlendSrc=null;var currentBlendDst=null;var currentBlendEquationAlpha=null;var currentBlendSrcAlpha=null;var currentBlendDstAlpha=null;var currentDepthTest=null;var currentDepthWrite=null;var currentColorWrite=null;var currentDoubleSided=null;var currentFlipSided=null;var currentLineWidth=null;var currentPolygonOffset=null;var currentPolygonOffsetFactor=null;var currentPolygonOffsetUnits=null;this.initAttributes=function(){for(var i=0,l=newAttributes.length;i<l;i++){newAttributes[i]=0}};this.enableAttribute=function(attribute){newAttributes[attribute]=1;if(enabledAttributes[attribute]===0){gl.enableVertexAttribArray(attribute);enabledAttributes[attribute]=1}};this.disableUnusedAttributes=function(){for(var i=0,l=enabledAttributes.length;i<l;i++){if(enabledAttributes[i]!==newAttributes[i]){gl.disableVertexAttribArray(i);enabledAttributes[i]=0}}};this.setBlending=function(blending,blendEquation,blendSrc,blendDst,blendEquationAlpha,blendSrcAlpha,blendDstAlpha){if(blending!==currentBlending){if(blending===Three.NoBlending){gl.disable(gl.BLEND)}else if(blending===Three.AdditiveBlending){gl.enable(gl.BLEND);gl.blendEquation(gl.FUNC_ADD);gl.blendFunc(gl.SRC_ALPHA,gl.ONE)}else if(blending===Three.SubtractiveBlending){gl.enable(gl.BLEND);gl.blendEquation(gl.FUNC_ADD);gl.blendFunc(gl.ZERO,gl.ONE_MINUS_SRC_COLOR)}else if(blending===Three.MultiplyBlending){gl.enable(gl.BLEND);gl.blendEquation(gl.FUNC_ADD);gl.blendFunc(gl.ZERO,gl.SRC_COLOR)}else if(blending===Three.CustomBlending){gl.enable(gl.BLEND)}else{gl.enable(gl.BLEND);gl.blendEquationSeparate(gl.FUNC_ADD,gl.FUNC_ADD);gl.blendFuncSeparate(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA)}currentBlending=blending}if(blending===Three.CustomBlending){blendEquationAlpha=blendEquationAlpha||blendEquation;blendSrcAlpha=blendSrcAlpha||blendSrc;blendDstAlpha=blendDstAlpha||blendDst;if(blendEquation!==currentBlendEquation||blendEquationAlpha!==currentBlendEquationAlpha){gl.blendEquationSeparate(paramThreeToGL(blendEquation),paramThreeToGL(blendEquationAlpha));currentBlendEquation=blendEquation;currentBlendEquationAlpha=blendEquationAlpha}if(blendSrc!==currentBlendSrc||blendDst!==currentBlendDst||blendSrcAlpha!==currentBlendSrcAlpha||blendDstAlpha!==currentBlendDstAlpha){gl.blendFuncSeparate(paramThreeToGL(blendSrc),paramThreeToGL(blendDst),paramThreeToGL(blendSrcAlpha),paramThreeToGL(blendDstAlpha));currentBlendSrc=blendSrc;currentBlendDst=blendDst;currentBlendSrcAlpha=blendSrcAlpha;currentBlendDstAlpha=blendDstAlpha}}else{currentBlendEquation=null;currentBlendSrc=null;currentBlendDst=null;currentBlendEquationAlpha=null;currentBlendSrcAlpha=null;currentBlendDstAlpha=null}};this.setDepthTest=function(depthTest){if(currentDepthTest!==depthTest){if(depthTest){gl.enable(gl.DEPTH_TEST)}else{gl.disable(gl.DEPTH_TEST)}currentDepthTest=depthTest}};this.setDepthWrite=function(depthWrite){if(currentDepthWrite!==depthWrite){gl.depthMask(depthWrite);currentDepthWrite=depthWrite}};this.setColorWrite=function(colorWrite){if(currentColorWrite!==colorWrite){gl.colorMask(colorWrite,colorWrite,colorWrite,colorWrite);currentColorWrite=colorWrite}};this.setDoubleSided=function(doubleSided){if(currentDoubleSided!==doubleSided){if(doubleSided){gl.disable(gl.CULL_FACE)}else{gl.enable(gl.CULL_FACE)}currentDoubleSided=doubleSided}};this.setFlipSided=function(flipSided){if(currentFlipSided!==flipSided){if(flipSided){gl.frontFace(gl.CW)}else{gl.frontFace(gl.CCW)}currentFlipSided=flipSided}};this.setLineWidth=function(width){if(width!==currentLineWidth){gl.lineWidth(width);currentLineWidth=width}};this.setPolygonOffset=function(polygonoffset,factor,units){if(currentPolygonOffset!==polygonoffset){if(polygonoffset){gl.enable(gl.POLYGON_OFFSET_FILL)}else{gl.disable(gl.POLYGON_OFFSET_FILL)}currentPolygonOffset=polygonoffset}if(polygonoffset&&(currentPolygonOffsetFactor!==factor||currentPolygonOffsetUnits!==units)){gl.polygonOffset(factor,units);currentPolygonOffsetFactor=factor;currentPolygonOffsetUnits=units}};this.reset=function(){for(var i=0;i<enabledAttributes.length;i++){enabledAttributes[i]=0}currentBlending=null;currentDepthTest=null;currentDepthWrite=null;currentColorWrite=null;currentDoubleSided=null;currentFlipSided=null}};WebGLState.prototype.isWebGLState=true;exports.WebGLState=WebGLState},{"../../Three":1}],40:[function(require,module,exports){var Vector2Module=require("../../../math/Vector2");var Vector3Module=require("../../../math/Vector3");var LensFlarePlugin;LensFlarePlugin=function(renderer,flares){var gl=renderer.context;var vertexBuffer,elementBuffer;var program,attributes,uniforms;var hasVertexTexture;var tempTexture,occlusionTexture;var init=function(){var vertices=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]);var faces=new Uint16Array([0,1,2,0,2,3]);vertexBuffer=gl.createBuffer();elementBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,elementBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,faces,gl.STATIC_DRAW);tempTexture=gl.createTexture();occlusionTexture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tempTexture);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGB,16,16,0,gl.RGB,gl.UNSIGNED_BYTE,null);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.bindTexture(gl.TEXTURE_2D,occlusionTexture);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,16,16,0,gl.RGBA,gl.UNSIGNED_BYTE,null);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);hasVertexTexture=gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var shader;if(hasVertexTexture){shader={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}}else{shader={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}}program=createProgram(shader);attributes={vertex:gl.getAttribLocation(program,"position"),uv:gl.getAttribLocation(program,"uv")};uniforms={renderType:gl.getUniformLocation(program,"renderType"),map:gl.getUniformLocation(program,"map"),occlusionMap:gl.getUniformLocation(program,"occlusionMap"),opacity:gl.getUniformLocation(program,"opacity"),color:gl.getUniformLocation(program,"color"),scale:gl.getUniformLocation(program,"scale"),rotation:gl.getUniformLocation(program,"rotation"),screenPosition:gl.getUniformLocation(program,"screenPosition")}};this.render=function(scene,camera,viewportWidth,viewportHeight){if(flares.length===0)return;var tempPosition=new Vector3Module.Vector3;var invAspect=viewportHeight/viewportWidth,halfViewportWidth=viewportWidth*.5,halfViewportHeight=viewportHeight*.5;var size=16/viewportHeight,scale=new Vector2Module.Vector2(size*invAspect,size);var screenPosition=new Vector3Module.Vector3(1,1,0),screenPositionPixels=new Vector2Module.Vector2(1,1);if(program===undefined){init()}gl.useProgram(program);gl.enableVertexAttribArray(attributes.vertex);gl.enableVertexAttribArray(attributes.uv);gl.uniform1i(uniforms.occlusionMap,0);gl.uniform1i(uniforms.map,1);gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer);gl.vertexAttribPointer(attributes.vertex,2,gl.FLOAT,false,2*8,0);gl.vertexAttribPointer(attributes.uv,2,gl.FLOAT,false,2*8,8);gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,elementBuffer);gl.disable(gl.CULL_FACE);gl.depthMask(false);for(var i=0,l=flares.length;i<l;i++){size=16/viewportHeight;scale.set(size*invAspect,size);var flare=flares[i];tempPosition.set(flare.matrixWorld.elements[12],flare.matrixWorld.elements[13],flare.matrixWorld.elements[14]);tempPosition.applyMatrix4(camera.matrixWorldInverse);tempPosition.applyProjection(camera.projectionMatrix);screenPosition.copy(tempPosition);screenPositionPixels.x=screenPosition.x*halfViewportWidth+halfViewportWidth;screenPositionPixels.y=screenPosition.y*halfViewportHeight+halfViewportHeight;if(hasVertexTexture||screenPositionPixels.x>0&&screenPositionPixels.x<viewportWidth&&screenPositionPixels.y>0&&screenPositionPixels.y<viewportHeight){gl.activeTexture(gl.TEXTURE1);gl.bindTexture(gl.TEXTURE_2D,tempTexture);gl.copyTexImage2D(gl.TEXTURE_2D,0,gl.RGB,screenPositionPixels.x-8,screenPositionPixels.y-8,16,16,0);gl.uniform1i(uniforms.renderType,0);gl.uniform2f(uniforms.scale,scale.x,scale.y);gl.uniform3f(uniforms.screenPosition,screenPosition.x,screenPosition.y,screenPosition.z);gl.disable(gl.BLEND);gl.enable(gl.DEPTH_TEST);gl.drawElements(gl.TRIANGLES,6,gl.UNSIGNED_SHORT,0);gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,occlusionTexture);gl.copyTexImage2D(gl.TEXTURE_2D,0,gl.RGBA,screenPositionPixels.x-8,screenPositionPixels.y-8,16,16,0);gl.uniform1i(uniforms.renderType,1);gl.disable(gl.DEPTH_TEST);gl.activeTexture(gl.TEXTURE1);gl.bindTexture(gl.TEXTURE_2D,tempTexture);gl.drawElements(gl.TRIANGLES,6,gl.UNSIGNED_SHORT,0);flare.positionScreen.copy(screenPosition);if(flare.customUpdateCallback){flare.customUpdateCallback(flare)}else{flare.updateLensFlares()}gl.uniform1i(uniforms.renderType,2);gl.enable(gl.BLEND);for(var j=0,jl=flare.lensFlares.length;j<jl;j++){var sprite=flare.lensFlares[j];if(sprite.opacity>.001&&sprite.scale>.001){screenPosition.x=sprite.x;screenPosition.y=sprite.y;screenPosition.z=sprite.z;size=sprite.size*sprite.scale/viewportHeight;scale.x=size*invAspect;scale.y=size;gl.uniform3f(uniforms.screenPosition,screenPosition.x,screenPosition.y,screenPosition.z);gl.uniform2f(uniforms.scale,scale.x,scale.y);gl.uniform1f(uniforms.rotation,sprite.rotation);gl.uniform1f(uniforms.opacity,sprite.opacity);gl.uniform3f(uniforms.color,sprite.color.r,sprite.color.g,sprite.color.b);renderer.state.setBlending(sprite.blending,sprite.blendEquation,sprite.blendSrc,sprite.blendDst);renderer.setTexture(sprite.texture,1);gl.drawElements(gl.TRIANGLES,6,gl.UNSIGNED_SHORT,0)}}}}gl.enable(gl.CULL_FACE);gl.enable(gl.DEPTH_TEST);gl.depthMask(true);renderer.resetGLState()};function createProgram(shader){var program=gl.createProgram();var fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);var vertexShader=gl.createShader(gl.VERTEX_SHADER);var prefix="precision "+renderer.getPrecision()+" float;\n";gl.shaderSource(fragmentShader,prefix+shader.fragmentShader);gl.shaderSource(vertexShader,prefix+shader.vertexShader);gl.compileShader(fragmentShader);gl.compileShader(vertexShader);gl.attachShader(program,fragmentShader);gl.attachShader(program,vertexShader);gl.linkProgram(program);return program}};LensFlarePlugin.prototype.isLensFlarePlugin=true;exports.LensFlarePlugin=LensFlarePlugin},{"../../../math/Vector2":27,"../../../math/Vector3":28}],41:[function(require,module,exports){var DirectionalLightModule=require("../../../lights/DirectionalLight");var CameraHelperModule=require("../../../extras/helpers/CameraHelper");var OrthographicCameraModule=require("../../../cameras/OrthographicCamera");var PerspectiveCameraModule=require("../../../cameras/PerspectiveCamera");var Vector2Module=require("../../../math/Vector2");var WebGLRenderTargetModule=require("../../WebGLRenderTarget");var GyroscopeModule=require("../../../extras/core/Gyroscope");var Three=require("../../../Three");var ShaderMaterialModule=require("../../../materials/ShaderMaterial");var UniformsUtilsModule=require("../../shaders/UniformsUtils");var ShaderLibModule=require("../../shaders/ShaderLib");var Vector3Module=require("../../../math/Vector3");var Matrix4Module=require("../../../math/Matrix4");var FrustumModule=require("../../../math/Frustum");var ShadowMapPlugin;var instance;ShadowMapPlugin=function(_renderer,_lights,_webglObjects,_webglObjectsImmediate){var _gl=_renderer.context;var _depthMaterial,_depthMaterialMorph,_depthMaterialSkin,_depthMaterialMorphSkin,_frustum=new FrustumModule.Frustum,_projScreenMatrix=new Matrix4Module.Matrix4,_min=new Vector3Module.Vector3,_max=new Vector3Module.Vector3,_matrixPosition=new Vector3Module.Vector3,_renderList=[];var depthShader=ShaderLibModule.ShaderLib["depthRGBA"];var depthUniforms=UniformsUtilsModule.UniformsUtils.clone(depthShader.uniforms);_depthMaterial=new ShaderMaterialModule.ShaderMaterial({uniforms:depthUniforms,vertexShader:depthShader.vertexShader,fragmentShader:depthShader.fragmentShader});_depthMaterialMorph=new ShaderMaterialModule.ShaderMaterial({uniforms:depthUniforms,vertexShader:depthShader.vertexShader,fragmentShader:depthShader.fragmentShader,morphTargets:true});_depthMaterialSkin=new ShaderMaterialModule.ShaderMaterial({uniforms:depthUniforms,vertexShader:depthShader.vertexShader,fragmentShader:depthShader.fragmentShader,skinning:true});_depthMaterialMorphSkin=new ShaderMaterialModule.ShaderMaterial({uniforms:depthUniforms,vertexShader:depthShader.vertexShader,fragmentShader:depthShader.fragmentShader,morphTargets:true,skinning:true});_depthMaterial._shadowPass=true;_depthMaterialMorph._shadowPass=true;_depthMaterialSkin._shadowPass=true;_depthMaterialMorphSkin._shadowPass=true;this.render=function(scene,camera){if(_renderer.shadowMapEnabled===false)return;var i,il,j,jl,n,shadowMap,shadowMatrix,shadowCamera,buffer,material,webglObject,object,light,lights=[],k=0,fog=null;_gl.clearColor(1,1,1,1);_gl.disable(_gl.BLEND);_gl.enable(_gl.CULL_FACE);_gl.frontFace(_gl.CCW);if(_renderer.shadowMapCullFace===Three.CullFaceFront){_gl.cullFace(_gl.FRONT)}else{_gl.cullFace(_gl.BACK)}_renderer.state.setDepthTest(true);for(i=0,il=_lights.length;i<il;i++){light=_lights[i];if(!light.castShadow)continue;if(!!(instance=light)&&!!instance.isDirectionalLight&&light.shadowCascade){for(n=0;n<light.shadowCascadeCount;n++){var virtualLight;if(!light.shadowCascadeArray[n]){virtualLight=createVirtualLight(light,n);virtualLight.originalCamera=camera;var gyro=new GyroscopeModule.Gyroscope;gyro.position.copy(light.shadowCascadeOffset);
gyro.add(virtualLight);gyro.add(virtualLight.target);camera.add(gyro);light.shadowCascadeArray[n]=virtualLight}else{virtualLight=light.shadowCascadeArray[n]}updateVirtualLight(light,n);lights[k]=virtualLight;k++}}else{lights[k]=light;k++}}for(i=0,il=lights.length;i<il;i++){light=lights[i];if(!light.shadowMap){var shadowFilter=Three.LinearFilter;if(_renderer.shadowMapType===Three.PCFSoftShadowMap){shadowFilter=Three.NearestFilter}var pars={minFilter:shadowFilter,magFilter:shadowFilter,format:Three.RGBAFormat};light.shadowMap=new WebGLRenderTargetModule.WebGLRenderTarget(light.shadowMapWidth,light.shadowMapHeight,pars);light.shadowMapSize=new Vector2Module.Vector2(light.shadowMapWidth,light.shadowMapHeight);light.shadowMatrix=new Matrix4Module.Matrix4}if(!light.shadowCamera){if(!!(instance=light)&&!!instance.isSpotLight){light.shadowCamera=new PerspectiveCameraModule.PerspectiveCamera(light.shadowCameraFov,light.shadowMapWidth/light.shadowMapHeight,light.shadowCameraNear,light.shadowCameraFar)}else if(!!(instance=light)&&!!instance.isDirectionalLight){light.shadowCamera=new OrthographicCameraModule.OrthographicCamera(light.shadowCameraLeft,light.shadowCameraRight,light.shadowCameraTop,light.shadowCameraBottom,light.shadowCameraNear,light.shadowCameraFar)}else{Three.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",light);continue}scene.add(light.shadowCamera);if(scene.autoUpdate===true)scene.updateMatrixWorld()}if(light.shadowCameraVisible&&!light.cameraHelper){light.cameraHelper=new CameraHelperModule.CameraHelper(light.shadowCamera);scene.add(light.cameraHelper)}if(light.isVirtual&&virtualLight.originalCamera==camera){updateShadowCamera(camera,light)}shadowMap=light.shadowMap;shadowMatrix=light.shadowMatrix;shadowCamera=light.shadowCamera;shadowCamera.position.setFromMatrixPosition(light.matrixWorld);_matrixPosition.setFromMatrixPosition(light.target.matrixWorld);shadowCamera.lookAt(_matrixPosition);shadowCamera.updateMatrixWorld();shadowCamera.matrixWorldInverse.getInverse(shadowCamera.matrixWorld);if(light.cameraHelper)light.cameraHelper.visible=light.shadowCameraVisible;if(light.shadowCameraVisible)light.cameraHelper.update();shadowMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);shadowMatrix.multiply(shadowCamera.projectionMatrix);shadowMatrix.multiply(shadowCamera.matrixWorldInverse);_projScreenMatrix.multiplyMatrices(shadowCamera.projectionMatrix,shadowCamera.matrixWorldInverse);_frustum.setFromMatrix(_projScreenMatrix);_renderer.setRenderTarget(shadowMap);_renderer.clear();_renderList.length=0;projectObject(scene,scene,shadowCamera);var objectMaterial,useMorphing,useSkinning;for(j=0,jl=_renderList.length;j<jl;j++){webglObject=_renderList[j];object=webglObject.object;buffer=webglObject.buffer;objectMaterial=getObjectMaterial(object);useMorphing=object.geometry.morphTargets!==undefined&&object.geometry.morphTargets.length>0&&objectMaterial.morphTargets;useSkinning=!!(instance=object)&&!!instance.isSkinnedMesh&&objectMaterial.skinning;if(object.customDepthMaterial){material=object.customDepthMaterial}else if(useSkinning){material=useMorphing?_depthMaterialMorphSkin:_depthMaterialSkin}else if(useMorphing){material=_depthMaterialMorph}else{material=_depthMaterial}_renderer.setMaterialFaces(objectMaterial);if(!!(instance=buffer)&&!!instance.isBufferGeometry){_renderer.renderBufferDirect(shadowCamera,_lights,fog,material,buffer,object)}else{_renderer.renderBuffer(shadowCamera,_lights,fog,material,buffer,object)}}for(j=0,jl=_webglObjectsImmediate.length;j<jl;j++){webglObject=_webglObjectsImmediate[j];object=webglObject.object;if(object.visible&&object.castShadow){object._modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld);_renderer.renderImmediateObject(shadowCamera,_lights,fog,_depthMaterial,object)}}}var clearColor=_renderer.getClearColor(),clearAlpha=_renderer.getClearAlpha();_gl.clearColor(clearColor.r,clearColor.g,clearColor.b,clearAlpha);_gl.enable(_gl.BLEND);if(_renderer.shadowMapCullFace===Three.CullFaceFront){_gl.cullFace(_gl.BACK)}_renderer.resetGLState()};function projectObject(scene,object,shadowCamera){if(object.visible){var webglObjects=_webglObjects[object.id];if(webglObjects&&object.castShadow&&(object.frustumCulled===false||_frustum.intersectsObject(object)===true)){for(var i=0,l=webglObjects.length;i<l;i++){var webglObject=webglObjects[i];object._modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld);_renderList.push(webglObject)}}for(var i=0,l=object.children.length;i<l;i++){projectObject(scene,object.children[i],shadowCamera)}}}function createVirtualLight(light,cascade){var virtualLight=new DirectionalLightModule.DirectionalLight;virtualLight.isVirtual=true;virtualLight.onlyShadow=true;virtualLight.castShadow=true;virtualLight.shadowCameraNear=light.shadowCameraNear;virtualLight.shadowCameraFar=light.shadowCameraFar;virtualLight.shadowCameraLeft=light.shadowCameraLeft;virtualLight.shadowCameraRight=light.shadowCameraRight;virtualLight.shadowCameraBottom=light.shadowCameraBottom;virtualLight.shadowCameraTop=light.shadowCameraTop;virtualLight.shadowCameraVisible=light.shadowCameraVisible;virtualLight.shadowDarkness=light.shadowDarkness;virtualLight.shadowBias=light.shadowCascadeBias[cascade];virtualLight.shadowMapWidth=light.shadowCascadeWidth[cascade];virtualLight.shadowMapHeight=light.shadowCascadeHeight[cascade];virtualLight.pointsWorld=[];virtualLight.pointsFrustum=[];var pointsWorld=virtualLight.pointsWorld,pointsFrustum=virtualLight.pointsFrustum;for(var i=0;i<8;i++){pointsWorld[i]=new Vector3Module.Vector3;pointsFrustum[i]=new Vector3Module.Vector3}var nearZ=light.shadowCascadeNearZ[cascade];var farZ=light.shadowCascadeFarZ[cascade];pointsFrustum[0].set(-1,-1,nearZ);pointsFrustum[1].set(1,-1,nearZ);pointsFrustum[2].set(-1,1,nearZ);pointsFrustum[3].set(1,1,nearZ);pointsFrustum[4].set(-1,-1,farZ);pointsFrustum[5].set(1,-1,farZ);pointsFrustum[6].set(-1,1,farZ);pointsFrustum[7].set(1,1,farZ);return virtualLight}function updateVirtualLight(light,cascade){var virtualLight=light.shadowCascadeArray[cascade];virtualLight.position.copy(light.position);virtualLight.target.position.copy(light.target.position);virtualLight.lookAt(virtualLight.target);virtualLight.shadowCameraVisible=light.shadowCameraVisible;virtualLight.shadowDarkness=light.shadowDarkness;virtualLight.shadowBias=light.shadowCascadeBias[cascade];var nearZ=light.shadowCascadeNearZ[cascade];var farZ=light.shadowCascadeFarZ[cascade];var pointsFrustum=virtualLight.pointsFrustum;pointsFrustum[0].z=nearZ;pointsFrustum[1].z=nearZ;pointsFrustum[2].z=nearZ;pointsFrustum[3].z=nearZ;pointsFrustum[4].z=farZ;pointsFrustum[5].z=farZ;pointsFrustum[6].z=farZ;pointsFrustum[7].z=farZ}function updateShadowCamera(camera,light){var shadowCamera=light.shadowCamera,pointsFrustum=light.pointsFrustum,pointsWorld=light.pointsWorld;_min.set(Infinity,Infinity,Infinity);_max.set(-Infinity,-Infinity,-Infinity);for(var i=0;i<8;i++){var p=pointsWorld[i];p.copy(pointsFrustum[i]);p.unproject(camera);p.applyMatrix4(shadowCamera.matrixWorldInverse);if(p.x<_min.x)_min.x=p.x;if(p.x>_max.x)_max.x=p.x;if(p.y<_min.y)_min.y=p.y;if(p.y>_max.y)_max.y=p.y;if(p.z<_min.z)_min.z=p.z;if(p.z>_max.z)_max.z=p.z}shadowCamera.left=_min.x;shadowCamera.right=_max.x;shadowCamera.top=_max.y;shadowCamera.bottom=_min.y;shadowCamera.updateProjectionMatrix()}function getObjectMaterial(object){return!!(instance=object.material)&&!!instance.isMeshFaceMaterial?object.material.materials[0]:object.material}};ShadowMapPlugin.prototype.isShadowMapPlugin=true;exports.ShadowMapPlugin=ShadowMapPlugin},{"../../../Three":1,"../../../cameras/OrthographicCamera":3,"../../../cameras/PerspectiveCamera":4,"../../../extras/core/Gyroscope":9,"../../../extras/helpers/CameraHelper":10,"../../../lights/DirectionalLight":11,"../../../materials/ShaderMaterial":15,"../../../math/Frustum":19,"../../../math/Matrix4":22,"../../../math/Vector2":27,"../../../math/Vector3":28,"../../WebGLRenderTarget":31,"../../shaders/ShaderLib":33,"../../shaders/UniformsUtils":35}],42:[function(require,module,exports){var TextureModule=require("../../../textures/Texture");var QuaternionModule=require("../../../math/Quaternion");var Vector3Module=require("../../../math/Vector3");var SpritePlugin;var instance;SpritePlugin=function(renderer,sprites){var gl=renderer.context;var vertexBuffer,elementBuffer;var program,attributes,uniforms;var texture;var spritePosition=new Vector3Module.Vector3;var spriteRotation=new QuaternionModule.Quaternion;var spriteScale=new Vector3Module.Vector3;var init=function(){var vertices=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]);var faces=new Uint16Array([0,1,2,0,2,3]);vertexBuffer=gl.createBuffer();elementBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,elementBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,faces,gl.STATIC_DRAW);program=createProgram();attributes={position:gl.getAttribLocation(program,"position"),uv:gl.getAttribLocation(program,"uv")};uniforms={uvOffset:gl.getUniformLocation(program,"uvOffset"),uvScale:gl.getUniformLocation(program,"uvScale"),rotation:gl.getUniformLocation(program,"rotation"),scale:gl.getUniformLocation(program,"scale"),color:gl.getUniformLocation(program,"color"),map:gl.getUniformLocation(program,"map"),opacity:gl.getUniformLocation(program,"opacity"),modelViewMatrix:gl.getUniformLocation(program,"modelViewMatrix"),projectionMatrix:gl.getUniformLocation(program,"projectionMatrix"),fogType:gl.getUniformLocation(program,"fogType"),fogDensity:gl.getUniformLocation(program,"fogDensity"),fogNear:gl.getUniformLocation(program,"fogNear"),fogFar:gl.getUniformLocation(program,"fogFar"),fogColor:gl.getUniformLocation(program,"fogColor"),alphaTest:gl.getUniformLocation(program,"alphaTest")};var canvas=document.createElement("canvas");canvas.width=8;canvas.height=8;var context=canvas.getContext("2d");context.fillStyle="white";context.fillRect(0,0,8,8);texture=new TextureModule.Texture(canvas);texture.needsUpdate=true};this.render=function(scene,camera){if(sprites.length===0)return;if(program===undefined){init()}gl.useProgram(program);gl.enableVertexAttribArray(attributes.position);gl.enableVertexAttribArray(attributes.uv);gl.disable(gl.CULL_FACE);gl.enable(gl.BLEND);gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer);gl.vertexAttribPointer(attributes.position,2,gl.FLOAT,false,2*8,0);gl.vertexAttribPointer(attributes.uv,2,gl.FLOAT,false,2*8,8);gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,elementBuffer);gl.uniformMatrix4fv(uniforms.projectionMatrix,false,camera.projectionMatrix.elements);gl.activeTexture(gl.TEXTURE0);gl.uniform1i(uniforms.map,0);var oldFogType=0;var sceneFogType=0;var fog=scene.fog;if(fog){gl.uniform3f(uniforms.fogColor,fog.color.r,fog.color.g,fog.color.b);if(!!(instance=fog)&&!!instance.isFog){gl.uniform1f(uniforms.fogNear,fog.near);gl.uniform1f(uniforms.fogFar,fog.far);gl.uniform1i(uniforms.fogType,1);oldFogType=1;sceneFogType=1}else if(!!(instance=fog)&&!!instance.isFogExp2){gl.uniform1f(uniforms.fogDensity,fog.density);gl.uniform1i(uniforms.fogType,2);oldFogType=2;sceneFogType=2}}else{gl.uniform1i(uniforms.fogType,0);oldFogType=0;sceneFogType=0}for(var i=0,l=sprites.length;i<l;i++){var sprite=sprites[i];sprite._modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse,sprite.matrixWorld);sprite.z=-sprite._modelViewMatrix.elements[14]}sprites.sort(painterSortStable);var scale=[];for(var i=0,l=sprites.length;i<l;i++){var sprite=sprites[i];var material=sprite.material;gl.uniform1f(uniforms.alphaTest,material.alphaTest);gl.uniformMatrix4fv(uniforms.modelViewMatrix,false,sprite._modelViewMatrix.elements);sprite.matrixWorld.decompose(spritePosition,spriteRotation,spriteScale);scale[0]=spriteScale.x;scale[1]=spriteScale.y;var fogType=0;if(scene.fog&&material.fog){fogType=sceneFogType}if(oldFogType!==fogType){gl.uniform1i(uniforms.fogType,fogType);oldFogType=fogType}if(material.map!==null){gl.uniform2f(uniforms.uvOffset,material.map.offset.x,material.map.offset.y);gl.uniform2f(uniforms.uvScale,material.map.repeat.x,material.map.repeat.y)}else{gl.uniform2f(uniforms.uvOffset,0,0);gl.uniform2f(uniforms.uvScale,1,1)}gl.uniform1f(uniforms.opacity,material.opacity);gl.uniform3f(uniforms.color,material.color.r,material.color.g,material.color.b);gl.uniform1f(uniforms.rotation,material.rotation);gl.uniform2fv(uniforms.scale,scale);renderer.state.setBlending(material.blending,material.blendEquation,material.blendSrc,material.blendDst);renderer.state.setDepthTest(material.depthTest);renderer.state.setDepthWrite(material.depthWrite);if(material.map&&material.map.image&&material.map.image.width){renderer.setTexture(material.map,0)}else{renderer.setTexture(texture,0)}gl.drawElements(gl.TRIANGLES,6,gl.UNSIGNED_SHORT,0)}gl.enable(gl.CULL_FACE);renderer.resetGLState()};function createProgram(){var program=gl.createProgram();var vertexShader=gl.createShader(gl.VERTEX_SHADER);var fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(vertexShader,["precision "+renderer.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n"));gl.shaderSource(fragmentShader,["precision "+renderer.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n"));gl.compileShader(vertexShader);gl.compileShader(fragmentShader);gl.attachShader(program,vertexShader);gl.attachShader(program,fragmentShader);gl.linkProgram(program);return program}function painterSortStable(a,b){if(a.z!==b.z){return b.z-a.z}else{return b.id-a.id}}};SpritePlugin.prototype.isSpritePlugin=true;exports.SpritePlugin=SpritePlugin},{"../../../math/Quaternion":24,"../../../math/Vector3":28,"../../../textures/Texture":43}],43:[function(require,module,exports){var EventDispatcherModule=require("../core/EventDispatcher");var Vector2Module=require("../math/Vector2");var MathModule=require("../math/Math");var Three=require("../Three");var Texture;Texture=function(image,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy){Object.defineProperty(this,"id",{value:Three.TextureIdCount++});this.uuid=MathModule.Math.generateUUID();this.name="";this.sourceFile="";this.image=image!==undefined?image:Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=mapping!==undefined?mapping:Texture.DEFAULT_MAPPING;this.wrapS=wrapS!==undefined?wrapS:Three.ClampToEdgeWrapping;this.wrapT=wrapT!==undefined?wrapT:Three.ClampToEdgeWrapping;this.magFilter=magFilter!==undefined?magFilter:Three.LinearFilter;this.minFilter=minFilter!==undefined?minFilter:Three.LinearMipMapLinearFilter;this.anisotropy=anisotropy!==undefined?anisotropy:1;this.format=format!==undefined?format:Three.RGBAFormat;this.type=type!==undefined?type:Three.UnsignedByteType;this.offset=new Vector2Module.Vector2(0,0);this.repeat=new Vector2Module.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.unpackAlignment=4;this._needsUpdate=false;this.onUpdate=null};Texture.DEFAULT_IMAGE=undefined;Texture.DEFAULT_MAPPING=Three.UVMapping;Texture.prototype={constructor:Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(value){if(value===true)this.update();this._needsUpdate=value},clone:function(texture){if(texture===undefined)texture=new Texture;texture.image=this.image;texture.mipmaps=this.mipmaps.slice(0);texture.mapping=this.mapping;texture.wrapS=this.wrapS;texture.wrapT=this.wrapT;texture.magFilter=this.magFilter;texture.minFilter=this.minFilter;texture.anisotropy=this.anisotropy;texture.format=this.format;texture.type=this.type;texture.offset.copy(this.offset);texture.repeat.copy(this.repeat);texture.generateMipmaps=this.generateMipmaps;texture.premultiplyAlpha=this.premultiplyAlpha;texture.flipY=this.flipY;texture.unpackAlignment=this.unpackAlignment;return texture},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};EventDispatcherModule.EventDispatcher.prototype.apply(Texture.prototype);Texture.prototype.isTexture=true;exports.Texture=Texture},{"../Three":1,"../core/EventDispatcher":5,"../math/Math":20,"../math/Vector2":27}],"three.cjs/renderers/WebGLRenderer":[function(require,module,exports){var MathModule=require("../math/Math");var WebGLProgramModule=require("./webgl/WebGLProgram");var UniformsUtilsModule=require("./shaders/UniformsUtils");var ShaderLibModule=require("./shaders/ShaderLib");var Matrix3Module=require("../math/Matrix3");var LensFlarePluginModule=require("./webgl/plugins/LensFlarePlugin");var SpritePluginModule=require("./webgl/plugins/SpritePlugin");var ShadowMapPluginModule=require("./webgl/plugins/ShadowMapPlugin");var WebGLExtensionsModule=require("./webgl/WebGLExtensions");var WebGLStateModule=require("./webgl/WebGLState");var Vector3Module=require("../math/Vector3");var Matrix4Module=require("../math/Matrix4");var FrustumModule=require("../math/Frustum");var ColorModule=require("../math/Color");var Three=require("../Three");var WebGLRenderer;var toString=Object.prototype.toString;var instance;WebGLRenderer=function(parameters){console.log("THREE.WebGLRenderer",Three.REVISION);parameters=parameters||{};var _canvas=parameters.canvas!==undefined?parameters.canvas:document.createElement("canvas"),_context=parameters.context!==undefined?parameters.context:null,pixelRatio=1,_precision=parameters.precision!==undefined?parameters.precision:"highp",_alpha=parameters.alpha!==undefined?parameters.alpha:false,_depth=parameters.depth!==undefined?parameters.depth:true,_stencil=parameters.stencil!==undefined?parameters.stencil:true,_antialias=parameters.antialias!==undefined?parameters.antialias:false,_premultipliedAlpha=parameters.premultipliedAlpha!==undefined?parameters.premultipliedAlpha:true,_preserveDrawingBuffer=parameters.preserveDrawingBuffer!==undefined?parameters.preserveDrawingBuffer:false,_logarithmicDepthBuffer=parameters.logarithmicDepthBuffer!==undefined?parameters.logarithmicDepthBuffer:false,_clearColor=new ColorModule.Color(0),_clearAlpha=0;var lights=[];var _webglObjects={};var _webglObjectsImmediate=[];var opaqueObjects=[];var transparentObjects=[];var sprites=[];var lensFlares=[];this.domElement=_canvas;this.context=null;this.autoClear=true;this.autoClearColor=true;this.autoClearDepth=true;this.autoClearStencil=true;this.sortObjects=true;this.gammaFactor=2;this.gammaInput=false;this.gammaOutput=false;this.shadowMapEnabled=false;this.shadowMapType=Three.PCFShadowMap;this.shadowMapCullFace=Three.CullFaceFront;this.shadowMapDebug=false;this.shadowMapCascade=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var _this=this,_programs=[],_currentProgram=null,_currentFramebuffer=null,_currentMaterialId=-1,_currentGeometryProgram="",_currentCamera=null,_usedTextureUnits=0,_viewportX=0,_viewportY=0,_viewportWidth=_canvas.width,_viewportHeight=_canvas.height,_currentWidth=0,_currentHeight=0,_frustum=new FrustumModule.Frustum,_projScreenMatrix=new Matrix4Module.Matrix4,_vector3=new Vector3Module.Vector3,_direction=new Vector3Module.Vector3,_lightsNeedUpdate=true,_lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};var _gl;try{var attributes={alpha:_alpha,depth:_depth,stencil:_stencil,antialias:_antialias,premultipliedAlpha:_premultipliedAlpha,preserveDrawingBuffer:_preserveDrawingBuffer};_gl=_context||_canvas.getContext("webgl",attributes)||_canvas.getContext("experimental-webgl",attributes);if(_gl===null){if(_canvas.getContext("webgl")!==null){throw"Error creating WebGL context with your selected attributes."}else{throw"Error creating WebGL context."}}_canvas.addEventListener("webglcontextlost",function(event){event.preventDefault();resetGLState();setDefaultGLState();_webglObjects={}},false)}catch(error){Three.error("THREE.WebGLRenderer: "+error)}var state=new WebGLStateModule.WebGLState(_gl,paramThreeToGL);if(_gl.getShaderPrecisionFormat===undefined){_gl.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}}var extensions=new WebGLExtensionsModule.WebGLExtensions(_gl);extensions.get("OES_texture_float");extensions.get("OES_texture_float_linear");extensions.get("OES_texture_half_float");extensions.get("OES_texture_half_float_linear");extensions.get("OES_standard_derivatives");if(_logarithmicDepthBuffer){extensions.get("EXT_frag_depth")}var glClearColor=function(r,g,b,a){if(_premultipliedAlpha===true){r*=a;g*=a;b*=a}_gl.clearColor(r,g,b,a)};var setDefaultGLState=function(){_gl.clearColor(0,0,0,1);_gl.clearDepth(1);_gl.clearStencil(0);_gl.enable(_gl.DEPTH_TEST);_gl.depthFunc(_gl.LEQUAL);_gl.frontFace(_gl.CCW);_gl.cullFace(_gl.BACK);_gl.enable(_gl.CULL_FACE);_gl.enable(_gl.BLEND);_gl.blendEquation(_gl.FUNC_ADD);_gl.blendFunc(_gl.SRC_ALPHA,_gl.ONE_MINUS_SRC_ALPHA);_gl.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight);glClearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};var resetGLState=function(){_currentProgram=null;_currentCamera=null;_currentGeometryProgram="";_currentMaterialId=-1;_lightsNeedUpdate=true;state.reset()};setDefaultGLState();this.context=_gl;this.state=state;var _maxTextures=_gl.getParameter(_gl.MAX_TEXTURE_IMAGE_UNITS);var _maxVertexTextures=_gl.getParameter(_gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);var _maxTextureSize=_gl.getParameter(_gl.MAX_TEXTURE_SIZE);var _maxCubemapSize=_gl.getParameter(_gl.MAX_CUBE_MAP_TEXTURE_SIZE);var _supportsVertexTextures=_maxVertexTextures>0;var _supportsBoneTextures=_supportsVertexTextures&&extensions.get("OES_texture_float");var _vertexShaderPrecisionHighpFloat=_gl.getShaderPrecisionFormat(_gl.VERTEX_SHADER,_gl.HIGH_FLOAT);var _vertexShaderPrecisionMediumpFloat=_gl.getShaderPrecisionFormat(_gl.VERTEX_SHADER,_gl.MEDIUM_FLOAT);var _fragmentShaderPrecisionHighpFloat=_gl.getShaderPrecisionFormat(_gl.FRAGMENT_SHADER,_gl.HIGH_FLOAT);var _fragmentShaderPrecisionMediumpFloat=_gl.getShaderPrecisionFormat(_gl.FRAGMENT_SHADER,_gl.MEDIUM_FLOAT);var getCompressedTextureFormats=function(){var array;return function(){if(array!==undefined){return array}array=[];if(extensions.get("WEBGL_compressed_texture_pvrtc")||extensions.get("WEBGL_compressed_texture_s3tc")){var formats=_gl.getParameter(_gl.COMPRESSED_TEXTURE_FORMATS);for(var i=0;i<formats.length;i++){array.push(formats[i])}}return array}}();var highpAvailable=_vertexShaderPrecisionHighpFloat.precision>0&&_fragmentShaderPrecisionHighpFloat.precision>0;var mediumpAvailable=_vertexShaderPrecisionMediumpFloat.precision>0&&_fragmentShaderPrecisionMediumpFloat.precision>0;if(_precision==="highp"&&!highpAvailable){if(mediumpAvailable){_precision="mediump";Three.warn("THREE.WebGLRenderer: highp not supported, using mediump.")}else{_precision="lowp";Three.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")}}if(_precision==="mediump"&&!mediumpAvailable){_precision="lowp";Three.warn("THREE.WebGLRenderer: mediump not supported, using lowp.")}var shadowMapPlugin=new ShadowMapPluginModule.ShadowMapPlugin(this,lights,_webglObjects,_webglObjectsImmediate);var spritePlugin=new SpritePluginModule.SpritePlugin(this,sprites);var lensFlarePlugin=new LensFlarePluginModule.LensFlarePlugin(this,lensFlares);this.getContext=function(){return _gl};this.forceContextLoss=function(){extensions.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return _supportsVertexTextures};this.supportsFloatTextures=function(){return extensions.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){return extensions.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){return extensions.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return extensions.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return extensions.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return extensions.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var value;return function(){if(value!==undefined){return value}var extension=extensions.get("EXT_texture_filter_anisotropic");value=extension!==null?_gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;return value}}();this.getPrecision=function(){return _precision};this.getPixelRatio=function(){return pixelRatio};this.setPixelRatio=function(value){pixelRatio=value};this.setSize=function(width,height,updateStyle){_canvas.width=width*pixelRatio;_canvas.height=height*pixelRatio;if(updateStyle!==false){_canvas.style.width=width+"px";_canvas.style.height=height+"px"}this.setViewport(0,0,width,height)};this.setViewport=function(x,y,width,height){_viewportX=x*pixelRatio;_viewportY=y*pixelRatio;_viewportWidth=width*pixelRatio;_viewportHeight=height*pixelRatio;_gl.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight)};this.setScissor=function(x,y,width,height){_gl.scissor(x*pixelRatio,y*pixelRatio,width*pixelRatio,height*pixelRatio)};this.enableScissorTest=function(enable){enable?_gl.enable(_gl.SCISSOR_TEST):_gl.disable(_gl.SCISSOR_TEST)};this.getClearColor=function(){return _clearColor};this.setClearColor=function(color,alpha){_clearColor.set(color);_clearAlpha=alpha!==undefined?alpha:1;glClearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.getClearAlpha=function(){return _clearAlpha};this.setClearAlpha=function(alpha){_clearAlpha=alpha;glClearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(color,depth,stencil){var bits=0;if(color===undefined||color)bits|=_gl.COLOR_BUFFER_BIT;if(depth===undefined||depth)bits|=_gl.DEPTH_BUFFER_BIT;if(stencil===undefined||stencil)bits|=_gl.STENCIL_BUFFER_BIT;_gl.clear(bits)};this.clearColor=function(){_gl.clear(_gl.COLOR_BUFFER_BIT)};this.clearDepth=function(){_gl.clear(_gl.DEPTH_BUFFER_BIT)};this.clearStencil=function(){_gl.clear(_gl.STENCIL_BUFFER_BIT)};this.clearTarget=function(renderTarget,color,depth,stencil){this.setRenderTarget(renderTarget);this.clear(color,depth,stencil)};this.resetGLState=resetGLState;function createParticleBuffers(geometry){geometry.__webglVertexBuffer=_gl.createBuffer();geometry.__webglColorBuffer=_gl.createBuffer();_this.info.memory.geometries++}function createLineBuffers(geometry){geometry.__webglVertexBuffer=_gl.createBuffer();geometry.__webglColorBuffer=_gl.createBuffer();geometry.__webglLineDistanceBuffer=_gl.createBuffer();_this.info.memory.geometries++}function createMeshBuffers(geometryGroup){geometryGroup.__webglVertexBuffer=_gl.createBuffer();geometryGroup.__webglNormalBuffer=_gl.createBuffer();geometryGroup.__webglTangentBuffer=_gl.createBuffer();geometryGroup.__webglColorBuffer=_gl.createBuffer();geometryGroup.__webglUVBuffer=_gl.createBuffer();geometryGroup.__webglUV2Buffer=_gl.createBuffer();geometryGroup.__webglSkinIndicesBuffer=_gl.createBuffer();geometryGroup.__webglSkinWeightsBuffer=_gl.createBuffer();geometryGroup.__webglFaceBuffer=_gl.createBuffer();geometryGroup.__webglLineBuffer=_gl.createBuffer();var numMorphTargets=geometryGroup.numMorphTargets;if(numMorphTargets){geometryGroup.__webglMorphTargetsBuffers=[];for(var m=0,ml=numMorphTargets;m<ml;m++){geometryGroup.__webglMorphTargetsBuffers.push(_gl.createBuffer())}}var numMorphNormals=geometryGroup.numMorphNormals;if(numMorphNormals){geometryGroup.__webglMorphNormalsBuffers=[];for(var m=0,ml=numMorphNormals;m<ml;m++){geometryGroup.__webglMorphNormalsBuffers.push(_gl.createBuffer())}}_this.info.memory.geometries++}var onObjectRemoved=function(event){var object=event.target;object.traverse(function(child){child.removeEventListener("remove",onObjectRemoved);removeObject(child)})};var onGeometryDispose=function(event){var geometry=event.target;geometry.removeEventListener("dispose",onGeometryDispose);deallocateGeometry(geometry)};var onTextureDispose=function(event){var texture=event.target;texture.removeEventListener("dispose",onTextureDispose);deallocateTexture(texture);_this.info.memory.textures--};var onRenderTargetDispose=function(event){var renderTarget=event.target;renderTarget.removeEventListener("dispose",onRenderTargetDispose);deallocateRenderTarget(renderTarget);_this.info.memory.textures--};var onMaterialDispose=function(event){var material=event.target;material.removeEventListener("dispose",onMaterialDispose);deallocateMaterial(material)};var deleteBuffers=function(geometry){var buffers=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"];for(var i=0,l=buffers.length;i<l;i++){var name=buffers[i];if(geometry[name]!==undefined){_gl.deleteBuffer(geometry[name]);delete geometry[name]}}if(geometry.__webglCustomAttributesList!==undefined){for(var name in geometry.__webglCustomAttributesList){_gl.deleteBuffer(geometry.__webglCustomAttributesList[name].buffer)}delete geometry.__webglCustomAttributesList}_this.info.memory.geometries--};var deallocateGeometry=function(geometry){delete geometry.__webglInit;if(!!(instance=geometry)&&!!instance.isBufferGeometry){for(var name in geometry.attributes){var attribute=geometry.attributes[name];if(attribute.buffer!==undefined){_gl.deleteBuffer(attribute.buffer);delete attribute.buffer}}_this.info.memory.geometries--}else{var geometryGroupsList=geometryGroups[geometry.id];if(geometryGroupsList!==undefined){for(var i=0,l=geometryGroupsList.length;i<l;i++){var geometryGroup=geometryGroupsList[i];if(geometryGroup.numMorphTargets!==undefined){for(var m=0,ml=geometryGroup.numMorphTargets;m<ml;m++){_gl.deleteBuffer(geometryGroup.__webglMorphTargetsBuffers[m])}delete geometryGroup.__webglMorphTargetsBuffers}if(geometryGroup.numMorphNormals!==undefined){for(var m=0,ml=geometryGroup.numMorphNormals;m<ml;m++){_gl.deleteBuffer(geometryGroup.__webglMorphNormalsBuffers[m])}delete geometryGroup.__webglMorphNormalsBuffers}deleteBuffers(geometryGroup)}delete geometryGroups[geometry.id]}else{deleteBuffers(geometry)}}_currentGeometryProgram=""};var deallocateTexture=function(texture){if(texture.image&&texture.image.__webglTextureCube){_gl.deleteTexture(texture.image.__webglTextureCube);
delete texture.image.__webglTextureCube}else{if(texture.__webglInit===undefined)return;_gl.deleteTexture(texture.__webglTexture);delete texture.__webglTexture;delete texture.__webglInit}};var deallocateRenderTarget=function(renderTarget){if(!renderTarget||renderTarget.__webglTexture===undefined)return;_gl.deleteTexture(renderTarget.__webglTexture);delete renderTarget.__webglTexture;if(!!(instance=renderTarget)&&!!instance.isWebGLRenderTargetCube){for(var i=0;i<6;i++){_gl.deleteFramebuffer(renderTarget.__webglFramebuffer[i]);_gl.deleteRenderbuffer(renderTarget.__webglRenderbuffer[i])}}else{_gl.deleteFramebuffer(renderTarget.__webglFramebuffer);_gl.deleteRenderbuffer(renderTarget.__webglRenderbuffer)}delete renderTarget.__webglFramebuffer;delete renderTarget.__webglRenderbuffer};var deallocateMaterial=function(material){var program=material.program.program;if(program===undefined)return;material.program=undefined;var i,il,programInfo;var deleteProgram=false;for(i=0,il=_programs.length;i<il;i++){programInfo=_programs[i];if(programInfo.program===program){programInfo.usedTimes--;if(programInfo.usedTimes===0){deleteProgram=true}break}}if(deleteProgram===true){var newPrograms=[];for(i=0,il=_programs.length;i<il;i++){programInfo=_programs[i];if(programInfo.program!==program){newPrograms.push(programInfo)}}_programs=newPrograms;_gl.deleteProgram(program);_this.info.memory.programs--}};function initCustomAttributes(object){var geometry=object.geometry;var material=object.material;var nvertices=geometry.vertices.length;if(material.attributes){if(geometry.__webglCustomAttributesList===undefined){geometry.__webglCustomAttributesList=[]}for(var name in material.attributes){var attribute=material.attributes[name];if(!attribute.__webglInitialized||attribute.createUniqueBuffers){attribute.__webglInitialized=true;var size=1;if(attribute.type==="v2")size=2;else if(attribute.type==="v3")size=3;else if(attribute.type==="v4")size=4;else if(attribute.type==="c")size=3;attribute.size=size;attribute.array=new Float32Array(nvertices*size);attribute.buffer=_gl.createBuffer();attribute.buffer.belongsToAttribute=name;attribute.needsUpdate=true}geometry.__webglCustomAttributesList.push(attribute)}}}function initParticleBuffers(geometry,object){var nvertices=geometry.vertices.length;geometry.__vertexArray=new Float32Array(nvertices*3);geometry.__colorArray=new Float32Array(nvertices*3);geometry.__webglParticleCount=nvertices;initCustomAttributes(object)}function initLineBuffers(geometry,object){var nvertices=geometry.vertices.length;geometry.__vertexArray=new Float32Array(nvertices*3);geometry.__colorArray=new Float32Array(nvertices*3);geometry.__lineDistanceArray=new Float32Array(nvertices*1);geometry.__webglLineCount=nvertices;initCustomAttributes(object)}function initMeshBuffers(geometryGroup,object){var geometry=object.geometry,faces3=geometryGroup.faces3,nvertices=faces3.length*3,ntris=faces3.length*1,nlines=faces3.length*3,material=getBufferMaterial(object,geometryGroup);geometryGroup.__vertexArray=new Float32Array(nvertices*3);geometryGroup.__normalArray=new Float32Array(nvertices*3);geometryGroup.__colorArray=new Float32Array(nvertices*3);geometryGroup.__uvArray=new Float32Array(nvertices*2);if(geometry.faceVertexUvs.length>1){geometryGroup.__uv2Array=new Float32Array(nvertices*2)}if(geometry.hasTangents){geometryGroup.__tangentArray=new Float32Array(nvertices*4)}if(object.geometry.skinWeights.length&&object.geometry.skinIndices.length){geometryGroup.__skinIndexArray=new Float32Array(nvertices*4);geometryGroup.__skinWeightArray=new Float32Array(nvertices*4)}var UintArray=extensions.get("OES_element_index_uint")!==null&&ntris>21845?Uint32Array:Uint16Array;geometryGroup.__typeArray=UintArray;geometryGroup.__faceArray=new UintArray(ntris*3);geometryGroup.__lineArray=new UintArray(nlines*2);var numMorphTargets=geometryGroup.numMorphTargets;if(numMorphTargets){geometryGroup.__morphTargetsArrays=[];for(var m=0,ml=numMorphTargets;m<ml;m++){geometryGroup.__morphTargetsArrays.push(new Float32Array(nvertices*3))}}var numMorphNormals=geometryGroup.numMorphNormals;if(numMorphNormals){geometryGroup.__morphNormalsArrays=[];for(var m=0,ml=numMorphNormals;m<ml;m++){geometryGroup.__morphNormalsArrays.push(new Float32Array(nvertices*3))}}geometryGroup.__webglFaceCount=ntris*3;geometryGroup.__webglLineCount=nlines*2;if(material.attributes){if(geometryGroup.__webglCustomAttributesList===undefined){geometryGroup.__webglCustomAttributesList=[]}for(var name in material.attributes){var originalAttribute=material.attributes[name];var attribute={};for(var property in originalAttribute){attribute[property]=originalAttribute[property]}if(!attribute.__webglInitialized||attribute.createUniqueBuffers){attribute.__webglInitialized=true;var size=1;if(attribute.type==="v2")size=2;else if(attribute.type==="v3")size=3;else if(attribute.type==="v4")size=4;else if(attribute.type==="c")size=3;attribute.size=size;attribute.array=new Float32Array(nvertices*size);attribute.buffer=_gl.createBuffer();attribute.buffer.belongsToAttribute=name;originalAttribute.needsUpdate=true;attribute.__original=originalAttribute}geometryGroup.__webglCustomAttributesList.push(attribute)}}geometryGroup.__inittedArrays=true}function getBufferMaterial(object,geometryGroup){return!!(instance=object.material)&&!!instance.isMeshFaceMaterial?object.material.materials[geometryGroup.materialIndex]:object.material}function materialNeedsFaceNormals(material){return(!!(instance=material)&&!!instance.isMeshPhongMaterial)===false&&material.shading===Three.FlatShading}function setParticleBuffers(geometry,hint,object){var v,c,vertex,offset,color,vertices=geometry.vertices,vl=vertices.length,colors=geometry.colors,cl=colors.length,vertexArray=geometry.__vertexArray,colorArray=geometry.__colorArray,dirtyVertices=geometry.verticesNeedUpdate,dirtyColors=geometry.colorsNeedUpdate,customAttributes=geometry.__webglCustomAttributesList,i,il,ca,cal,value,customAttribute;if(dirtyVertices){for(v=0;v<vl;v++){vertex=vertices[v];offset=v*3;vertexArray[offset]=vertex.x;vertexArray[offset+1]=vertex.y;vertexArray[offset+2]=vertex.z}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometry.__webglVertexBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,vertexArray,hint)}if(dirtyColors){for(c=0;c<cl;c++){color=colors[c];offset=c*3;colorArray[offset]=color.r;colorArray[offset+1]=color.g;colorArray[offset+2]=color.b}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometry.__webglColorBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,colorArray,hint)}if(customAttributes){for(i=0,il=customAttributes.length;i<il;i++){customAttribute=customAttributes[i];if(customAttribute.needsUpdate&&(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices")){cal=customAttribute.value.length;offset=0;if(customAttribute.size===1){for(ca=0;ca<cal;ca++){customAttribute.array[ca]=customAttribute.value[ca]}}else if(customAttribute.size===2){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;offset+=2}}else if(customAttribute.size===3){if(customAttribute.type==="c"){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.r;customAttribute.array[offset+1]=value.g;customAttribute.array[offset+2]=value.b;offset+=3}}else{for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;customAttribute.array[offset+2]=value.z;offset+=3}}}else if(customAttribute.size===4){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;customAttribute.array[offset+2]=value.z;customAttribute.array[offset+3]=value.w;offset+=4}}}_gl.bindBuffer(_gl.ARRAY_BUFFER,customAttribute.buffer);_gl.bufferData(_gl.ARRAY_BUFFER,customAttribute.array,hint);customAttribute.needsUpdate=false}}}function setLineBuffers(geometry,hint){var v,c,d,vertex,offset,color,vertices=geometry.vertices,colors=geometry.colors,lineDistances=geometry.lineDistances,vl=vertices.length,cl=colors.length,dl=lineDistances.length,vertexArray=geometry.__vertexArray,colorArray=geometry.__colorArray,lineDistanceArray=geometry.__lineDistanceArray,dirtyVertices=geometry.verticesNeedUpdate,dirtyColors=geometry.colorsNeedUpdate,dirtyLineDistances=geometry.lineDistancesNeedUpdate,customAttributes=geometry.__webglCustomAttributesList,i,il,ca,cal,value,customAttribute;if(dirtyVertices){for(v=0;v<vl;v++){vertex=vertices[v];offset=v*3;vertexArray[offset]=vertex.x;vertexArray[offset+1]=vertex.y;vertexArray[offset+2]=vertex.z}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometry.__webglVertexBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,vertexArray,hint)}if(dirtyColors){for(c=0;c<cl;c++){color=colors[c];offset=c*3;colorArray[offset]=color.r;colorArray[offset+1]=color.g;colorArray[offset+2]=color.b}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometry.__webglColorBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,colorArray,hint)}if(dirtyLineDistances){for(d=0;d<dl;d++){lineDistanceArray[d]=lineDistances[d]}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometry.__webglLineDistanceBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,lineDistanceArray,hint)}if(customAttributes){for(i=0,il=customAttributes.length;i<il;i++){customAttribute=customAttributes[i];if(customAttribute.needsUpdate&&(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices")){offset=0;cal=customAttribute.value.length;if(customAttribute.size===1){for(ca=0;ca<cal;ca++){customAttribute.array[ca]=customAttribute.value[ca]}}else if(customAttribute.size===2){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;offset+=2}}else if(customAttribute.size===3){if(customAttribute.type==="c"){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.r;customAttribute.array[offset+1]=value.g;customAttribute.array[offset+2]=value.b;offset+=3}}else{for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;customAttribute.array[offset+2]=value.z;offset+=3}}}else if(customAttribute.size===4){for(ca=0;ca<cal;ca++){value=customAttribute.value[ca];customAttribute.array[offset]=value.x;customAttribute.array[offset+1]=value.y;customAttribute.array[offset+2]=value.z;customAttribute.array[offset+3]=value.w;offset+=4}}_gl.bindBuffer(_gl.ARRAY_BUFFER,customAttribute.buffer);_gl.bufferData(_gl.ARRAY_BUFFER,customAttribute.array,hint);customAttribute.needsUpdate=false}}}}function setMeshBuffers(geometryGroup,object,hint,dispose,material){if(!geometryGroup.__inittedArrays){return}var needsFaceNormals=materialNeedsFaceNormals(material);var f,fl,fi,face,vertexNormals,faceNormal,vertexColors,faceColor,vertexTangents,uv,uv2,v1,v2,v3,t1,t2,t3,n1,n2,n3,c1,c2,c3,sw1,sw2,sw3,si1,si2,si3,i,il,vn,uvi,uv2i,vk,vkl,vka,nka,chf,faceVertexNormals,vertexIndex=0,offset=0,offset_uv=0,offset_uv2=0,offset_face=0,offset_normal=0,offset_tangent=0,offset_line=0,offset_color=0,offset_skin=0,offset_morphTarget=0,offset_custom=0,value,vertexArray=geometryGroup.__vertexArray,uvArray=geometryGroup.__uvArray,uv2Array=geometryGroup.__uv2Array,normalArray=geometryGroup.__normalArray,tangentArray=geometryGroup.__tangentArray,colorArray=geometryGroup.__colorArray,skinIndexArray=geometryGroup.__skinIndexArray,skinWeightArray=geometryGroup.__skinWeightArray,morphTargetsArrays=geometryGroup.__morphTargetsArrays,morphNormalsArrays=geometryGroup.__morphNormalsArrays,customAttributes=geometryGroup.__webglCustomAttributesList,customAttribute,faceArray=geometryGroup.__faceArray,lineArray=geometryGroup.__lineArray,geometry=object.geometry,dirtyVertices=geometry.verticesNeedUpdate,dirtyElements=geometry.elementsNeedUpdate,dirtyUvs=geometry.uvsNeedUpdate,dirtyNormals=geometry.normalsNeedUpdate,dirtyTangents=geometry.tangentsNeedUpdate,dirtyColors=geometry.colorsNeedUpdate,dirtyMorphTargets=geometry.morphTargetsNeedUpdate,vertices=geometry.vertices,chunk_faces3=geometryGroup.faces3,obj_faces=geometry.faces,obj_uvs=geometry.faceVertexUvs[0],obj_uvs2=geometry.faceVertexUvs[1],obj_skinIndices=geometry.skinIndices,obj_skinWeights=geometry.skinWeights,morphTargets=geometry.morphTargets,morphNormals=geometry.morphNormals;if(dirtyVertices){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];v1=vertices[face.a];v2=vertices[face.b];v3=vertices[face.c];vertexArray[offset]=v1.x;vertexArray[offset+1]=v1.y;vertexArray[offset+2]=v1.z;vertexArray[offset+3]=v2.x;vertexArray[offset+4]=v2.y;vertexArray[offset+5]=v2.z;vertexArray[offset+6]=v3.x;vertexArray[offset+7]=v3.y;vertexArray[offset+8]=v3.z;offset+=9}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglVertexBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,vertexArray,hint)}if(dirtyMorphTargets){for(vk=0,vkl=morphTargets.length;vk<vkl;vk++){offset_morphTarget=0;for(f=0,fl=chunk_faces3.length;f<fl;f++){chf=chunk_faces3[f];face=obj_faces[chf];v1=morphTargets[vk].vertices[face.a];v2=morphTargets[vk].vertices[face.b];v3=morphTargets[vk].vertices[face.c];vka=morphTargetsArrays[vk];vka[offset_morphTarget]=v1.x;vka[offset_morphTarget+1]=v1.y;vka[offset_morphTarget+2]=v1.z;vka[offset_morphTarget+3]=v2.x;vka[offset_morphTarget+4]=v2.y;vka[offset_morphTarget+5]=v2.z;vka[offset_morphTarget+6]=v3.x;vka[offset_morphTarget+7]=v3.y;vka[offset_morphTarget+8]=v3.z;if(material.morphNormals){if(needsFaceNormals){n1=morphNormals[vk].faceNormals[chf];n2=n1;n3=n1}else{faceVertexNormals=morphNormals[vk].vertexNormals[chf];n1=faceVertexNormals.a;n2=faceVertexNormals.b;n3=faceVertexNormals.c}nka=morphNormalsArrays[vk];nka[offset_morphTarget]=n1.x;nka[offset_morphTarget+1]=n1.y;nka[offset_morphTarget+2]=n1.z;nka[offset_morphTarget+3]=n2.x;nka[offset_morphTarget+4]=n2.y;nka[offset_morphTarget+5]=n2.z;nka[offset_morphTarget+6]=n3.x;nka[offset_morphTarget+7]=n3.y;nka[offset_morphTarget+8]=n3.z}offset_morphTarget+=9}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphTargetsBuffers[vk]);_gl.bufferData(_gl.ARRAY_BUFFER,morphTargetsArrays[vk],hint);if(material.morphNormals){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphNormalsBuffers[vk]);_gl.bufferData(_gl.ARRAY_BUFFER,morphNormalsArrays[vk],hint)}}}if(obj_skinWeights.length){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];sw1=obj_skinWeights[face.a];sw2=obj_skinWeights[face.b];sw3=obj_skinWeights[face.c];skinWeightArray[offset_skin]=sw1.x;skinWeightArray[offset_skin+1]=sw1.y;skinWeightArray[offset_skin+2]=sw1.z;skinWeightArray[offset_skin+3]=sw1.w;skinWeightArray[offset_skin+4]=sw2.x;skinWeightArray[offset_skin+5]=sw2.y;skinWeightArray[offset_skin+6]=sw2.z;skinWeightArray[offset_skin+7]=sw2.w;skinWeightArray[offset_skin+8]=sw3.x;skinWeightArray[offset_skin+9]=sw3.y;skinWeightArray[offset_skin+10]=sw3.z;skinWeightArray[offset_skin+11]=sw3.w;si1=obj_skinIndices[face.a];si2=obj_skinIndices[face.b];si3=obj_skinIndices[face.c];skinIndexArray[offset_skin]=si1.x;skinIndexArray[offset_skin+1]=si1.y;skinIndexArray[offset_skin+2]=si1.z;skinIndexArray[offset_skin+3]=si1.w;skinIndexArray[offset_skin+4]=si2.x;skinIndexArray[offset_skin+5]=si2.y;skinIndexArray[offset_skin+6]=si2.z;skinIndexArray[offset_skin+7]=si2.w;skinIndexArray[offset_skin+8]=si3.x;skinIndexArray[offset_skin+9]=si3.y;skinIndexArray[offset_skin+10]=si3.z;skinIndexArray[offset_skin+11]=si3.w;offset_skin+=12}if(offset_skin>0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglSkinIndicesBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,skinIndexArray,hint);_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglSkinWeightsBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,skinWeightArray,hint)}}if(dirtyColors){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];vertexColors=face.vertexColors;faceColor=face.color;if(vertexColors.length===3&&material.vertexColors===Three.VertexColors){c1=vertexColors[0];c2=vertexColors[1];c3=vertexColors[2]}else{c1=faceColor;c2=faceColor;c3=faceColor}colorArray[offset_color]=c1.r;colorArray[offset_color+1]=c1.g;colorArray[offset_color+2]=c1.b;colorArray[offset_color+3]=c2.r;colorArray[offset_color+4]=c2.g;colorArray[offset_color+5]=c2.b;colorArray[offset_color+6]=c3.r;colorArray[offset_color+7]=c3.g;colorArray[offset_color+8]=c3.b;offset_color+=9}if(offset_color>0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglColorBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,colorArray,hint)}}if(dirtyTangents&&geometry.hasTangents){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];vertexTangents=face.vertexTangents;t1=vertexTangents[0];t2=vertexTangents[1];t3=vertexTangents[2];tangentArray[offset_tangent]=t1.x;tangentArray[offset_tangent+1]=t1.y;tangentArray[offset_tangent+2]=t1.z;tangentArray[offset_tangent+3]=t1.w;tangentArray[offset_tangent+4]=t2.x;tangentArray[offset_tangent+5]=t2.y;tangentArray[offset_tangent+6]=t2.z;tangentArray[offset_tangent+7]=t2.w;tangentArray[offset_tangent+8]=t3.x;tangentArray[offset_tangent+9]=t3.y;tangentArray[offset_tangent+10]=t3.z;tangentArray[offset_tangent+11]=t3.w;offset_tangent+=12}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglTangentBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,tangentArray,hint)}if(dirtyNormals){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];vertexNormals=face.vertexNormals;faceNormal=face.normal;if(vertexNormals.length===3&&needsFaceNormals===false){for(i=0;i<3;i++){vn=vertexNormals[i];normalArray[offset_normal]=vn.x;normalArray[offset_normal+1]=vn.y;normalArray[offset_normal+2]=vn.z;offset_normal+=3}}else{for(i=0;i<3;i++){normalArray[offset_normal]=faceNormal.x;normalArray[offset_normal+1]=faceNormal.y;normalArray[offset_normal+2]=faceNormal.z;offset_normal+=3}}}_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglNormalBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,normalArray,hint)}if(dirtyUvs&&obj_uvs){for(f=0,fl=chunk_faces3.length;f<fl;f++){fi=chunk_faces3[f];uv=obj_uvs[fi];if(uv===undefined)continue;for(i=0;i<3;i++){uvi=uv[i];uvArray[offset_uv]=uvi.x;uvArray[offset_uv+1]=uvi.y;offset_uv+=2}}if(offset_uv>0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglUVBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,uvArray,hint)}}if(dirtyUvs&&obj_uvs2){for(f=0,fl=chunk_faces3.length;f<fl;f++){fi=chunk_faces3[f];uv2=obj_uvs2[fi];if(uv2===undefined)continue;for(i=0;i<3;i++){uv2i=uv2[i];uv2Array[offset_uv2]=uv2i.x;uv2Array[offset_uv2+1]=uv2i.y;offset_uv2+=2}}if(offset_uv2>0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglUV2Buffer);_gl.bufferData(_gl.ARRAY_BUFFER,uv2Array,hint)}}if(dirtyElements){for(f=0,fl=chunk_faces3.length;f<fl;f++){faceArray[offset_face]=vertexIndex;faceArray[offset_face+1]=vertexIndex+1;faceArray[offset_face+2]=vertexIndex+2;offset_face+=3;lineArray[offset_line]=vertexIndex;lineArray[offset_line+1]=vertexIndex+1;lineArray[offset_line+2]=vertexIndex;lineArray[offset_line+3]=vertexIndex+2;lineArray[offset_line+4]=vertexIndex+1;lineArray[offset_line+5]=vertexIndex+2;offset_line+=6;vertexIndex+=3}_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,geometryGroup.__webglFaceBuffer);_gl.bufferData(_gl.ELEMENT_ARRAY_BUFFER,faceArray,hint);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,geometryGroup.__webglLineBuffer);_gl.bufferData(_gl.ELEMENT_ARRAY_BUFFER,lineArray,hint)}if(customAttributes){for(i=0,il=customAttributes.length;i<il;i++){customAttribute=customAttributes[i];if(!customAttribute.__original.needsUpdate)continue;offset_custom=0;if(customAttribute.size===1){if(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];customAttribute.array[offset_custom]=customAttribute.value[face.a];customAttribute.array[offset_custom+1]=customAttribute.value[face.b];customAttribute.array[offset_custom+2]=customAttribute.value[face.c];offset_custom+=3}}else if(customAttribute.boundTo==="faces"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];customAttribute.array[offset_custom]=value;customAttribute.array[offset_custom+1]=value;customAttribute.array[offset_custom+2]=value;offset_custom+=3}}}else if(customAttribute.size===2){if(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];v1=customAttribute.value[face.a];v2=customAttribute.value[face.b];v3=customAttribute.value[face.c];customAttribute.array[offset_custom]=v1.x;customAttribute.array[offset_custom+1]=v1.y;customAttribute.array[offset_custom+2]=v2.x;customAttribute.array[offset_custom+3]=v2.y;customAttribute.array[offset_custom+4]=v3.x;customAttribute.array[offset_custom+5]=v3.y;offset_custom+=6}}else if(customAttribute.boundTo==="faces"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];v1=value;v2=value;v3=value;customAttribute.array[offset_custom]=v1.x;customAttribute.array[offset_custom+1]=v1.y;customAttribute.array[offset_custom+2]=v2.x;customAttribute.array[offset_custom+3]=v2.y;customAttribute.array[offset_custom+4]=v3.x;customAttribute.array[offset_custom+5]=v3.y;offset_custom+=6}}}else if(customAttribute.size===3){var pp;if(customAttribute.type==="c"){pp=["r","g","b"]}else{pp=["x","y","z"]}if(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];v1=customAttribute.value[face.a];v2=customAttribute.value[face.b];v3=customAttribute.value[face.c];customAttribute.array[offset_custom]=v1[pp[0]];customAttribute.array[offset_custom+1]=v1[pp[1]];customAttribute.array[offset_custom+2]=v1[pp[2]];customAttribute.array[offset_custom+3]=v2[pp[0]];customAttribute.array[offset_custom+4]=v2[pp[1]];customAttribute.array[offset_custom+5]=v2[pp[2]];customAttribute.array[offset_custom+6]=v3[pp[0]];customAttribute.array[offset_custom+7]=v3[pp[1]];customAttribute.array[offset_custom+8]=v3[pp[2]];offset_custom+=9}}else if(customAttribute.boundTo==="faces"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];v1=value;v2=value;v3=value;customAttribute.array[offset_custom]=v1[pp[0]];customAttribute.array[offset_custom+1]=v1[pp[1]];customAttribute.array[offset_custom+2]=v1[pp[2]];customAttribute.array[offset_custom+3]=v2[pp[0]];customAttribute.array[offset_custom+4]=v2[pp[1]];customAttribute.array[offset_custom+5]=v2[pp[2]];customAttribute.array[offset_custom+6]=v3[pp[0]];customAttribute.array[offset_custom+7]=v3[pp[1]];customAttribute.array[offset_custom+8]=v3[pp[2]];offset_custom+=9}}else if(customAttribute.boundTo==="faceVertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];v1=value[0];v2=value[1];v3=value[2];customAttribute.array[offset_custom]=v1[pp[0]];customAttribute.array[offset_custom+1]=v1[pp[1]];customAttribute.array[offset_custom+2]=v1[pp[2]];customAttribute.array[offset_custom+3]=v2[pp[0]];customAttribute.array[offset_custom+4]=v2[pp[1]];customAttribute.array[offset_custom+5]=v2[pp[2]];customAttribute.array[offset_custom+6]=v3[pp[0]];customAttribute.array[offset_custom+7]=v3[pp[1]];customAttribute.array[offset_custom+8]=v3[pp[2]];offset_custom+=9}}}else if(customAttribute.size===4){if(customAttribute.boundTo===undefined||customAttribute.boundTo==="vertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){face=obj_faces[chunk_faces3[f]];v1=customAttribute.value[face.a];v2=customAttribute.value[face.b];v3=customAttribute.value[face.c];customAttribute.array[offset_custom]=v1.x;customAttribute.array[offset_custom+1]=v1.y;customAttribute.array[offset_custom+2]=v1.z;customAttribute.array[offset_custom+3]=v1.w;customAttribute.array[offset_custom+4]=v2.x;customAttribute.array[offset_custom+5]=v2.y;customAttribute.array[offset_custom+6]=v2.z;customAttribute.array[offset_custom+7]=v2.w;customAttribute.array[offset_custom+8]=v3.x;customAttribute.array[offset_custom+9]=v3.y;customAttribute.array[offset_custom+10]=v3.z;customAttribute.array[offset_custom+11]=v3.w;offset_custom+=12}}else if(customAttribute.boundTo==="faces"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];v1=value;v2=value;v3=value;customAttribute.array[offset_custom]=v1.x;customAttribute.array[offset_custom+1]=v1.y;customAttribute.array[offset_custom+2]=v1.z;customAttribute.array[offset_custom+3]=v1.w;customAttribute.array[offset_custom+4]=v2.x;customAttribute.array[offset_custom+5]=v2.y;customAttribute.array[offset_custom+6]=v2.z;customAttribute.array[offset_custom+7]=v2.w;customAttribute.array[offset_custom+8]=v3.x;customAttribute.array[offset_custom+9]=v3.y;customAttribute.array[offset_custom+10]=v3.z;customAttribute.array[offset_custom+11]=v3.w;offset_custom+=12}}else if(customAttribute.boundTo==="faceVertices"){for(f=0,fl=chunk_faces3.length;f<fl;f++){value=customAttribute.value[chunk_faces3[f]];v1=value[0];v2=value[1];v3=value[2];customAttribute.array[offset_custom]=v1.x;customAttribute.array[offset_custom+1]=v1.y;customAttribute.array[offset_custom+2]=v1.z;customAttribute.array[offset_custom+3]=v1.w;customAttribute.array[offset_custom+4]=v2.x;customAttribute.array[offset_custom+5]=v2.y;customAttribute.array[offset_custom+6]=v2.z;customAttribute.array[offset_custom+7]=v2.w;customAttribute.array[offset_custom+8]=v3.x;customAttribute.array[offset_custom+9]=v3.y;customAttribute.array[offset_custom+10]=v3.z;customAttribute.array[offset_custom+11]=v3.w;offset_custom+=12}}}_gl.bindBuffer(_gl.ARRAY_BUFFER,customAttribute.buffer);_gl.bufferData(_gl.ARRAY_BUFFER,customAttribute.array,hint)}}if(dispose){delete geometryGroup.__inittedArrays;delete geometryGroup.__colorArray;delete geometryGroup.__normalArray;delete geometryGroup.__tangentArray;delete geometryGroup.__uvArray;delete geometryGroup.__uv2Array;delete geometryGroup.__faceArray;delete geometryGroup.__vertexArray;delete geometryGroup.__lineArray;delete geometryGroup.__skinIndexArray;delete geometryGroup.__skinWeightArray}}this.renderBufferImmediate=function(object,program,material){state.initAttributes();if(object.hasPositions&&!object.__webglVertexBuffer)object.__webglVertexBuffer=_gl.createBuffer();if(object.hasNormals&&!object.__webglNormalBuffer)object.__webglNormalBuffer=_gl.createBuffer();if(object.hasUvs&&!object.__webglUvBuffer)object.__webglUvBuffer=_gl.createBuffer();if(object.hasColors&&!object.__webglColorBuffer)object.__webglColorBuffer=_gl.createBuffer();if(object.hasPositions){_gl.bindBuffer(_gl.ARRAY_BUFFER,object.__webglVertexBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,object.positionArray,_gl.DYNAMIC_DRAW);state.enableAttribute(program.attributes.position);_gl.vertexAttribPointer(program.attributes.position,3,_gl.FLOAT,false,0,0)}if(object.hasNormals){_gl.bindBuffer(_gl.ARRAY_BUFFER,object.__webglNormalBuffer);if((!!(instance=material)&&!!instance.isMeshPhongMaterial)===false&&material.shading===Three.FlatShading){var nx,ny,nz,nax,nbx,ncx,nay,nby,ncy,naz,nbz,ncz,normalArray,i,il=object.count*3;for(i=0;i<il;i+=9){normalArray=object.normalArray;nax=normalArray[i];nay=normalArray[i+1];naz=normalArray[i+2];nbx=normalArray[i+3];nby=normalArray[i+4];nbz=normalArray[i+5];ncx=normalArray[i+6];ncy=normalArray[i+7];ncz=normalArray[i+8];nx=(nax+nbx+ncx)/3;ny=(nay+nby+ncy)/3;nz=(naz+nbz+ncz)/3;normalArray[i]=nx;normalArray[i+1]=ny;normalArray[i+2]=nz;normalArray[i+3]=nx;normalArray[i+4]=ny;normalArray[i+5]=nz;normalArray[i+6]=nx;normalArray[i+7]=ny;normalArray[i+8]=nz}}_gl.bufferData(_gl.ARRAY_BUFFER,object.normalArray,_gl.DYNAMIC_DRAW);state.enableAttribute(program.attributes.normal);_gl.vertexAttribPointer(program.attributes.normal,3,_gl.FLOAT,false,0,0)}if(object.hasUvs&&material.map){_gl.bindBuffer(_gl.ARRAY_BUFFER,object.__webglUvBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,object.uvArray,_gl.DYNAMIC_DRAW);state.enableAttribute(program.attributes.uv);_gl.vertexAttribPointer(program.attributes.uv,2,_gl.FLOAT,false,0,0)}if(object.hasColors&&material.vertexColors!==Three.NoColors){_gl.bindBuffer(_gl.ARRAY_BUFFER,object.__webglColorBuffer);_gl.bufferData(_gl.ARRAY_BUFFER,object.colorArray,_gl.DYNAMIC_DRAW);state.enableAttribute(program.attributes.color);_gl.vertexAttribPointer(program.attributes.color,3,_gl.FLOAT,false,0,0)}state.disableUnusedAttributes();_gl.drawArrays(_gl.TRIANGLES,0,object.count);object.count=0};function setupVertexAttributes(material,program,geometry,startIndex){var geometryAttributes=geometry.attributes;var programAttributes=program.attributes;var programAttributesKeys=program.attributesKeys;for(var i=0,l=programAttributesKeys.length;i<l;i++){var key=programAttributesKeys[i];var programAttribute=programAttributes[key];if(programAttribute>=0){var geometryAttribute=geometryAttributes[key];if(geometryAttribute!==undefined){var size=geometryAttribute.itemSize;_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryAttribute.buffer);state.enableAttribute(programAttribute);_gl.vertexAttribPointer(programAttribute,size,_gl.FLOAT,false,0,startIndex*size*4)}else if(material.defaultAttributeValues!==undefined){if(material.defaultAttributeValues[key].length===2){_gl.vertexAttrib2fv(programAttribute,material.defaultAttributeValues[key])}else if(material.defaultAttributeValues[key].length===3){_gl.vertexAttrib3fv(programAttribute,material.defaultAttributeValues[key])}}}}state.disableUnusedAttributes()}this.renderBufferDirect=function(camera,lights,fog,material,geometry,object){if(material.visible===false)return;updateObject(object);var program=setProgram(camera,lights,fog,material,object);var updateBuffers=false,wireframeBit=material.wireframe?1:0,geometryProgram="direct_"+geometry.id+"_"+program.id+"_"+wireframeBit;if(geometryProgram!==_currentGeometryProgram){_currentGeometryProgram=geometryProgram;updateBuffers=true}if(updateBuffers){state.initAttributes()}if(!!(instance=object)&&!!instance.isMesh){var mode=material.wireframe===true?_gl.LINES:_gl.TRIANGLES;var index=geometry.attributes.index;if(index){var type,size;if(toString.call(index.array).slice(8,-1)==="Uint32Array"&&extensions.get("OES_element_index_uint")){type=_gl.UNSIGNED_INT;size=4}else{type=_gl.UNSIGNED_SHORT;size=2}var offsets=geometry.offsets;if(offsets.length===0){if(updateBuffers){setupVertexAttributes(material,program,geometry,0);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,index.array.length,type,0);_this.info.render.calls++;_this.info.render.vertices+=index.array.length;_this.info.render.faces+=index.array.length/3}else{updateBuffers=true;for(var i=0,il=offsets.length;i<il;i++){var startIndex=offsets[i].index;if(updateBuffers){setupVertexAttributes(material,program,geometry,startIndex);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,offsets[i].count,type,offsets[i].start*size);_this.info.render.calls++;_this.info.render.vertices+=offsets[i].count;_this.info.render.faces+=offsets[i].count/3}}}else{if(updateBuffers){setupVertexAttributes(material,program,geometry,0)}var position=geometry.attributes["position"];_gl.drawArrays(mode,0,position.array.length/position.itemSize);_this.info.render.calls++;_this.info.render.vertices+=position.array.length/position.itemSize;_this.info.render.faces+=position.array.length/(3*position.itemSize)}}else if(!!(instance=object)&&!!instance.isPointCloud){var mode=_gl.POINTS;var index=geometry.attributes.index;if(index){var type,size;if(toString.call(index.array).slice(8,-1)==="Uint32Array"&&extensions.get("OES_element_index_uint")){type=_gl.UNSIGNED_INT;size=4}else{type=_gl.UNSIGNED_SHORT;size=2}var offsets=geometry.offsets;if(offsets.length===0){if(updateBuffers){setupVertexAttributes(material,program,geometry,0);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,index.array.length,type,0);_this.info.render.calls++;_this.info.render.points+=index.array.length}else{if(offsets.length>1)updateBuffers=true;for(var i=0,il=offsets.length;i<il;i++){var startIndex=offsets[i].index;if(updateBuffers){setupVertexAttributes(material,program,geometry,startIndex);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,offsets[i].count,type,offsets[i].start*size);
_this.info.render.calls++;_this.info.render.points+=offsets[i].count}}}else{if(updateBuffers){setupVertexAttributes(material,program,geometry,0)}var position=geometry.attributes.position;var offsets=geometry.offsets;if(offsets.length===0){_gl.drawArrays(mode,0,position.array.length/3);_this.info.render.calls++;_this.info.render.points+=position.array.length/3}else{for(var i=0,il=offsets.length;i<il;i++){_gl.drawArrays(mode,offsets[i].index,offsets[i].count);_this.info.render.calls++;_this.info.render.points+=offsets[i].count}}}}else if(!!(instance=object)&&!!instance.isLine){var mode=object.mode===Three.LineStrip?_gl.LINE_STRIP:_gl.LINES;state.setLineWidth(material.linewidth*pixelRatio);var index=geometry.attributes.index;if(index){var type,size;if(toString.call(index.array).slice(8,-1)==="Uint32Array"){type=_gl.UNSIGNED_INT;size=4}else{type=_gl.UNSIGNED_SHORT;size=2}var offsets=geometry.offsets;if(offsets.length===0){if(updateBuffers){setupVertexAttributes(material,program,geometry,0);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,index.array.length,type,0);_this.info.render.calls++;_this.info.render.vertices+=index.array.length}else{if(offsets.length>1)updateBuffers=true;for(var i=0,il=offsets.length;i<il;i++){var startIndex=offsets[i].index;if(updateBuffers){setupVertexAttributes(material,program,geometry,startIndex);_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,index.buffer)}_gl.drawElements(mode,offsets[i].count,type,offsets[i].start*size);_this.info.render.calls++;_this.info.render.vertices+=offsets[i].count}}}else{if(updateBuffers){setupVertexAttributes(material,program,geometry,0)}var position=geometry.attributes.position;var offsets=geometry.offsets;if(offsets.length===0){_gl.drawArrays(mode,0,position.array.length/3);_this.info.render.calls++;_this.info.render.vertices+=position.array.length/3}else{for(var i=0,il=offsets.length;i<il;i++){_gl.drawArrays(mode,offsets[i].index,offsets[i].count);_this.info.render.calls++;_this.info.render.vertices+=offsets[i].count}}}}};this.renderBuffer=function(camera,lights,fog,material,geometryGroup,object){if(material.visible===false)return;updateObject(object);var program=setProgram(camera,lights,fog,material,object);var attributes=program.attributes;var updateBuffers=false,wireframeBit=material.wireframe?1:0,geometryProgram=geometryGroup.id+"_"+program.id+"_"+wireframeBit;if(geometryProgram!==_currentGeometryProgram){_currentGeometryProgram=geometryProgram;updateBuffers=true}if(updateBuffers){state.initAttributes()}if(!material.morphTargets&&attributes.position>=0){if(updateBuffers){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglVertexBuffer);state.enableAttribute(attributes.position);_gl.vertexAttribPointer(attributes.position,3,_gl.FLOAT,false,0,0)}}else{if(object.morphTargetBase){setupMorphTargets(material,geometryGroup,object)}}if(updateBuffers){if(geometryGroup.__webglCustomAttributesList){for(var i=0,il=geometryGroup.__webglCustomAttributesList.length;i<il;i++){var attribute=geometryGroup.__webglCustomAttributesList[i];if(attributes[attribute.buffer.belongsToAttribute]>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,attribute.buffer);state.enableAttribute(attributes[attribute.buffer.belongsToAttribute]);_gl.vertexAttribPointer(attributes[attribute.buffer.belongsToAttribute],attribute.size,_gl.FLOAT,false,0,0)}}}if(attributes.color>=0){if(object.geometry.colors.length>0||object.geometry.faces.length>0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglColorBuffer);state.enableAttribute(attributes.color);_gl.vertexAttribPointer(attributes.color,3,_gl.FLOAT,false,0,0)}else if(material.defaultAttributeValues!==undefined){_gl.vertexAttrib3fv(attributes.color,material.defaultAttributeValues.color)}}if(attributes.normal>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglNormalBuffer);state.enableAttribute(attributes.normal);_gl.vertexAttribPointer(attributes.normal,3,_gl.FLOAT,false,0,0)}if(attributes.tangent>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglTangentBuffer);state.enableAttribute(attributes.tangent);_gl.vertexAttribPointer(attributes.tangent,4,_gl.FLOAT,false,0,0)}if(attributes.uv>=0){if(object.geometry.faceVertexUvs[0]){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglUVBuffer);state.enableAttribute(attributes.uv);_gl.vertexAttribPointer(attributes.uv,2,_gl.FLOAT,false,0,0)}else if(material.defaultAttributeValues!==undefined){_gl.vertexAttrib2fv(attributes.uv,material.defaultAttributeValues.uv)}}if(attributes.uv2>=0){if(object.geometry.faceVertexUvs[1]){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglUV2Buffer);state.enableAttribute(attributes.uv2);_gl.vertexAttribPointer(attributes.uv2,2,_gl.FLOAT,false,0,0)}else if(material.defaultAttributeValues!==undefined){_gl.vertexAttrib2fv(attributes.uv2,material.defaultAttributeValues.uv2)}}if(material.skinning&&attributes.skinIndex>=0&&attributes.skinWeight>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglSkinIndicesBuffer);state.enableAttribute(attributes.skinIndex);_gl.vertexAttribPointer(attributes.skinIndex,4,_gl.FLOAT,false,0,0);_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglSkinWeightsBuffer);state.enableAttribute(attributes.skinWeight);_gl.vertexAttribPointer(attributes.skinWeight,4,_gl.FLOAT,false,0,0)}if(attributes.lineDistance>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglLineDistanceBuffer);state.enableAttribute(attributes.lineDistance);_gl.vertexAttribPointer(attributes.lineDistance,1,_gl.FLOAT,false,0,0)}}state.disableUnusedAttributes();if(!!(instance=object)&&!!instance.isMesh){var type=geometryGroup.__typeArray===Uint32Array?_gl.UNSIGNED_INT:_gl.UNSIGNED_SHORT;if(material.wireframe){state.setLineWidth(material.wireframeLinewidth*pixelRatio);if(updateBuffers)_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,geometryGroup.__webglLineBuffer);_gl.drawElements(_gl.LINES,geometryGroup.__webglLineCount,type,0)}else{if(updateBuffers)_gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER,geometryGroup.__webglFaceBuffer);_gl.drawElements(_gl.TRIANGLES,geometryGroup.__webglFaceCount,type,0)}_this.info.render.calls++;_this.info.render.vertices+=geometryGroup.__webglFaceCount;_this.info.render.faces+=geometryGroup.__webglFaceCount/3}else if(!!(instance=object)&&!!instance.isLine){var mode=object.mode===Three.LineStrip?_gl.LINE_STRIP:_gl.LINES;state.setLineWidth(material.linewidth*pixelRatio);_gl.drawArrays(mode,0,geometryGroup.__webglLineCount);_this.info.render.calls++}else if(!!(instance=object)&&!!instance.isPointCloud){_gl.drawArrays(_gl.POINTS,0,geometryGroup.__webglParticleCount);_this.info.render.calls++;_this.info.render.points+=geometryGroup.__webglParticleCount}};function setupMorphTargets(material,geometryGroup,object){var attributes=material.program.attributes;if(object.morphTargetBase!==-1&&attributes.position>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphTargetsBuffers[object.morphTargetBase]);state.enableAttribute(attributes.position);_gl.vertexAttribPointer(attributes.position,3,_gl.FLOAT,false,0,0)}else if(attributes.position>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglVertexBuffer);state.enableAttribute(attributes.position);_gl.vertexAttribPointer(attributes.position,3,_gl.FLOAT,false,0,0)}if(object.morphTargetForcedOrder.length){var m=0;var order=object.morphTargetForcedOrder;var influences=object.morphTargetInfluences;var attribute;while(m<material.numSupportedMorphTargets&&m<order.length){attribute=attributes["morphTarget"+m];if(attribute>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphTargetsBuffers[order[m]]);state.enableAttribute(attribute);_gl.vertexAttribPointer(attribute,3,_gl.FLOAT,false,0,0)}attribute=attributes["morphNormal"+m];if(attribute>=0&&material.morphNormals){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphNormalsBuffers[order[m]]);state.enableAttribute(attribute);_gl.vertexAttribPointer(attribute,3,_gl.FLOAT,false,0,0)}object.__webglMorphTargetInfluences[m]=influences[order[m]];m++}}else{var activeInfluenceIndices=[];var influences=object.morphTargetInfluences;var morphTargets=object.geometry.morphTargets;if(influences.length>morphTargets.length){console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array.");influences.length=morphTargets.length}for(var i=0,il=influences.length;i<il;i++){var influence=influences[i];activeInfluenceIndices.push([influence,i])}if(activeInfluenceIndices.length>material.numSupportedMorphTargets){activeInfluenceIndices.sort(numericalSort);activeInfluenceIndices.length=material.numSupportedMorphTargets}else if(activeInfluenceIndices.length>material.numSupportedMorphNormals){activeInfluenceIndices.sort(numericalSort)}else if(activeInfluenceIndices.length===0){activeInfluenceIndices.push([0,0])}var attribute;for(var m=0,ml=material.numSupportedMorphTargets;m<ml;m++){if(activeInfluenceIndices[m]){var influenceIndex=activeInfluenceIndices[m][1];attribute=attributes["morphTarget"+m];if(attribute>=0){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphTargetsBuffers[influenceIndex]);state.enableAttribute(attribute);_gl.vertexAttribPointer(attribute,3,_gl.FLOAT,false,0,0)}attribute=attributes["morphNormal"+m];if(attribute>=0&&material.morphNormals){_gl.bindBuffer(_gl.ARRAY_BUFFER,geometryGroup.__webglMorphNormalsBuffers[influenceIndex]);state.enableAttribute(attribute);_gl.vertexAttribPointer(attribute,3,_gl.FLOAT,false,0,0)}object.__webglMorphTargetInfluences[m]=influences[influenceIndex]}else{object.__webglMorphTargetInfluences[m]=0}}}if(material.program.uniforms.morphTargetInfluences!==null){_gl.uniform1fv(material.program.uniforms.morphTargetInfluences,object.__webglMorphTargetInfluences)}}function painterSortStable(a,b){if(a.object.renderOrder!==b.object.renderOrder){return a.object.renderOrder-b.object.renderOrder}else if(a.material.id!==b.material.id){return a.material.id-b.material.id}else if(a.z!==b.z){return a.z-b.z}else{return a.id-b.id}}function reversePainterSortStable(a,b){if(a.object.renderOrder!==b.object.renderOrder){return a.object.renderOrder-b.object.renderOrder}if(a.z!==b.z){return b.z-a.z}else{return a.id-b.id}}function numericalSort(a,b){return b[0]-a[0]}this.render=function(scene,camera,renderTarget,forceClear){if((!!(instance=camera)&&!!instance.isCamera)===false){Three.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}var fog=scene.fog;_currentGeometryProgram="";_currentMaterialId=-1;_currentCamera=null;_lightsNeedUpdate=true;if(scene.autoUpdate===true)scene.updateMatrixWorld();if(camera.parent===undefined)camera.updateMatrixWorld();scene.traverse(function(object){if(!!(instance=object)&&!!instance.isSkinnedMesh){object.skeleton.update()}});camera.matrixWorldInverse.getInverse(camera.matrixWorld);_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse);_frustum.setFromMatrix(_projScreenMatrix);lights.length=0;opaqueObjects.length=0;transparentObjects.length=0;sprites.length=0;lensFlares.length=0;projectObject(scene);if(_this.sortObjects===true){opaqueObjects.sort(painterSortStable);transparentObjects.sort(reversePainterSortStable)}shadowMapPlugin.render(scene,camera);_this.info.render.calls=0;_this.info.render.vertices=0;_this.info.render.faces=0;_this.info.render.points=0;this.setRenderTarget(renderTarget);if(this.autoClear||forceClear){this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil)}for(var i=0,il=_webglObjectsImmediate.length;i<il;i++){var webglObject=_webglObjectsImmediate[i];var object=webglObject.object;if(object.visible){setupMatrices(object,camera);unrollImmediateBufferMaterial(webglObject)}}if(scene.overrideMaterial){var overrideMaterial=scene.overrideMaterial;setMaterial(overrideMaterial);renderObjects(opaqueObjects,camera,lights,fog,overrideMaterial);renderObjects(transparentObjects,camera,lights,fog,overrideMaterial);renderObjectsImmediate(_webglObjectsImmediate,"",camera,lights,fog,overrideMaterial)}else{state.setBlending(Three.NoBlending);renderObjects(opaqueObjects,camera,lights,fog,null);renderObjectsImmediate(_webglObjectsImmediate,"opaque",camera,lights,fog,null);renderObjects(transparentObjects,camera,lights,fog,null);renderObjectsImmediate(_webglObjectsImmediate,"transparent",camera,lights,fog,null)}spritePlugin.render(scene,camera);lensFlarePlugin.render(scene,camera,_currentWidth,_currentHeight);if(renderTarget&&renderTarget.generateMipmaps&&renderTarget.minFilter!==Three.NearestFilter&&renderTarget.minFilter!==Three.LinearFilter){updateRenderTargetMipmap(renderTarget)}state.setDepthTest(true);state.setDepthWrite(true);state.setColorWrite(true)};function projectObject(object){if(object.visible===false)return;if(!!(instance=object)&&!!instance.isScene||!!(instance=object)&&!!instance.isGroup){}else{initObject(object);if(!!(instance=object)&&!!instance.isLight){lights.push(object)}else if(!!(instance=object)&&!!instance.isSprite){sprites.push(object)}else if(!!(instance=object)&&!!instance.isLensFlare){lensFlares.push(object)}else{var webglObjects=_webglObjects[object.id];if(webglObjects&&(object.frustumCulled===false||_frustum.intersectsObject(object)===true)){for(var i=0,l=webglObjects.length;i<l;i++){var webglObject=webglObjects[i];unrollBufferMaterial(webglObject);webglObject.render=true;if(_this.sortObjects===true){_vector3.setFromMatrixPosition(object.matrixWorld);_vector3.applyProjection(_projScreenMatrix);webglObject.z=_vector3.z}}}}}for(var i=0,l=object.children.length;i<l;i++){projectObject(object.children[i])}}function renderObjects(renderList,camera,lights,fog,overrideMaterial){var material;for(var i=0,l=renderList.length;i<l;i++){var webglObject=renderList[i];var object=webglObject.object;var buffer=webglObject.buffer;setupMatrices(object,camera);if(overrideMaterial){material=overrideMaterial}else{material=webglObject.material;if(!material)continue;setMaterial(material)}_this.setMaterialFaces(material);if(!!(instance=buffer)&&!!instance.isBufferGeometry){_this.renderBufferDirect(camera,lights,fog,material,buffer,object)}else{_this.renderBuffer(camera,lights,fog,material,buffer,object)}}}function renderObjectsImmediate(renderList,materialType,camera,lights,fog,overrideMaterial){var material;for(var i=0,l=renderList.length;i<l;i++){var webglObject=renderList[i];var object=webglObject.object;if(object.visible){if(overrideMaterial){material=overrideMaterial}else{material=webglObject[materialType];if(!material)continue;setMaterial(material)}_this.renderImmediateObject(camera,lights,fog,material,object)}}}this.renderImmediateObject=function(camera,lights,fog,material,object){var program=setProgram(camera,lights,fog,material,object);_currentGeometryProgram="";_this.setMaterialFaces(material);if(object.immediateRenderCallback){object.immediateRenderCallback(program,_gl,_frustum)}else{object.render(function(object){_this.renderBufferImmediate(object,program,material)})}};function unrollImmediateBufferMaterial(globject){var object=globject.object,material=object.material;if(material.transparent){globject.transparent=material;globject.opaque=null}else{globject.opaque=material;globject.transparent=null}}function unrollBufferMaterial(globject){var object=globject.object;var buffer=globject.buffer;var geometry=object.geometry;var material=object.material;if(!!(instance=material)&&!!instance.isMeshFaceMaterial){var materialIndex=!!(instance=geometry)&&!!instance.isBufferGeometry?0:buffer.materialIndex;material=material.materials[materialIndex];globject.material=material;if(material.transparent){transparentObjects.push(globject)}else{opaqueObjects.push(globject)}}else if(material){globject.material=material;if(material.transparent){transparentObjects.push(globject)}else{opaqueObjects.push(globject)}}}function initObject(object){if(object.__webglInit===undefined){object.__webglInit=true;object._modelViewMatrix=new Matrix4Module.Matrix4;object._normalMatrix=new Matrix3Module.Matrix3;object.addEventListener("removed",onObjectRemoved)}var geometry=object.geometry;if(geometry===undefined){}else if(geometry.__webglInit===undefined){geometry.__webglInit=true;geometry.addEventListener("dispose",onGeometryDispose);if(!!(instance=geometry)&&!!instance.isBufferGeometry){_this.info.memory.geometries++}else if(!!(instance=object)&&!!instance.isMesh){initGeometryGroups(object,geometry)}else if(!!(instance=object)&&!!instance.isLine){if(geometry.__webglVertexBuffer===undefined){createLineBuffers(geometry);initLineBuffers(geometry,object);geometry.verticesNeedUpdate=true;geometry.colorsNeedUpdate=true;geometry.lineDistancesNeedUpdate=true}}else if(!!(instance=object)&&!!instance.isPointCloud){if(geometry.__webglVertexBuffer===undefined){createParticleBuffers(geometry);initParticleBuffers(geometry,object);geometry.verticesNeedUpdate=true;geometry.colorsNeedUpdate=true}}}if(object.__webglActive===undefined){object.__webglActive=true;if(!!(instance=object)&&!!instance.isMesh){if(!!(instance=geometry)&&!!instance.isBufferGeometry){addBuffer(_webglObjects,geometry,object)}else if(!!(instance=geometry)&&!!instance.isGeometry){var geometryGroupsList=geometryGroups[geometry.id];for(var i=0,l=geometryGroupsList.length;i<l;i++){addBuffer(_webglObjects,geometryGroupsList[i],object)}}}else if(!!(instance=object)&&!!instance.isLine||!!(instance=object)&&!!instance.isPointCloud){addBuffer(_webglObjects,geometry,object)}else if(!!(instance=object)&&!!instance.isImmediateRenderObject||object.immediateRenderCallback){addBufferImmediate(_webglObjectsImmediate,object)}}}var geometryGroups={};var geometryGroupCounter=0;function makeGroups(geometry,usesFaceMaterial){var maxVerticesInGroup=extensions.get("OES_element_index_uint")?4294967296:65535;var groupHash,hash_map={};var numMorphTargets=geometry.morphTargets.length;var numMorphNormals=geometry.morphNormals.length;var group;var groups={};var groupsList=[];for(var f=0,fl=geometry.faces.length;f<fl;f++){var face=geometry.faces[f];var materialIndex=usesFaceMaterial?face.materialIndex:0;if(!(materialIndex in hash_map)){hash_map[materialIndex]={hash:materialIndex,counter:0}}groupHash=hash_map[materialIndex].hash+"_"+hash_map[materialIndex].counter;if(!(groupHash in groups)){group={id:geometryGroupCounter++,faces3:[],materialIndex:materialIndex,vertices:0,numMorphTargets:numMorphTargets,numMorphNormals:numMorphNormals};groups[groupHash]=group;groupsList.push(group)}if(groups[groupHash].vertices+3>maxVerticesInGroup){hash_map[materialIndex].counter+=1;groupHash=hash_map[materialIndex].hash+"_"+hash_map[materialIndex].counter;if(!(groupHash in groups)){group={id:geometryGroupCounter++,faces3:[],materialIndex:materialIndex,vertices:0,numMorphTargets:numMorphTargets,numMorphNormals:numMorphNormals};groups[groupHash]=group;groupsList.push(group)}}groups[groupHash].faces3.push(f);groups[groupHash].vertices+=3}return groupsList}function initGeometryGroups(object,geometry){var material=object.material,addBuffers=false;if(geometryGroups[geometry.id]===undefined||geometry.groupsNeedUpdate===true){delete _webglObjects[object.id];geometryGroups[geometry.id]=makeGroups(geometry,!!(instance=material)&&!!instance.isMeshFaceMaterial);geometry.groupsNeedUpdate=false}var geometryGroupsList=geometryGroups[geometry.id];for(var i=0,il=geometryGroupsList.length;i<il;i++){var geometryGroup=geometryGroupsList[i];if(geometryGroup.__webglVertexBuffer===undefined){createMeshBuffers(geometryGroup);initMeshBuffers(geometryGroup,object);geometry.verticesNeedUpdate=true;geometry.morphTargetsNeedUpdate=true;geometry.elementsNeedUpdate=true;geometry.uvsNeedUpdate=true;geometry.normalsNeedUpdate=true;geometry.tangentsNeedUpdate=true;geometry.colorsNeedUpdate=true;addBuffers=true}else{addBuffers=false}if(addBuffers||object.__webglActive===undefined){addBuffer(_webglObjects,geometryGroup,object)}}object.__webglActive=true}function addBuffer(objlist,buffer,object){var id=object.id;objlist[id]=objlist[id]||[];objlist[id].push({id:id,buffer:buffer,object:object,material:null,z:0})}function addBufferImmediate(objlist,object){objlist.push({id:null,object:object,opaque:null,transparent:null,z:0})}function updateObject(object){var geometry=object.geometry;if(!!(instance=geometry)&&!!instance.isBufferGeometry){var attributes=geometry.attributes;var attributesKeys=geometry.attributesKeys;for(var i=0,l=attributesKeys.length;i<l;i++){var key=attributesKeys[i];var attribute=attributes[key];var bufferType=key==="index"?_gl.ELEMENT_ARRAY_BUFFER:_gl.ARRAY_BUFFER;if(attribute.buffer===undefined){attribute.buffer=_gl.createBuffer();_gl.bindBuffer(bufferType,attribute.buffer);_gl.bufferData(bufferType,attribute.array,!!(instance=attribute)&&!!instance.isDynamicBufferAttribute?_gl.DYNAMIC_DRAW:_gl.STATIC_DRAW);attribute.needsUpdate=false}else if(attribute.needsUpdate===true){_gl.bindBuffer(bufferType,attribute.buffer);if(attribute.updateRange===undefined||attribute.updateRange.count===-1){_gl.bufferSubData(bufferType,0,attribute.array)}else if(attribute.updateRange.count===0){console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually.")}else{_gl.bufferSubData(bufferType,attribute.updateRange.offset*attribute.array.BYTES_PER_ELEMENT,attribute.array.subarray(attribute.updateRange.offset,attribute.updateRange.offset+attribute.updateRange.count));attribute.updateRange.count=0}attribute.needsUpdate=false}}}else if(!!(instance=object)&&!!instance.isMesh){if(geometry.groupsNeedUpdate===true){initGeometryGroups(object,geometry)}var geometryGroupsList=geometryGroups[geometry.id];for(var i=0,il=geometryGroupsList.length;i<il;i++){var geometryGroup=geometryGroupsList[i];var material=getBufferMaterial(object,geometryGroup);var customAttributesDirty=material.attributes&&areCustomAttributesDirty(material);if(geometry.verticesNeedUpdate||geometry.morphTargetsNeedUpdate||geometry.elementsNeedUpdate||geometry.uvsNeedUpdate||geometry.normalsNeedUpdate||geometry.colorsNeedUpdate||geometry.tangentsNeedUpdate||customAttributesDirty){setMeshBuffers(geometryGroup,object,_gl.DYNAMIC_DRAW,!geometry.dynamic,material)}}geometry.verticesNeedUpdate=false;geometry.morphTargetsNeedUpdate=false;geometry.elementsNeedUpdate=false;geometry.uvsNeedUpdate=false;geometry.normalsNeedUpdate=false;geometry.colorsNeedUpdate=false;geometry.tangentsNeedUpdate=false;material.attributes&&clearCustomAttributes(material)}else if(!!(instance=object)&&!!instance.isLine){var material=getBufferMaterial(object,geometry);var customAttributesDirty=material.attributes&&areCustomAttributesDirty(material);if(geometry.verticesNeedUpdate||geometry.colorsNeedUpdate||geometry.lineDistancesNeedUpdate||customAttributesDirty){setLineBuffers(geometry,_gl.DYNAMIC_DRAW)}geometry.verticesNeedUpdate=false;geometry.colorsNeedUpdate=false;geometry.lineDistancesNeedUpdate=false;material.attributes&&clearCustomAttributes(material)}else if(!!(instance=object)&&!!instance.isPointCloud){var material=getBufferMaterial(object,geometry);var customAttributesDirty=material.attributes&&areCustomAttributesDirty(material);if(geometry.verticesNeedUpdate||geometry.colorsNeedUpdate||customAttributesDirty){setParticleBuffers(geometry,_gl.DYNAMIC_DRAW,object)}geometry.verticesNeedUpdate=false;geometry.colorsNeedUpdate=false;material.attributes&&clearCustomAttributes(material)}}function areCustomAttributesDirty(material){for(var name in material.attributes){if(material.attributes[name].needsUpdate)return true}return false}function clearCustomAttributes(material){for(var name in material.attributes){material.attributes[name].needsUpdate=false}}function removeObject(object){if(!!(instance=object)&&!!instance.isMesh||!!(instance=object)&&!!instance.isPointCloud||!!(instance=object)&&!!instance.isLine){delete _webglObjects[object.id]}else if(!!(instance=object)&&!!instance.isImmediateRenderObject||object.immediateRenderCallback){removeInstances(_webglObjectsImmediate,object)}delete object.__webglInit;delete object._modelViewMatrix;delete object._normalMatrix;delete object.__webglActive}function removeInstances(objlist,object){for(var o=objlist.length-1;o>=0;o--){if(objlist[o].object===object){objlist.splice(o,1)}}}var shaderIDs={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};function initMaterial(material,lights,fog,object){material.addEventListener("dispose",onMaterialDispose);var shaderID=shaderIDs[material.type];if(shaderID){var shader=ShaderLibModule.ShaderLib[shaderID];material.__webglShader={uniforms:UniformsUtilsModule.UniformsUtils.clone(shader.uniforms),vertexShader:shader.vertexShader,fragmentShader:shader.fragmentShader}}else{material.__webglShader={uniforms:material.uniforms,vertexShader:material.vertexShader,fragmentShader:material.fragmentShader}}var maxLightCount=allocateLights(lights);var maxShadows=allocateShadows(lights);var maxBones=allocateBones(object);var parameters={precision:_precision,supportsVertexTextures:_supportsVertexTextures,map:!!material.map,envMap:!!material.envMap,envMapMode:material.envMap&&material.envMap.mapping,lightMap:!!material.lightMap,bumpMap:!!material.bumpMap,normalMap:!!material.normalMap,specularMap:!!material.specularMap,alphaMap:!!material.alphaMap,combine:material.combine,vertexColors:material.vertexColors,fog:fog,useFog:material.fog,fogExp:!!(instance=fog)&&!!instance.isFogExp2,flatShading:material.shading===Three.FlatShading,sizeAttenuation:material.sizeAttenuation,logarithmicDepthBuffer:_logarithmicDepthBuffer,skinning:material.skinning,maxBones:maxBones,useVertexTexture:_supportsBoneTextures&&object&&object.skeleton&&object.skeleton.useVertexTexture,morphTargets:material.morphTargets,morphNormals:material.morphNormals,maxMorphTargets:_this.maxMorphTargets,maxMorphNormals:_this.maxMorphNormals,maxDirLights:maxLightCount.directional,maxPointLights:maxLightCount.point,maxSpotLights:maxLightCount.spot,maxHemiLights:maxLightCount.hemi,maxShadows:maxShadows,shadowMapEnabled:_this.shadowMapEnabled&&object.receiveShadow&&maxShadows>0,shadowMapType:_this.shadowMapType,shadowMapDebug:_this.shadowMapDebug,shadowMapCascade:_this.shadowMapCascade,alphaTest:material.alphaTest,metal:material.metal,wrapAround:material.wrapAround,doubleSided:material.side===Three.DoubleSide,flipSided:material.side===Three.BackSide};var chunks=[];if(shaderID){chunks.push(shaderID)}else{chunks.push(material.fragmentShader);chunks.push(material.vertexShader)}if(material.defines!==undefined){for(var name in material.defines){chunks.push(name);chunks.push(material.defines[name])}}for(var name in parameters){chunks.push(name);chunks.push(parameters[name])}var code=chunks.join();var program;for(var p=0,pl=_programs.length;p<pl;p++){var programInfo=_programs[p];if(programInfo.code===code){program=programInfo;program.usedTimes++;break}}if(program===undefined){program=new WebGLProgramModule.WebGLProgram(_this,code,material,parameters);_programs.push(program);_this.info.memory.programs=_programs.length}material.program=program;var attributes=program.attributes;if(material.morphTargets){material.numSupportedMorphTargets=0;var id,base="morphTarget";for(var i=0;i<_this.maxMorphTargets;i++){id=base+i;if(attributes[id]>=0){material.numSupportedMorphTargets++}}}if(material.morphNormals){material.numSupportedMorphNormals=0;var id,base="morphNormal";for(i=0;i<_this.maxMorphNormals;i++){id=base+i;if(attributes[id]>=0){material.numSupportedMorphNormals++}}}material.uniformsList=[];for(var u in material.__webglShader.uniforms){var location=material.program.uniforms[u];if(location){material.uniformsList.push([material.__webglShader.uniforms[u],location])}}}function setMaterial(material){if(material.transparent===true){state.setBlending(material.blending,material.blendEquation,material.blendSrc,material.blendDst,material.blendEquationAlpha,material.blendSrcAlpha,material.blendDstAlpha)}else{state.setBlending(Three.NoBlending)}state.setDepthTest(material.depthTest);state.setDepthWrite(material.depthWrite);state.setColorWrite(material.colorWrite);state.setPolygonOffset(material.polygonOffset,material.polygonOffsetFactor,material.polygonOffsetUnits)}function setProgram(camera,lights,fog,material,object){_usedTextureUnits=0;if(material.needsUpdate){if(material.program)deallocateMaterial(material);initMaterial(material,lights,fog,object);material.needsUpdate=false}if(material.morphTargets){if(!object.__webglMorphTargetInfluences){object.__webglMorphTargetInfluences=new Float32Array(_this.maxMorphTargets)}}var refreshProgram=false;var refreshMaterial=false;var refreshLights=false;var program=material.program,p_uniforms=program.uniforms,m_uniforms=material.__webglShader.uniforms;if(program.id!==_currentProgram){_gl.useProgram(program.program);_currentProgram=program.id;refreshProgram=true;refreshMaterial=true;refreshLights=true}if(material.id!==_currentMaterialId){if(_currentMaterialId===-1)refreshLights=true;_currentMaterialId=material.id;refreshMaterial=true}if(refreshProgram||camera!==_currentCamera){_gl.uniformMatrix4fv(p_uniforms.projectionMatrix,false,camera.projectionMatrix.elements);if(_logarithmicDepthBuffer){_gl.uniform1f(p_uniforms.logDepthBufFC,2/(Math.log(camera.far+1)/Math.LN2))}if(camera!==_currentCamera)_currentCamera=camera;if(!!(instance=material)&&!!instance.isShaderMaterial||!!(instance=material)&&!!instance.isMeshPhongMaterial||material.envMap){if(p_uniforms.cameraPosition!==null){_vector3.setFromMatrixPosition(camera.matrixWorld);_gl.uniform3f(p_uniforms.cameraPosition,_vector3.x,_vector3.y,_vector3.z)}}if(!!(instance=material)&&!!instance.isMeshPhongMaterial||!!(instance=material)&&!!instance.isMeshLambertMaterial||!!(instance=material)&&!!instance.isMeshBasicMaterial||!!(instance=material)&&!!instance.isShaderMaterial||material.skinning){if(p_uniforms.viewMatrix!==null){_gl.uniformMatrix4fv(p_uniforms.viewMatrix,false,camera.matrixWorldInverse.elements)}}}if(material.skinning){if(object.bindMatrix&&p_uniforms.bindMatrix!==null){_gl.uniformMatrix4fv(p_uniforms.bindMatrix,false,object.bindMatrix.elements)}if(object.bindMatrixInverse&&p_uniforms.bindMatrixInverse!==null){_gl.uniformMatrix4fv(p_uniforms.bindMatrixInverse,false,object.bindMatrixInverse.elements)}if(_supportsBoneTextures&&object.skeleton&&object.skeleton.useVertexTexture){if(p_uniforms.boneTexture!==null){var textureUnit=getTextureUnit();_gl.uniform1i(p_uniforms.boneTexture,textureUnit);_this.setTexture(object.skeleton.boneTexture,textureUnit)}if(p_uniforms.boneTextureWidth!==null){_gl.uniform1i(p_uniforms.boneTextureWidth,object.skeleton.boneTextureWidth)}if(p_uniforms.boneTextureHeight!==null){_gl.uniform1i(p_uniforms.boneTextureHeight,object.skeleton.boneTextureHeight)}}else if(object.skeleton&&object.skeleton.boneMatrices){if(p_uniforms.boneGlobalMatrices!==null){_gl.uniformMatrix4fv(p_uniforms.boneGlobalMatrices,false,object.skeleton.boneMatrices)}}}if(refreshMaterial){if(fog&&material.fog){refreshUniformsFog(m_uniforms,fog)}if(!!(instance=material)&&!!instance.isMeshPhongMaterial||!!(instance=material)&&!!instance.isMeshLambertMaterial||material.lights){if(_lightsNeedUpdate){refreshLights=true;setupLights(lights);_lightsNeedUpdate=false}if(refreshLights){refreshUniformsLights(m_uniforms,_lights);markUniformsLightsNeedsUpdate(m_uniforms,true)}else{markUniformsLightsNeedsUpdate(m_uniforms,false)}}if(!!(instance=material)&&!!instance.isMeshBasicMaterial||!!(instance=material)&&!!instance.isMeshLambertMaterial||!!(instance=material)&&!!instance.isMeshPhongMaterial){refreshUniformsCommon(m_uniforms,material)}if(!!(instance=material)&&!!instance.isLineBasicMaterial){refreshUniformsLine(m_uniforms,material)}else if(!!(instance=material)&&!!instance.isLineDashedMaterial){refreshUniformsLine(m_uniforms,material);refreshUniformsDash(m_uniforms,material)}else if(!!(instance=material)&&!!instance.isPointCloudMaterial){
refreshUniformsParticle(m_uniforms,material)}else if(!!(instance=material)&&!!instance.isMeshPhongMaterial){refreshUniformsPhong(m_uniforms,material)}else if(!!(instance=material)&&!!instance.isMeshLambertMaterial){refreshUniformsLambert(m_uniforms,material)}else if(!!(instance=material)&&!!instance.isMeshDepthMaterial){m_uniforms.mNear.value=camera.near;m_uniforms.mFar.value=camera.far;m_uniforms.opacity.value=material.opacity}else if(!!(instance=material)&&!!instance.isMeshNormalMaterial){m_uniforms.opacity.value=material.opacity}if(object.receiveShadow&&!material._shadowPass){refreshUniformsShadow(m_uniforms,lights)}loadUniformsGeneric(material.uniformsList)}loadUniformsMatrices(p_uniforms,object);if(p_uniforms.modelMatrix!==null){_gl.uniformMatrix4fv(p_uniforms.modelMatrix,false,object.matrixWorld.elements)}return program}function refreshUniformsCommon(uniforms,material){uniforms.opacity.value=material.opacity;uniforms.diffuse.value=material.color;uniforms.map.value=material.map;uniforms.lightMap.value=material.lightMap;uniforms.specularMap.value=material.specularMap;uniforms.alphaMap.value=material.alphaMap;if(material.bumpMap){uniforms.bumpMap.value=material.bumpMap;uniforms.bumpScale.value=material.bumpScale}if(material.normalMap){uniforms.normalMap.value=material.normalMap;uniforms.normalScale.value.copy(material.normalScale)}var uvScaleMap;if(material.map){uvScaleMap=material.map}else if(material.specularMap){uvScaleMap=material.specularMap}else if(material.normalMap){uvScaleMap=material.normalMap}else if(material.bumpMap){uvScaleMap=material.bumpMap}else if(material.alphaMap){uvScaleMap=material.alphaMap}if(uvScaleMap!==undefined){var offset=uvScaleMap.offset;var repeat=uvScaleMap.repeat;uniforms.offsetRepeat.value.set(offset.x,offset.y,repeat.x,repeat.y)}uniforms.envMap.value=material.envMap;uniforms.flipEnvMap.value=!!(instance=material.envMap)&&!!instance.isWebGLRenderTargetCube?1:-1;uniforms.reflectivity.value=material.reflectivity;uniforms.refractionRatio.value=material.refractionRatio}function refreshUniformsLine(uniforms,material){uniforms.diffuse.value=material.color;uniforms.opacity.value=material.opacity}function refreshUniformsDash(uniforms,material){uniforms.dashSize.value=material.dashSize;uniforms.totalSize.value=material.dashSize+material.gapSize;uniforms.scale.value=material.scale}function refreshUniformsParticle(uniforms,material){uniforms.psColor.value=material.color;uniforms.opacity.value=material.opacity;uniforms.size.value=material.size;uniforms.scale.value=_canvas.height/2;uniforms.map.value=material.map;if(material.map!==null){var offset=material.map.offset;var repeat=material.map.repeat;uniforms.offsetRepeat.value.set(offset.x,offset.y,repeat.x,repeat.y)}}function refreshUniformsFog(uniforms,fog){uniforms.fogColor.value=fog.color;if(!!(instance=fog)&&!!instance.isFog){uniforms.fogNear.value=fog.near;uniforms.fogFar.value=fog.far}else if(!!(instance=fog)&&!!instance.isFogExp2){uniforms.fogDensity.value=fog.density}}function refreshUniformsPhong(uniforms,material){uniforms.shininess.value=material.shininess;uniforms.emissive.value=material.emissive;uniforms.specular.value=material.specular;if(material.wrapAround){uniforms.wrapRGB.value.copy(material.wrapRGB)}}function refreshUniformsLambert(uniforms,material){uniforms.emissive.value=material.emissive;if(material.wrapAround){uniforms.wrapRGB.value.copy(material.wrapRGB)}}function refreshUniformsLights(uniforms,lights){uniforms.ambientLightColor.value=lights.ambient;uniforms.directionalLightColor.value=lights.directional.colors;uniforms.directionalLightDirection.value=lights.directional.positions;uniforms.pointLightColor.value=lights.point.colors;uniforms.pointLightPosition.value=lights.point.positions;uniforms.pointLightDistance.value=lights.point.distances;uniforms.pointLightDecay.value=lights.point.decays;uniforms.spotLightColor.value=lights.spot.colors;uniforms.spotLightPosition.value=lights.spot.positions;uniforms.spotLightDistance.value=lights.spot.distances;uniforms.spotLightDirection.value=lights.spot.directions;uniforms.spotLightAngleCos.value=lights.spot.anglesCos;uniforms.spotLightExponent.value=lights.spot.exponents;uniforms.spotLightDecay.value=lights.spot.decays;uniforms.hemisphereLightSkyColor.value=lights.hemi.skyColors;uniforms.hemisphereLightGroundColor.value=lights.hemi.groundColors;uniforms.hemisphereLightDirection.value=lights.hemi.positions}function markUniformsLightsNeedsUpdate(uniforms,value){uniforms.ambientLightColor.needsUpdate=value;uniforms.directionalLightColor.needsUpdate=value;uniforms.directionalLightDirection.needsUpdate=value;uniforms.pointLightColor.needsUpdate=value;uniforms.pointLightPosition.needsUpdate=value;uniforms.pointLightDistance.needsUpdate=value;uniforms.pointLightDecay.needsUpdate=value;uniforms.spotLightColor.needsUpdate=value;uniforms.spotLightPosition.needsUpdate=value;uniforms.spotLightDistance.needsUpdate=value;uniforms.spotLightDirection.needsUpdate=value;uniforms.spotLightAngleCos.needsUpdate=value;uniforms.spotLightExponent.needsUpdate=value;uniforms.spotLightDecay.needsUpdate=value;uniforms.hemisphereLightSkyColor.needsUpdate=value;uniforms.hemisphereLightGroundColor.needsUpdate=value;uniforms.hemisphereLightDirection.needsUpdate=value}function refreshUniformsShadow(uniforms,lights){if(uniforms.shadowMatrix){var j=0;for(var i=0,il=lights.length;i<il;i++){var light=lights[i];if(!light.castShadow)continue;if(!!(instance=light)&&!!instance.isSpotLight||!!(instance=light)&&!!instance.isDirectionalLight&&!light.shadowCascade){uniforms.shadowMap.value[j]=light.shadowMap;uniforms.shadowMapSize.value[j]=light.shadowMapSize;uniforms.shadowMatrix.value[j]=light.shadowMatrix;uniforms.shadowDarkness.value[j]=light.shadowDarkness;uniforms.shadowBias.value[j]=light.shadowBias;j++}}}}function loadUniformsMatrices(uniforms,object){_gl.uniformMatrix4fv(uniforms.modelViewMatrix,false,object._modelViewMatrix.elements);if(uniforms.normalMatrix){_gl.uniformMatrix3fv(uniforms.normalMatrix,false,object._normalMatrix.elements)}}function getTextureUnit(){var textureUnit=_usedTextureUnits;if(textureUnit>=_maxTextures){Three.warn("WebGLRenderer: trying to use "+textureUnit+" texture units while this GPU supports only "+_maxTextures)}_usedTextureUnits+=1;return textureUnit}function loadUniformsGeneric(uniforms){var texture,textureUnit,offset;for(var j=0,jl=uniforms.length;j<jl;j++){var uniform=uniforms[j][0];if(uniform.needsUpdate===false)continue;var type=uniform.type;var value=uniform.value;var location=uniforms[j][1];switch(type){case"1i":_gl.uniform1i(location,value);break;case"1f":_gl.uniform1f(location,value);break;case"2f":_gl.uniform2f(location,value[0],value[1]);break;case"3f":_gl.uniform3f(location,value[0],value[1],value[2]);break;case"4f":_gl.uniform4f(location,value[0],value[1],value[2],value[3]);break;case"1iv":_gl.uniform1iv(location,value);break;case"3iv":_gl.uniform3iv(location,value);break;case"1fv":_gl.uniform1fv(location,value);break;case"2fv":_gl.uniform2fv(location,value);break;case"3fv":_gl.uniform3fv(location,value);break;case"4fv":_gl.uniform4fv(location,value);break;case"Matrix3fv":_gl.uniformMatrix3fv(location,false,value);break;case"Matrix4fv":_gl.uniformMatrix4fv(location,false,value);break;case"i":_gl.uniform1i(location,value);break;case"f":_gl.uniform1f(location,value);break;case"v2":_gl.uniform2f(location,value.x,value.y);break;case"v3":_gl.uniform3f(location,value.x,value.y,value.z);break;case"v4":_gl.uniform4f(location,value.x,value.y,value.z,value.w);break;case"c":_gl.uniform3f(location,value.r,value.g,value.b);break;case"iv1":_gl.uniform1iv(location,value);break;case"iv":_gl.uniform3iv(location,value);break;case"fv1":_gl.uniform1fv(location,value);break;case"fv":_gl.uniform3fv(location,value);break;case"v2v":if(uniform._array===undefined){uniform._array=new Float32Array(2*value.length)}for(var i=0,il=value.length;i<il;i++){offset=i*2;uniform._array[offset]=value[i].x;uniform._array[offset+1]=value[i].y}_gl.uniform2fv(location,uniform._array);break;case"v3v":if(uniform._array===undefined){uniform._array=new Float32Array(3*value.length)}for(var i=0,il=value.length;i<il;i++){offset=i*3;uniform._array[offset]=value[i].x;uniform._array[offset+1]=value[i].y;uniform._array[offset+2]=value[i].z}_gl.uniform3fv(location,uniform._array);break;case"v4v":if(uniform._array===undefined){uniform._array=new Float32Array(4*value.length)}for(var i=0,il=value.length;i<il;i++){offset=i*4;uniform._array[offset]=value[i].x;uniform._array[offset+1]=value[i].y;uniform._array[offset+2]=value[i].z;uniform._array[offset+3]=value[i].w}_gl.uniform4fv(location,uniform._array);break;case"m3":_gl.uniformMatrix3fv(location,false,value.elements);break;case"m3v":if(uniform._array===undefined){uniform._array=new Float32Array(9*value.length)}for(var i=0,il=value.length;i<il;i++){value[i].flattenToArrayOffset(uniform._array,i*9)}_gl.uniformMatrix3fv(location,false,uniform._array);break;case"m4":_gl.uniformMatrix4fv(location,false,value.elements);break;case"m4v":if(uniform._array===undefined){uniform._array=new Float32Array(16*value.length)}for(var i=0,il=value.length;i<il;i++){value[i].flattenToArrayOffset(uniform._array,i*16)}_gl.uniformMatrix4fv(location,false,uniform._array);break;case"t":texture=value;textureUnit=getTextureUnit();_gl.uniform1i(location,textureUnit);if(!texture)continue;if(!!(instance=texture)&&!!instance.isCubeTexture||toString.call(texture.image).slice(8,-1)==="Array"&&texture.image.length===6){setCubeTexture(texture,textureUnit)}else if(!!(instance=texture)&&!!instance.isWebGLRenderTargetCube){setCubeTextureDynamic(texture,textureUnit)}else{_this.setTexture(texture,textureUnit)}break;case"tv":if(uniform._array===undefined){uniform._array=[]}for(var i=0,il=uniform.value.length;i<il;i++){uniform._array[i]=getTextureUnit()}_gl.uniform1iv(location,uniform._array);for(var i=0,il=uniform.value.length;i<il;i++){texture=uniform.value[i];textureUnit=uniform._array[i];if(!texture)continue;_this.setTexture(texture,textureUnit)}break;default:Three.warn("THREE.WebGLRenderer: Unknown uniform type: "+type)}}}function setupMatrices(object,camera){object._modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse,object.matrixWorld);object._normalMatrix.getNormalMatrix(object._modelViewMatrix)}function setColorLinear(array,offset,color,intensity){array[offset]=color.r*intensity;array[offset+1]=color.g*intensity;array[offset+2]=color.b*intensity}function setupLights(lights){var l,ll,light,r=0,g=0,b=0,color,skyColor,groundColor,intensity,distance,zlights=_lights,dirColors=zlights.directional.colors,dirPositions=zlights.directional.positions,pointColors=zlights.point.colors,pointPositions=zlights.point.positions,pointDistances=zlights.point.distances,pointDecays=zlights.point.decays,spotColors=zlights.spot.colors,spotPositions=zlights.spot.positions,spotDistances=zlights.spot.distances,spotDirections=zlights.spot.directions,spotAnglesCos=zlights.spot.anglesCos,spotExponents=zlights.spot.exponents,spotDecays=zlights.spot.decays,hemiSkyColors=zlights.hemi.skyColors,hemiGroundColors=zlights.hemi.groundColors,hemiPositions=zlights.hemi.positions,dirLength=0,pointLength=0,spotLength=0,hemiLength=0,dirCount=0,pointCount=0,spotCount=0,hemiCount=0,dirOffset=0,pointOffset=0,spotOffset=0,hemiOffset=0;for(l=0,ll=lights.length;l<ll;l++){light=lights[l];if(light.onlyShadow)continue;color=light.color;intensity=light.intensity;distance=light.distance;if(!!(instance=light)&&!!instance.isAmbientLight){if(!light.visible)continue;r+=color.r;g+=color.g;b+=color.b}else if(!!(instance=light)&&!!instance.isDirectionalLight){dirCount+=1;if(!light.visible)continue;_direction.setFromMatrixPosition(light.matrixWorld);_vector3.setFromMatrixPosition(light.target.matrixWorld);_direction.sub(_vector3);_direction.normalize();dirOffset=dirLength*3;dirPositions[dirOffset]=_direction.x;dirPositions[dirOffset+1]=_direction.y;dirPositions[dirOffset+2]=_direction.z;setColorLinear(dirColors,dirOffset,color,intensity);dirLength+=1}else if(!!(instance=light)&&!!instance.isPointLight){pointCount+=1;if(!light.visible)continue;pointOffset=pointLength*3;setColorLinear(pointColors,pointOffset,color,intensity);_vector3.setFromMatrixPosition(light.matrixWorld);pointPositions[pointOffset]=_vector3.x;pointPositions[pointOffset+1]=_vector3.y;pointPositions[pointOffset+2]=_vector3.z;pointDistances[pointLength]=distance;pointDecays[pointLength]=light.distance===0?0:light.decay;pointLength+=1}else if(!!(instance=light)&&!!instance.isSpotLight){spotCount+=1;if(!light.visible)continue;spotOffset=spotLength*3;setColorLinear(spotColors,spotOffset,color,intensity);_direction.setFromMatrixPosition(light.matrixWorld);spotPositions[spotOffset]=_direction.x;spotPositions[spotOffset+1]=_direction.y;spotPositions[spotOffset+2]=_direction.z;spotDistances[spotLength]=distance;_vector3.setFromMatrixPosition(light.target.matrixWorld);_direction.sub(_vector3);_direction.normalize();spotDirections[spotOffset]=_direction.x;spotDirections[spotOffset+1]=_direction.y;spotDirections[spotOffset+2]=_direction.z;spotAnglesCos[spotLength]=Math.cos(light.angle);spotExponents[spotLength]=light.exponent;spotDecays[spotLength]=light.distance===0?0:light.decay;spotLength+=1}else if(!!(instance=light)&&!!instance.isHemisphereLight){hemiCount+=1;if(!light.visible)continue;_direction.setFromMatrixPosition(light.matrixWorld);_direction.normalize();hemiOffset=hemiLength*3;hemiPositions[hemiOffset]=_direction.x;hemiPositions[hemiOffset+1]=_direction.y;hemiPositions[hemiOffset+2]=_direction.z;skyColor=light.color;groundColor=light.groundColor;setColorLinear(hemiSkyColors,hemiOffset,skyColor,intensity);setColorLinear(hemiGroundColors,hemiOffset,groundColor,intensity);hemiLength+=1}}for(l=dirLength*3,ll=Math.max(dirColors.length,dirCount*3);l<ll;l++)dirColors[l]=0;for(l=pointLength*3,ll=Math.max(pointColors.length,pointCount*3);l<ll;l++)pointColors[l]=0;for(l=spotLength*3,ll=Math.max(spotColors.length,spotCount*3);l<ll;l++)spotColors[l]=0;for(l=hemiLength*3,ll=Math.max(hemiSkyColors.length,hemiCount*3);l<ll;l++)hemiSkyColors[l]=0;for(l=hemiLength*3,ll=Math.max(hemiGroundColors.length,hemiCount*3);l<ll;l++)hemiGroundColors[l]=0;zlights.directional.length=dirLength;zlights.point.length=pointLength;zlights.spot.length=spotLength;zlights.hemi.length=hemiLength;zlights.ambient[0]=r;zlights.ambient[1]=g;zlights.ambient[2]=b}this.setFaceCulling=function(cullFace,frontFaceDirection){if(cullFace===Three.CullFaceNone){_gl.disable(_gl.CULL_FACE)}else{if(frontFaceDirection===Three.FrontFaceDirectionCW){_gl.frontFace(_gl.CW)}else{_gl.frontFace(_gl.CCW)}if(cullFace===Three.CullFaceBack){_gl.cullFace(_gl.BACK)}else if(cullFace===Three.CullFaceFront){_gl.cullFace(_gl.FRONT)}else{_gl.cullFace(_gl.FRONT_AND_BACK)}_gl.enable(_gl.CULL_FACE)}};this.setMaterialFaces=function(material){state.setDoubleSided(material.side===Three.DoubleSide);state.setFlipSided(material.side===Three.BackSide)};function setTextureParameters(textureType,texture,isImagePowerOfTwo){var extension;if(isImagePowerOfTwo){_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_S,paramThreeToGL(texture.wrapS));_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_T,paramThreeToGL(texture.wrapT));_gl.texParameteri(textureType,_gl.TEXTURE_MAG_FILTER,paramThreeToGL(texture.magFilter));_gl.texParameteri(textureType,_gl.TEXTURE_MIN_FILTER,paramThreeToGL(texture.minFilter))}else{_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_S,_gl.CLAMP_TO_EDGE);_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_T,_gl.CLAMP_TO_EDGE);if(texture.wrapS!==Three.ClampToEdgeWrapping||texture.wrapT!==Three.ClampToEdgeWrapping){Three.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+texture.sourceFile+" )")}_gl.texParameteri(textureType,_gl.TEXTURE_MAG_FILTER,filterFallback(texture.magFilter));_gl.texParameteri(textureType,_gl.TEXTURE_MIN_FILTER,filterFallback(texture.minFilter));if(texture.minFilter!==Three.NearestFilter&&texture.minFilter!==Three.LinearFilter){Three.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+texture.sourceFile+" )")}}extension=extensions.get("EXT_texture_filter_anisotropic");if(extension&&texture.type!==Three.FloatType&&texture.type!==Three.HalfFloatType){if(texture.anisotropy>1||texture.__currentAnisotropy){_gl.texParameterf(textureType,extension.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(texture.anisotropy,_this.getMaxAnisotropy()));texture.__currentAnisotropy=texture.anisotropy}}}this.uploadTexture=function(texture){if(texture.__webglInit===undefined){texture.__webglInit=true;texture.addEventListener("dispose",onTextureDispose);texture.__webglTexture=_gl.createTexture();_this.info.memory.textures++}_gl.bindTexture(_gl.TEXTURE_2D,texture.__webglTexture);_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY);_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,texture.premultiplyAlpha);_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,texture.unpackAlignment);texture.image=clampToMaxSize(texture.image,_maxTextureSize);var image=texture.image,isImagePowerOfTwo=MathModule.Math.isPowerOfTwo(image.width)&&MathModule.Math.isPowerOfTwo(image.height),glFormat=paramThreeToGL(texture.format),glType=paramThreeToGL(texture.type);setTextureParameters(_gl.TEXTURE_2D,texture,isImagePowerOfTwo);var mipmap,mipmaps=texture.mipmaps;if(!!(instance=texture)&&!!instance.isDataTexture){if(mipmaps.length>0&&isImagePowerOfTwo){for(var i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];_gl.texImage2D(_gl.TEXTURE_2D,i,glFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data)}texture.generateMipmaps=false}else{_gl.texImage2D(_gl.TEXTURE_2D,0,glFormat,image.width,image.height,0,glFormat,glType,image.data)}}else if(!!(instance=texture)&&!!instance.isCompressedTexture){for(var i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];if(texture.format!==Three.RGBAFormat&&texture.format!==Three.RGBFormat){if(getCompressedTextureFormats().indexOf(glFormat)>-1){_gl.compressedTexImage2D(_gl.TEXTURE_2D,i,glFormat,mipmap.width,mipmap.height,0,mipmap.data)}else{Three.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()")}}else{_gl.texImage2D(_gl.TEXTURE_2D,i,glFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data)}}}else{if(mipmaps.length>0&&isImagePowerOfTwo){for(var i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];_gl.texImage2D(_gl.TEXTURE_2D,i,glFormat,glFormat,glType,mipmap)}texture.generateMipmaps=false}else{_gl.texImage2D(_gl.TEXTURE_2D,0,glFormat,glFormat,glType,texture.image)}}if(texture.generateMipmaps&&isImagePowerOfTwo)_gl.generateMipmap(_gl.TEXTURE_2D);texture.needsUpdate=false;if(texture.onUpdate)texture.onUpdate()};this.setTexture=function(texture,slot){_gl.activeTexture(_gl.TEXTURE0+slot);if(texture.needsUpdate){_this.uploadTexture(texture)}else{_gl.bindTexture(_gl.TEXTURE_2D,texture.__webglTexture)}};function clampToMaxSize(image,maxSize){if(image.width>maxSize||image.height>maxSize){var scale=maxSize/Math.max(image.width,image.height);var canvas=document.createElement("canvas");canvas.width=Math.floor(image.width*scale);canvas.height=Math.floor(image.height*scale);var context=canvas.getContext("2d");context.drawImage(image,0,0,image.width,image.height,0,0,canvas.width,canvas.height);Three.warn("THREE.WebGLRenderer: image is too big ("+image.width+"x"+image.height+"). Resized to "+canvas.width+"x"+canvas.height,image);return canvas}return image}function setCubeTexture(texture,slot){if(texture.image.length===6){if(texture.needsUpdate){if(!texture.image.__webglTextureCube){texture.addEventListener("dispose",onTextureDispose);texture.image.__webglTextureCube=_gl.createTexture();_this.info.memory.textures++}_gl.activeTexture(_gl.TEXTURE0+slot);_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,texture.image.__webglTextureCube);_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY);var isCompressed=!!(instance=texture)&&!!instance.isCompressedTexture;var isDataTexture=!!(instance=texture.image[0])&&!!instance.isDataTexture;var cubeImage=[];for(var i=0;i<6;i++){if(_this.autoScaleCubemaps&&!isCompressed&&!isDataTexture){cubeImage[i]=clampToMaxSize(texture.image[i],_maxCubemapSize)}else{cubeImage[i]=isDataTexture?texture.image[i].image:texture.image[i]}}var image=cubeImage[0],isImagePowerOfTwo=MathModule.Math.isPowerOfTwo(image.width)&&MathModule.Math.isPowerOfTwo(image.height),glFormat=paramThreeToGL(texture.format),glType=paramThreeToGL(texture.type);setTextureParameters(_gl.TEXTURE_CUBE_MAP,texture,isImagePowerOfTwo);for(var i=0;i<6;i++){if(!isCompressed){if(isDataTexture){_gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,glFormat,cubeImage[i].width,cubeImage[i].height,0,glFormat,glType,cubeImage[i].data)}else{_gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,glFormat,glFormat,glType,cubeImage[i])}}else{var mipmap,mipmaps=cubeImage[i].mipmaps;for(var j=0,jl=mipmaps.length;j<jl;j++){mipmap=mipmaps[j];if(texture.format!==Three.RGBAFormat&&texture.format!==Three.RGBFormat){if(getCompressedTextureFormats().indexOf(glFormat)>-1){_gl.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,glFormat,mipmap.width,mipmap.height,0,mipmap.data)}else{Three.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()")}}else{_gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,glFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data)}}}}if(texture.generateMipmaps&&isImagePowerOfTwo){_gl.generateMipmap(_gl.TEXTURE_CUBE_MAP)}texture.needsUpdate=false;if(texture.onUpdate)texture.onUpdate()}else{_gl.activeTexture(_gl.TEXTURE0+slot);_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,texture.image.__webglTextureCube)}}}function setCubeTextureDynamic(texture,slot){_gl.activeTexture(_gl.TEXTURE0+slot);_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,texture.__webglTexture)}function setupFrameBuffer(framebuffer,renderTarget,textureTarget){_gl.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0,textureTarget,renderTarget.__webglTexture,0)}function setupRenderBuffer(renderbuffer,renderTarget){_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer);if(renderTarget.depthBuffer&&!renderTarget.stencilBuffer){_gl.renderbufferStorage(_gl.RENDERBUFFER,_gl.DEPTH_COMPONENT16,renderTarget.width,renderTarget.height);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.RENDERBUFFER,renderbuffer)}else if(renderTarget.depthBuffer&&renderTarget.stencilBuffer){_gl.renderbufferStorage(_gl.RENDERBUFFER,_gl.DEPTH_STENCIL,renderTarget.width,renderTarget.height);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT,_gl.RENDERBUFFER,renderbuffer)}else{_gl.renderbufferStorage(_gl.RENDERBUFFER,_gl.RGBA4,renderTarget.width,renderTarget.height)}}this.setRenderTarget=function(renderTarget){var isCube=!!(instance=renderTarget)&&!!instance.isWebGLRenderTargetCube;if(renderTarget&&renderTarget.__webglFramebuffer===undefined){if(renderTarget.depthBuffer===undefined)renderTarget.depthBuffer=true;if(renderTarget.stencilBuffer===undefined)renderTarget.stencilBuffer=true;renderTarget.addEventListener("dispose",onRenderTargetDispose);renderTarget.__webglTexture=_gl.createTexture();_this.info.memory.textures++;var isTargetPowerOfTwo=MathModule.Math.isPowerOfTwo(renderTarget.width)&&MathModule.Math.isPowerOfTwo(renderTarget.height),glFormat=paramThreeToGL(renderTarget.format),glType=paramThreeToGL(renderTarget.type);if(isCube){renderTarget.__webglFramebuffer=[];renderTarget.__webglRenderbuffer=[];_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,renderTarget.__webglTexture);setTextureParameters(_gl.TEXTURE_CUBE_MAP,renderTarget,isTargetPowerOfTwo);for(var i=0;i<6;i++){renderTarget.__webglFramebuffer[i]=_gl.createFramebuffer();renderTarget.__webglRenderbuffer[i]=_gl.createRenderbuffer();_gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,glFormat,renderTarget.width,renderTarget.height,0,glFormat,glType,null);setupFrameBuffer(renderTarget.__webglFramebuffer[i],renderTarget,_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i);setupRenderBuffer(renderTarget.__webglRenderbuffer[i],renderTarget)}if(isTargetPowerOfTwo)_gl.generateMipmap(_gl.TEXTURE_CUBE_MAP)}else{renderTarget.__webglFramebuffer=_gl.createFramebuffer();if(renderTarget.shareDepthFrom){renderTarget.__webglRenderbuffer=renderTarget.shareDepthFrom.__webglRenderbuffer}else{renderTarget.__webglRenderbuffer=_gl.createRenderbuffer()}_gl.bindTexture(_gl.TEXTURE_2D,renderTarget.__webglTexture);setTextureParameters(_gl.TEXTURE_2D,renderTarget,isTargetPowerOfTwo);_gl.texImage2D(_gl.TEXTURE_2D,0,glFormat,renderTarget.width,renderTarget.height,0,glFormat,glType,null);setupFrameBuffer(renderTarget.__webglFramebuffer,renderTarget,_gl.TEXTURE_2D);if(renderTarget.shareDepthFrom){if(renderTarget.depthBuffer&&!renderTarget.stencilBuffer){_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.RENDERBUFFER,renderTarget.__webglRenderbuffer)}else if(renderTarget.depthBuffer&&renderTarget.stencilBuffer){_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT,_gl.RENDERBUFFER,renderTarget.__webglRenderbuffer)}}else{setupRenderBuffer(renderTarget.__webglRenderbuffer,renderTarget)}if(isTargetPowerOfTwo)_gl.generateMipmap(_gl.TEXTURE_2D)}if(isCube){_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,null)}else{_gl.bindTexture(_gl.TEXTURE_2D,null)}_gl.bindRenderbuffer(_gl.RENDERBUFFER,null);_gl.bindFramebuffer(_gl.FRAMEBUFFER,null)}var framebuffer,width,height,vx,vy;if(renderTarget){if(isCube){framebuffer=renderTarget.__webglFramebuffer[renderTarget.activeCubeFace]}else{framebuffer=renderTarget.__webglFramebuffer}width=renderTarget.width;height=renderTarget.height;vx=0;vy=0}else{framebuffer=null;width=_viewportWidth;height=_viewportHeight;vx=_viewportX;vy=_viewportY}if(framebuffer!==_currentFramebuffer){_gl.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);_gl.viewport(vx,vy,width,height);_currentFramebuffer=framebuffer}_currentWidth=width;_currentHeight=height};this.readRenderTargetPixels=function(renderTarget,x,y,width,height,buffer){if(!(!!(instance=renderTarget)&&!!instance.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}if(renderTarget.__webglFramebuffer){if(renderTarget.format!==Three.RGBAFormat){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");return}var restore=false;if(renderTarget.__webglFramebuffer!==_currentFramebuffer){_gl.bindFramebuffer(_gl.FRAMEBUFFER,renderTarget.__webglFramebuffer);restore=true}if(_gl.checkFramebufferStatus(_gl.FRAMEBUFFER)===_gl.FRAMEBUFFER_COMPLETE){_gl.readPixels(x,y,width,height,_gl.RGBA,_gl.UNSIGNED_BYTE,buffer)}else{console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}if(restore){_gl.bindFramebuffer(_gl.FRAMEBUFFER,_currentFramebuffer)}}};function updateRenderTargetMipmap(renderTarget){if(!!(instance=renderTarget)&&!!instance.isWebGLRenderTargetCube){_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,renderTarget.__webglTexture);_gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);_gl.bindTexture(_gl.TEXTURE_CUBE_MAP,null)}else{_gl.bindTexture(_gl.TEXTURE_2D,renderTarget.__webglTexture);_gl.generateMipmap(_gl.TEXTURE_2D);_gl.bindTexture(_gl.TEXTURE_2D,null)}}function filterFallback(f){if(f===Three.NearestFilter||f===Three.NearestMipMapNearestFilter||f===Three.NearestMipMapLinearFilter){return _gl.NEAREST}return _gl.LINEAR}function paramThreeToGL(p){var extension;if(p===Three.RepeatWrapping)return _gl.REPEAT;if(p===Three.ClampToEdgeWrapping)return _gl.CLAMP_TO_EDGE;if(p===Three.MirroredRepeatWrapping)return _gl.MIRRORED_REPEAT;if(p===Three.NearestFilter)return _gl.NEAREST;if(p===Three.NearestMipMapNearestFilter)return _gl.NEAREST_MIPMAP_NEAREST;if(p===Three.NearestMipMapLinearFilter)return _gl.NEAREST_MIPMAP_LINEAR;if(p===Three.LinearFilter)return _gl.LINEAR;if(p===Three.LinearMipMapNearestFilter)return _gl.LINEAR_MIPMAP_NEAREST;if(p===Three.LinearMipMapLinearFilter)return _gl.LINEAR_MIPMAP_LINEAR;if(p===Three.UnsignedByteType)return _gl.UNSIGNED_BYTE;if(p===Three.UnsignedShort4444Type)return _gl.UNSIGNED_SHORT_4_4_4_4;if(p===Three.UnsignedShort5551Type)return _gl.UNSIGNED_SHORT_5_5_5_1;if(p===Three.UnsignedShort565Type)return _gl.UNSIGNED_SHORT_5_6_5;if(p===Three.ByteType)return _gl.BYTE;if(p===Three.ShortType)return _gl.SHORT;if(p===Three.UnsignedShortType)return _gl.UNSIGNED_SHORT;if(p===Three.IntType)return _gl.INT;if(p===Three.UnsignedIntType)return _gl.UNSIGNED_INT;if(p===Three.FloatType)return _gl.FLOAT;extension=extensions.get("OES_texture_half_float");if(extension!==null){if(p===Three.HalfFloatType)return extension.HALF_FLOAT_OES}if(p===Three.AlphaFormat)return _gl.ALPHA;if(p===Three.RGBFormat)return _gl.RGB;if(p===Three.RGBAFormat)return _gl.RGBA;if(p===Three.LuminanceFormat)return _gl.LUMINANCE;if(p===Three.LuminanceAlphaFormat)return _gl.LUMINANCE_ALPHA;if(p===Three.AddEquation)return _gl.FUNC_ADD;if(p===Three.SubtractEquation)return _gl.FUNC_SUBTRACT;if(p===Three.ReverseSubtractEquation)return _gl.FUNC_REVERSE_SUBTRACT;if(p===Three.ZeroFactor)return _gl.ZERO;if(p===Three.OneFactor)return _gl.ONE;if(p===Three.SrcColorFactor)return _gl.SRC_COLOR;if(p===Three.OneMinusSrcColorFactor)return _gl.ONE_MINUS_SRC_COLOR;if(p===Three.SrcAlphaFactor)return _gl.SRC_ALPHA;if(p===Three.OneMinusSrcAlphaFactor)return _gl.ONE_MINUS_SRC_ALPHA;if(p===Three.DstAlphaFactor)return _gl.DST_ALPHA;if(p===Three.OneMinusDstAlphaFactor)return _gl.ONE_MINUS_DST_ALPHA;if(p===Three.DstColorFactor)return _gl.DST_COLOR;if(p===Three.OneMinusDstColorFactor)return _gl.ONE_MINUS_DST_COLOR;if(p===Three.SrcAlphaSaturateFactor)return _gl.SRC_ALPHA_SATURATE;extension=extensions.get("WEBGL_compressed_texture_s3tc");if(extension!==null){if(p===Three.RGB_S3TC_DXT1_Format)return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;if(p===Three.RGBA_S3TC_DXT1_Format)return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p===Three.RGBA_S3TC_DXT3_Format)return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p===Three.RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT}extension=extensions.get("WEBGL_compressed_texture_pvrtc");if(extension!==null){if(p===Three.RGB_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(p===Three.RGB_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(p===Three.RGBA_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(p===Three.RGBA_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}extension=extensions.get("EXT_blend_minmax");if(extension!==null){if(p===Three.MinEquation)return extension.MIN_EXT;if(p===Three.MaxEquation)return extension.MAX_EXT}return 0}function allocateBones(object){if(_supportsBoneTextures&&object&&object.skeleton&&object.skeleton.useVertexTexture){return 1024}else{var nVertexUniforms=_gl.getParameter(_gl.MAX_VERTEX_UNIFORM_VECTORS);var nVertexMatrices=Math.floor((nVertexUniforms-20)/4);var maxBones=nVertexMatrices;if(object!==undefined&&(!!(instance=object)&&!!instance.isSkinnedMesh)){maxBones=Math.min(object.skeleton.bones.length,maxBones);if(maxBones<object.skeleton.bones.length){Three.warn("WebGLRenderer: too many bones - "+object.skeleton.bones.length+", this GPU supports just "+maxBones+" (try OpenGL instead of ANGLE)")}}return maxBones}}function allocateLights(lights){var dirLights=0;var pointLights=0;var spotLights=0;var hemiLights=0;for(var l=0,ll=lights.length;l<ll;l++){var light=lights[l];if(light.onlyShadow||light.visible===false)continue;if(!!(instance=light)&&!!instance.isDirectionalLight)dirLights++;if(!!(instance=light)&&!!instance.isPointLight)pointLights++;if(!!(instance=light)&&!!instance.isSpotLight)spotLights++;if(!!(instance=light)&&!!instance.isHemisphereLight)hemiLights++}return{directional:dirLights,point:pointLights,spot:spotLights,hemi:hemiLights}}function allocateShadows(lights){
var maxShadows=0;for(var l=0,ll=lights.length;l<ll;l++){var light=lights[l];if(!light.castShadow)continue;if(!!(instance=light)&&!!instance.isSpotLight)maxShadows++;if(!!(instance=light)&&!!instance.isDirectionalLight&&!light.shadowCascade)maxShadows++}return maxShadows}this.initMaterial=function(){Three.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){Three.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){Three.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){Three.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}};WebGLRenderer.prototype.isWebGLRenderer=true;exports.WebGLRenderer=WebGLRenderer},{"../Three":1,"../math/Color":17,"../math/Frustum":19,"../math/Math":20,"../math/Matrix3":21,"../math/Matrix4":22,"../math/Vector3":28,"./shaders/ShaderLib":33,"./shaders/UniformsUtils":35,"./webgl/WebGLExtensions":36,"./webgl/WebGLProgram":37,"./webgl/WebGLState":39,"./webgl/plugins/LensFlarePlugin":40,"./webgl/plugins/ShadowMapPlugin":41,"./webgl/plugins/SpritePlugin":42}]},{},[]);var Scene=require("three.cjs/scenes/Scene").Scene;var PerspectiveCamera=require("three.cjs/cameras/PerspectiveCamera").PerspectiveCamera;var BoxGeometry=require("three.cjs/extras/geometries/BoxGeometry").BoxGeometry;var MeshBasicMaterial=require("three.cjs/materials/MeshBasicMaterial").MeshBasicMaterial;var Mesh=require("three.cjs/objects/Mesh").Mesh;var WebGLRenderer=require("three.cjs/renderers/WebGLRenderer").WebGLRenderer;var scene,camera,renderer;var geometry,material,mesh;init();animate();function init(){scene=new Scene;camera=new PerspectiveCamera(75,window.innerWidth/window.innerHeight,1,1e4);camera.position.z=1e3;geometry=new BoxGeometry(200,200,200);material=new MeshBasicMaterial({color:"red",wireframe:true});mesh=new Mesh(geometry,material);scene.add(mesh);renderer=new WebGLRenderer({antialias:true,alpha:true});renderer.setSize(window.innerWidth,window.innerHeight);document.body.appendChild(renderer.domElement)}function animate(){requestAnimationFrame(animate);mesh.rotation.x+=.01;mesh.rotation.y+=.02;renderer.render(scene,camera)}
{
"name": "three.cjs example",
"version": "1.0.0",
"dependencies": {
"three.cjs": "0.71.0"
}
}
<!-- contents of this file will be placed inside the <body> -->
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment