浏览代码

Refactored texture updating, added texture filtering example and fixed scene loader and example.

alteredq 14 年之前
父节点
当前提交
2c996815be

文件差异内容过多而无法显示
+ 188 - 189
build/Three.js


+ 1 - 1
build/custom/ThreeCanvas.js

@@ -47,7 +47,7 @@ this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extract
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,p=h*d+j*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+p*-j-n*-g;b.y=p*h+c*-g+n*-f-i*-j;b.z=n*h+c*-j+i*-g-p*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -47,7 +47,7 @@ this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extract
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};

+ 4 - 4
build/custom/ThreeExtras.js

@@ -5,9 +5,9 @@ d);d=h.loadCount=0;for(f=a.length;d<f;++d){h[d]=new Image;h[d].onload=function()
 z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=u.visible;G.scene.addObject(object);G.objects[k]=object}}}function e(N){return function(M){G.geometries[N]=M;c();F-=1;g()}}function g(){f({total_models:K,total_textures:O,loaded_models:K-F,loaded_textures:O-J},G);F==0&&J==0&&b(G)}var j,m,k,v,q,n,p,u,z,w,x,l,D,A,I,C,E,F,J,K,O,G;C=h.data;E=new THREE.Loader;J=F=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
 fogs:{}};h=function(){J-=1;g()};for(q in C.cameras){w=C.cameras[q];if(w.type=="perspective")D=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){D=new THREE.Camera;D.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}z=w.position;w=w.target;D.position.set(z[0],z[1],z[2]);D.target.position.set(w[0],w[1],w[2]);G.cameras[q]=D}for(v in C.lights){q=C.lights[v];if(q.type=="directional"){z=q.direction;light=new THREE.DirectionalLight;light.position.set(z[0],
 z[1],z[2]);light.position.normalize()}else if(q.type=="point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}w=q.color;i=q.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);G.scene.addLight(light);G.lights[v]=light}for(n in C.fogs){v=C.fogs[n];if(v.type=="linear")A=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(A=new THREE.FogExp2(0,v.density));w=v.color;A.color.setRGB(w[0],w[1],w[2]);G.fogs[n]=A}if(G.cameras&&C.defaults.camera)G.currentCamera=G.cameras[C.defaults.camera];
-if(G.fogs&&C.defaults.fog)G.scene.fog=G.fogs[C.defaults.fog];w=C.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(w[0],w[1],w[2]);G.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries){n=C.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")F+=1}K=F;for(j in C.geometries){n=C.geometries[j];if(n.type=="cube"){l=new Cube(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,null,n.flipped,n.sides);G.geometries[j]=l}else if(n.type=="plane"){l=new Plane(n.width,n.height,n.segmentsWidth,
-n.segmentsHeight);G.geometries[j]=l}else if(n.type=="sphere"){l=new Sphere(n.radius,n.segmentsWidth,n.segmentsHeight);G.geometries[j]=l}else if(n.type=="cylinder"){l=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);G.geometries[j]=l}else if(n.type=="torus"){l=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);G.geometries[j]=l}else if(n.type=="icosahedron"){l=new Icosahedron(n.subdivisions);G.geometries[j]=l}else if(n.type=="bin_mesh")E.loadBinary({model:n.url,callback:e(j)});
-else n.type=="ascii_mesh"&&E.loadAscii({model:n.url,callback:e(j)})}for(p in C.textures){j=C.textures[p];J+=j.url instanceof Array?j.url.length:1}O=J;for(p in C.textures){j=C.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)n=ImageUtils.loadTextureCube(j.url,j.mapping,h);else{n=ImageUtils.loadTexture(j.url,j.mapping,h);if(THREE[j.minFilter]!=undefined)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)n.magFilter=
+if(G.fogs&&C.defaults.fog)G.scene.fog=G.fogs[C.defaults.fog];w=C.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(w[0],w[1],w[2]);G.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries){n=C.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")F+=1}K=F;for(j in C.geometries){n=C.geometries[j];if(n.type=="cube"){l=new Cube(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);G.geometries[j]=l}else if(n.type=="plane"){l=new Plane(n.width,
+n.height,n.segmentsWidth,n.segmentsHeight);G.geometries[j]=l}else if(n.type=="sphere"){l=new Sphere(n.radius,n.segmentsWidth,n.segmentsHeight);G.geometries[j]=l}else if(n.type=="cylinder"){l=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);G.geometries[j]=l}else if(n.type=="torus"){l=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);G.geometries[j]=l}else if(n.type=="icosahedron"){l=new Icosahedron(n.subdivisions);G.geometries[j]=l}else if(n.type=="bin_mesh")E.loadBinary({model:n.url,
+callback:e(j)});else n.type=="ascii_mesh"&&E.loadAscii({model:n.url,callback:e(j)})}for(p in C.textures){j=C.textures[p];J+=j.url instanceof Array?j.url.length:1}O=J;for(p in C.textures){j=C.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)n=ImageUtils.loadTextureCube(j.url,j.mapping,h);else{n=ImageUtils.loadTexture(j.url,j.mapping,h);if(THREE[j.minFilter]!=undefined)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)n.magFilter=
 THREE[j.magFilter]}G.textures[p]=n}for(m in C.materials){p=C.materials[m];for(x in p.parameters)if(x=="envMap"||x=="map"||x=="lightMap")p.parameters[x]=G.textures[p.parameters[x]];else if(x=="shading")p.parameters[x]=p.parameters[x]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(x=="blending")p.parameters[x]=THREE[p.parameters[x]]?THREE[p.parameters[x]]:THREE.NormalBlending;else x=="combine"&&(p.parameters[x]=p.parameters[x]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);p=new THREE[p.type](p.parameters);
 G.materials[m]=p}c();d(G)}},addMesh:function(a,d,b,f,h,c,e,g,j,m){d=new THREE.Mesh(d,m);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=f;d.position.y=h;d.position.z=c;d.rotation.x=e;d.rotation.y=g;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,1,null,!0),b);a.addObject(d);
 return d},addPanoramaCube:function(a,d,b){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,f,!0),new THREE.MeshFaceMaterial);
@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
 var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),m=f(c.faces[g].b,c.faces[g].c),k=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,k,e);b(c.faces[g].b,m,j,e);b(c.faces[g].c,
 k,m,e);b(j,m,k,e)}c.faces=e.faces}h.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
+function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
 c[g]=this.vertices.length-1}else c=e;m==0&&(e=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(m/b,g/a.length),new THREE.UV(m/b,(g+1)/a.length),new THREE.UV((m-d)/b,(g+1)/a.length),new THREE.UV((m-d)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -47,7 +47,7 @@ this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extract
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 141 - 142
build/custom/ThreeWebGL.js

@@ -1,71 +1,71 @@
 // ThreeWebGL.js r34 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,h,l,m,q,n;if(d==0)e=h=l=0;else{m=Math.floor(a*6);q=a*6-m;a=d*(1-c);n=d*(1-c*q);c=d*(1-c*(1-q));switch(m){case 1:e=n;h=d;l=a;break;case 2:e=a;h=d;l=c;break;case 3:e=a;h=n;l=d;break;case 4:e=c;h=a;l=d;break;case 5:e=d;h=a;l=n;break;case 6:case 0:e=d;h=c;l=a}}this.r=e;this.g=h;this.b=l;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var f,h,k,l,q,n;if(d==0)f=h=k=0;else{l=Math.floor(a*6);q=a*6-l;a=d*(1-b);n=d*(1-b*q);b=d*(1-b*(1-q));switch(l){case 1:f=n;h=d;k=a;break;case 2:f=a;h=d;k=b;break;case 3:f=a;h=n;k=d;break;case 4:f=b;h=a;k=d;break;case 5:f=d;h=a;k=n;break;case 6:case 0:f=d;h=b;k=a}}this.r=f;this.g=h;this.b=k;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
-THREE.Vector2=function(a,c){this.set(a||0,c||0)};
-THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
-this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,d||0)};
-THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
-a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,d,e){this.set(a||0,c||0,d||0,e||1)};
-THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
-a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a<c;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(l,m){return l.distance-m.distance});return h},intersectObject:function(a){function c(L,M,Z,X){X=X.clone().subSelf(M);Z=Z.clone().subSelf(M);var O=L.clone().subSelf(M);L=X.dot(X);M=X.dot(Z);X=X.dot(O);var W=Z.dot(Z);Z=Z.dot(O);O=1/(L*W-M*M);W=(W*X-M*Z)*O;L=(L*Z-M*X)*O;return W>0&&L>0&&W+L<1}var d,e,h,l,m,q,n,w,A,y,
-D,E=a.geometry,F=E.vertices,H=[];d=0;for(e=E.faces.length;d<e;d++){h=E.faces[d];y=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;l=n.multiplyVector3(F[h.a].position.clone());m=n.multiplyVector3(F[h.b].position.clone());q=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(h.normal.clone());A=D.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(l,y))/A;y=y.addSelf(D.multiplyScalar(w));
-if(h instanceof THREE.Face3){if(c(y,l,m,q)){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}else if(h instanceof THREE.Face4&&(c(y,l,m,n)||c(y,m,q,n))){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}}return H}};
-THREE.Rectangle=function(){function a(){l=e-c;m=h-d}var c,d,e,h,l,m,q=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(n,w,A,y){q=!1;c=n;d=w;e=A;h=y;a()};this.addPoint=function(n,w){if(q){q=!1;c=n;d=w;e=n;h=w}else{c=c<n?c:n;d=d<w?d:w;e=e>n?e:n;h=h>w?h:w}a()};
-this.add3Points=function(n,w,A,y,D,E){if(q){q=!1;c=n<A?n<D?n:D:A<D?A:D;d=w<y?w<E?w:E:y<E?y:E;e=n>A?n>D?n:D:A>D?A:D;h=w>y?w>E?w:E:y>E?y:E}else{c=n<A?n<D?n<c?n:c:D<c?D:c:A<D?A<c?A:c:D<c?D:c;d=w<y?w<E?w<d?w:d:E<d?E:d:y<E?y<d?y:d:E<d?E:d;e=n>A?n>D?n>e?n:e:D>e?D:e:A>D?A>e?A:e:D>e?D:e;h=w>y?w>E?w>h?w:h:E>h?E:h:y>E?y>h?y:h:E>h?E:h}a()};this.addRectangle=function(n){if(q){q=!1;c=n.getLeft();d=n.getTop();e=n.getRight();h=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
-e:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){c-=n;d-=n;e+=n;h+=n;a()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();h=h<n.getBottom()?h:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){q=!0;h=e=d=c=0;a()};this.isEmpty=function(){return q}};
-THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.set(a||1,c||0,d||0,e||0,h||0,l||1,m||0,q||0,n||0,w||0,A||1,y||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=l;this.n23=m;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__v1,
-h=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,c).normalize();e.cross(d,l).normalize();h.cross(l,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=l.x;this.n21=e.y;this.n22=h.y;this.n23=l.y;this.n31=e.z;this.n32=h.z;this.n33=l.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return a},
-multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+
-this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,Z=c.n11,X=c.n12,O=c.n13,W=c.n14,b=c.n21,ka=c.n22,oa=c.n23,la=c.n24,ma=c.n31,ra=c.n32,pa=c.n33,qa=c.n34;this.n11=d*Z+e*b+h*ma;this.n12=d*X+e*ka+h*ra;this.n13=
-d*O+e*oa+h*pa;this.n14=d*W+e*la+h*qa+l;this.n21=m*Z+q*b+n*ma;this.n22=m*X+q*ka+n*ra;this.n23=m*O+q*oa+n*pa;this.n24=m*W+q*la+n*qa+w;this.n31=A*Z+y*b+D*ma;this.n32=A*X+y*ka+D*ra;this.n33=A*O+y*oa+D*pa;this.n34=A*W+y*la+D*qa+E;this.n41=F*Z+H*b+L*ma;this.n42=F*X+H*ka+L*ra;this.n43=F*O+H*oa+L*pa;this.n44=F*W+H*la+L*qa+M;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;
-d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,l=this.n22,
-m=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*m*w*D-d*q*w*D-e*l*A*D+c*q*A*D+d*l*y*D-c*m*y*D-e*m*n*E+d*q*n*E+e*h*A*E-a*q*A*E-d*h*y*E+a*m*y*E+e*l*n*F-c*q*n*F-e*h*w*F+a*q*w*F+c*h*y*F-a*l*y*F-d*l*n*H+c*m*n*H+d*h*w*H-a*m*w*H-c*h*A*H+a*l*A*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;
-this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;
-this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;
-a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=
-Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,l=a.x,m=a.y,q=a.z,n=h*l,w=h*m;this.set(n*l+d,n*m-e*q,n*q+e*m,0,n*m+e*q,w*m+d,w*q-e*l,0,n*q-e*m,w*q+e*l,h*q*q+d,0,0,0,0,1);return this},
-setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,q=c*d;this.n11=h*l;this.n12=-h*e;this.n13=d;this.n21=q*l+a*e;this.n22=-q*e+a*l;this.n23=-c*h;this.n31=-m*l+c*e;this.n32=m*e+c*l;this.n33=a*h;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,e=a.z,h=a.w,l=c+c,m=d+d,q=e+e;a=c*l;var n=c*m;c*=q;var w=d*m;
-d*=q;e*=q;l*=h;m*=h;h*=q;this.n11=1-(w+e);this.n12=n-h;this.n13=c+m;this.n21=n+h;this.n22=1-(a+e);this.n23=d-l;this.n31=c-m;this.n32=d+l;this.n33=1-(a+w);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=
-a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
-THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*E*H-w*D*H+w*y*L-q*E*L-n*y*M+q*D*M;c.n12=l*D*H-h*E*H-l*y*L+e*E*L+h*y*M-e*D*M;c.n13=h*w*H-l*n*H+l*q*L-e*w*L-h*q*M+e*n*M;c.n14=l*n*y-h*w*y-l*q*D+e*w*D+h*q*E-e*n*E;c.n21=w*D*F-n*E*F-w*A*L+m*E*L+n*A*M-m*D*M;c.n22=h*E*F-l*D*F+l*A*L-d*E*L-h*A*M+d*D*M;c.n23=l*n*F-h*w*F-l*m*L+d*w*L+h*m*M-d*n*M;
-c.n24=h*w*A-l*n*A+l*m*D-d*w*D-h*m*E+d*n*E;c.n31=q*E*F-w*y*F+w*A*H-m*E*H-q*A*M+m*y*M;c.n32=l*y*F-e*E*F-l*A*H+d*E*H+e*A*M-d*y*M;c.n33=h*w*F-l*q*F+l*m*H-d*w*H-e*m*M+d*q*M;c.n34=l*q*A-e*w*A-l*m*y+d*w*y+e*m*E-d*q*E;c.n41=n*y*F-q*D*F-n*A*H+m*D*H+q*A*L-m*y*L;c.n42=e*D*F-h*y*F+h*A*H-d*D*H-e*A*L+d*y*L;c.n43=h*q*F-e*n*F-h*m*H+d*n*H+e*m*L-d*q*L;c.n44=e*n*A-h*q*A+h*m*y-d*n*y-e*m*D+d*q*D;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*l;d[3]=a*m;d[4]=a*q;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*y;return c};
-THREE.Matrix4.makeFrustum=function(a,c,d,e,h,l){var m;m=new THREE.Matrix4;m.n11=2*h/(c-a);m.n12=0;m.n13=(c+a)/(c-a);m.n14=0;m.n21=0;m.n22=2*h/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+h)/(l-h);m.n34=-2*l*h/(l-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,c,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,c,d,e,h,l){var m,q,n,w;m=new THREE.Matrix4;q=c-a;n=d-e;w=l-h;m.n11=2/q;m.n12=0;m.n13=0;m.n14=-((c+a)/q);m.n21=0;m.n22=2/n;m.n23=0;m.n24=-((d+e)/n);m.n31=0;m.n32=0;m.n33=-2/w;m.n34=-((l+h)/w);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Vector2=function(a,b){this.set(a||0,b||0)};
+THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
+this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,d||0)};
+THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,f=this.z;this.set(d*a.z-f*a.y,f*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
+this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,f){this.set(a||0,b||0,d||0,f||1)};
+THREE.Vector4.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var b,d,f=a.objects,h=[];a=0;for(b=f.length;a<b;a++){d=f[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(k,l){return k.distance-l.distance});return h},intersectObject:function(a){function b(L,M,V,X){X=X.clone().subSelf(M);V=V.clone().subSelf(M);var ca=L.clone().subSelf(M);L=X.dot(X);M=X.dot(V);X=X.dot(ca);var aa=V.dot(V);V=V.dot(ca);ca=1/(L*aa-M*M);aa=(aa*X-M*V)*ca;L=(L*V-M*X)*ca;return aa>0&&L>0&&aa+L<1}var d,f,h,k,
+l,q,n,w,A,y,D,E=a.geometry,F=E.vertices,H=[];d=0;for(f=E.faces.length;d<f;d++){h=E.faces[d];y=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;k=n.multiplyVector3(F[h.a].position.clone());l=n.multiplyVector3(F[h.b].position.clone());q=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(h.normal.clone());A=D.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(k,y))/A;y=y.addSelf(D.multiplyScalar(w));
+if(h instanceof THREE.Face3){if(b(y,k,l,q)){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}else if(h instanceof THREE.Face4&&(b(y,k,l,n)||b(y,l,q,n))){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}}return H}};
+THREE.Rectangle=function(){function a(){k=f-b;l=h-d}var b,d,f,h,k,l,q=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(n,w,A,y){q=!1;b=n;d=w;f=A;h=y;a()};this.addPoint=function(n,w){if(q){q=!1;b=n;d=w;f=n;h=w}else{b=b<n?b:n;d=d<w?d:w;f=f>n?f:n;h=h>w?h:w}a()};
+this.add3Points=function(n,w,A,y,D,E){if(q){q=!1;b=n<A?n<D?n:D:A<D?A:D;d=w<y?w<E?w:E:y<E?y:E;f=n>A?n>D?n:D:A>D?A:D;h=w>y?w>E?w:E:y>E?y:E}else{b=n<A?n<D?n<b?n:b:D<b?D:b:A<D?A<b?A:b:D<b?D:b;d=w<y?w<E?w<d?w:d:E<d?E:d:y<E?y<d?y:d:E<d?E:d;f=n>A?n>D?n>f?n:f:D>f?D:f:A>D?A>f?A:f:D>f?D:f;h=w>y?w>E?w>h?w:h:E>h?E:h:y>E?y>h?y:h:E>h?E:h}a()};this.addRectangle=function(n){if(q){q=!1;b=n.getLeft();d=n.getTop();f=n.getRight();h=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();f=f>n.getRight()?
+f:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;f+=n;h+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f<n.getRight()?f:n.getRight();h=h<n.getBottom()?h:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){q=!0;h=f=d=b=0;a()};this.isEmpty=function(){return q}};
+THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
+THREE.Matrix4=function(a,b,d,f,h,k,l,q,n,w,A,y,D,E,F,H){this.set(a||1,b||0,d||0,f||0,h||0,k||1,l||0,q||0,n||0,w||0,A||1,y||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,f,h,k,l,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=b;this.n13=d;this.n14=f;this.n21=h;this.n22=k;this.n23=l;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var f=THREE.Matrix4.__v1,
+h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(a,b).normalize();f.cross(d,k).normalize();h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,f=a.z,h=1/(this.n41*b+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*b+this.n32*d+this.n33*f+this.n34)*h;return a},
+multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*f+this.n24*h;a.z=this.n31*b+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*f+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+
+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,f=a.n12,h=a.n13,k=a.n14,l=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,V=b.n11,X=b.n12,ca=b.n13,aa=b.n14,Y=b.n21,da=b.n22,c=b.n23,oa=b.n24,ma=b.n31,pa=b.n32,qa=b.n33,ra=b.n34;this.n11=d*V+f*Y+h*ma;this.n12=d*X+f*da+h*pa;
+this.n13=d*ca+f*c+h*qa;this.n14=d*aa+f*oa+h*ra+k;this.n21=l*V+q*Y+n*ma;this.n22=l*X+q*da+n*pa;this.n23=l*ca+q*c+n*qa;this.n24=l*aa+q*oa+n*ra+w;this.n31=A*V+y*Y+D*ma;this.n32=A*X+y*da+D*pa;this.n33=A*ca+y*c+D*qa;this.n34=A*aa+y*oa+D*ra+E;this.n41=F*V+H*Y+L*ma;this.n42=F*X+H*da+L*pa;this.n43=F*ca+H*c+L*qa;this.n44=F*aa+H*oa+L*ra+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;
+d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,f=this.n14,h=this.n21,
+k=this.n22,l=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return f*l*w*D-d*q*w*D-f*k*A*D+b*q*A*D+d*k*y*D-b*l*y*D-f*l*n*E+d*q*n*E+f*h*A*E-a*q*A*E-d*h*y*E+a*l*y*E+f*k*n*F-b*q*n*F-f*h*w*F+a*q*w*F+b*h*y*F-a*k*y*F-d*k*n*H+b*l*n*H+d*h*w*H-a*l*w*H-b*h*A*H+a*k*A*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=
+a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
+this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;
+a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},
+setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),f=Math.sin(b),h=1-d,k=a.x,l=a.y,q=a.z,n=h*k,w=h*l;this.set(n*k+d,n*l-f*q,n*q+f*l,0,n*l+f*q,w*l+d,w*q-f*k,0,n*q-f*l,
+w*q+f*k,h*q*q+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,f=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var k=Math.cos(f);f=Math.sin(f);var l=a*d,q=b*d;this.n11=h*k;this.n12=-h*f;this.n13=d;this.n21=q*k+a*f;this.n22=-q*f+a*k;this.n23=-b*h;this.n31=-l*k+b*f;this.n32=l*f+b*k;this.n33=a*h;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,f=a.z,h=a.w,k=b+b,l=
+d+d,q=f+f;a=b*k;var n=b*l;b*=q;var w=d*l;d*=q;f*=q;k*=h;l*=h;h*=q;this.n11=1-(w+f);this.n12=n-h;this.n13=b+l;this.n21=n+h;this.n22=1-(a+f);this.n23=d-k;this.n31=b-l;this.n32=d+k;this.n33=1-(a+w);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,
+b){var d=1/b.x,f=1/b.y,h=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,f=a.n12,h=a.n13,k=a.n14,l=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*E*H-w*D*H+w*y*L-q*E*L-n*y*M+q*D*M;b.n12=k*D*H-h*E*H-k*y*L+f*E*L+h*y*M-f*D*M;b.n13=h*w*H-k*n*H+k*q*L-f*w*L-h*q*M+f*n*M;b.n14=k*n*y-h*w*y-k*q*D+f*w*D+h*q*E-f*n*E;b.n21=w*D*F-n*E*F-w*A*L+l*E*L+n*A*M-l*D*M;b.n22=h*E*F-k*D*F+k*A*L-d*E*L-h*A*M+d*D*M;b.n23=k*n*F-h*w*F-k*l*L+d*w*L+h*l*M-d*n*M;
+b.n24=h*w*A-k*n*A+k*l*D-d*w*D-h*l*E+d*n*E;b.n31=q*E*F-w*y*F+w*A*H-l*E*H-q*A*M+l*y*M;b.n32=k*y*F-f*E*F-k*A*H+d*E*H+f*A*M-d*y*M;b.n33=h*w*F-k*q*F+k*l*H-d*w*H-f*l*M+d*q*M;b.n34=k*q*A-f*w*A-k*l*y+d*w*y+f*l*E-d*q*E;b.n41=n*y*F-q*D*F-n*A*H+l*D*H+q*A*L-l*y*L;b.n42=f*D*F-h*y*F+h*A*H-d*D*H-f*A*L+d*y*L;b.n43=h*q*F-f*n*F-h*l*H+d*n*H+f*l*L-d*q*L;b.n44=f*n*A-h*q*A+h*l*y-d*n*y-f*l*D+d*q*D;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,f=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*l+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*h;d[2]=a*k;d[3]=a*l;d[4]=a*q;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*y;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,f,h,k){var l;l=new THREE.Matrix4;l.n11=2*h/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*h/(f-d);l.n23=(f+d)/(f-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(k+h)/(k-h);l.n34=-2*k*h/(k-h);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,f)};
+THREE.Matrix4.makeOrtho=function(a,b,d,f,h,k){var l,q,n,w;l=new THREE.Matrix4;q=b-a;n=d-f;w=k-h;l.n11=2/q;l.n12=0;l.n13=0;l.n14=-((b+a)/q);l.n21=0;l.n22=2/n;l.n23=0;l.n24=-((d+f)/n);l.n31=0;l.n32=0;l.n33=-2/w;l.n34=-((k+h)/w);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0};
-THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},
-updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
-this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,c,d)}}};THREE.Quaternion=function(a,c,d,e){this.set(a||0,c||0,d||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,e=a.y*c,h=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-h);h=Math.sin(-h);var l=Math.cos(d);d=Math.sin(d);var m=a*c,q=e*h;this.w=m*l-q*d;this.x=m*d+q*l;this.y=e*c*l+a*h*d;this.z=a*h*l-e*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,e=this.z,h=this.w,l=a.x,m=a.y,q=a.z;a=a.w;this.x=c*a+h*l+d*q-e*m;this.y=d*a+h*m+e*l-c*q;this.z=e*a+h*q+c*m-d*l;this.w=h*a-c*l-d*m-e*q;return this},
-multiplyVector3:function(a,c){c||(c=a);var d=a.x,e=a.y,h=a.z,l=this.x,m=this.y,q=this.z,n=this.w,w=n*d+m*h-q*e,A=n*e+q*d-l*h,y=n*h+l*e-m*d;d=-l*d-m*e-q*h;c.x=w*n+d*-l+A*-q-y*-m;c.y=A*n+d*-m+y*-l-w*-q;c.z=y*n+d*-q+w*-m-A*-l;return c}};
-THREE.Quaternion.slerp=function(a,c,d,e){var h=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}h=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*h+c.w*e;d.x=a.x*h+c.x*e;d.y=a.y*h+c.y*e;d.z=a.z*h+c.z*e;return d};
-THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,c,d,e,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,c,d,e,h,l){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=l instanceof Array?l:[l]};
-THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
-THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,h,l,m,q=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){l=this.vertices[e];l.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){l=this.faces[e];if(a&&l.vertexNormals.length){q.set(0,0,0);c=0;for(d=l.normal.length;c<d;c++)q.addSelf(l.vertexNormals[c]);q.divideScalar(3)}else{c=this.vertices[l.a];d=this.vertices[l.b];m=this.vertices[l.c];q.sub(m.position,
-d.position);n.sub(c.position,d.position);q.crossSelf(n)}q.isZero()||q.normalize();l.normal.copy(q)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(qa,ha,ua,Aa,Ca,wa,Fa){l=qa.vertices[ha].position;m=qa.vertices[ua].position;q=qa.vertices[Aa].position;n=h[Ca];w=h[wa];A=h[Fa];y=m.x-l.x;D=q.x-l.x;E=m.y-
-l.y;F=q.y-l.y;H=m.z-l.z;L=q.z-l.z;M=w.u-n.u;Z=A.u-n.u;X=w.v-n.v;O=A.v-n.v;W=1/(M*O-Z*X);oa.set((O*y-X*D)*W,(O*E-X*F)*W,(O*H-X*L)*W);la.set((M*D-Z*y)*W,(M*F-Z*E)*W,(M*L-Z*H)*W);b[ha].addSelf(oa);b[ua].addSelf(oa);b[Aa].addSelf(oa);ka[ha].addSelf(la);ka[ua].addSelf(la);ka[Aa].addSelf(la)}var c,d,e,h,l,m,q,n,w,A,y,D,E,F,H,L,M,Z,X,O,W,b=[],ka=[],oa=new THREE.Vector3,la=new THREE.Vector3,ma=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;
-ka[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];h=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){pa.copy(this.vertices[c].normal);e=b[c];ma.copy(e);ma.subSelf(pa.multiplyScalar(pa.dot(e))).normalize();ra.cross(this.vertices[c].normal,e);e=ra.dot(ka[c]);e=e<0?-1:1;this.vertices[c].tangent.set(ma.x,ma.y,ma.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,c,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var l=new THREE.Vector3;this.translateX=function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);l.crossSelf(this.up);if(q)l.y=0;this.position.addSelf(l);this.target.position.addSelf(l)};this.translateZ=
-function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(q)l.y=0;this.position.subSelf(l);this.target.position.subSelf(l)}};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
-!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},
+updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,b,d)}}};THREE.Quaternion=function(a,b,d,f){this.set(a||0,b||0,d||0,f!==undefined?f:1)};
+THREE.Quaternion.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,f=a.y*b,h=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-h);h=Math.sin(-h);var k=Math.cos(d);d=Math.sin(d);var l=a*b,q=f*h;this.w=l*k-q*d;this.x=l*d+q*k;this.y=f*b*k+a*h*d;this.z=a*h*k-f*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,f=this.z,h=this.w,k=a.x,l=a.y,q=a.z;a=a.w;this.x=b*a+h*k+d*q-f*l;this.y=d*a+h*l+f*k-b*q;this.z=f*a+h*q+b*l-d*k;this.w=h*a-b*k-d*l-f*q;return this},
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,f=a.y,h=a.z,k=this.x,l=this.y,q=this.z,n=this.w,w=n*d+l*h-q*f,A=n*f+q*d-k*h,y=n*h+k*f-l*d;d=-k*d-l*f-q*h;b.x=w*n+d*-k+A*-q-y*-l;b.y=A*n+d*-l+y*-k-w*-q;b.z=y*n+d*-q+w*-l-A*-k;return b}};
+THREE.Quaternion.slerp=function(a,b,d,f){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var k=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-f)*k)/l;f=Math.sin(f*k)/l;d.w=a.w*h+b.w*f;d.x=a.x*h+b.x*f;d.y=a.y*h+b.y*f;d.z=a.z*h+b.z*f;return d};
+THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
+THREE.Face3=function(a,b,d,f,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,f,h,k){this.a=a;this.b=b;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=k instanceof Array?k:[k]};
+THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,f,h,k,l,q=new THREE.Vector3,n=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){k=this.vertices[f];k.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(a&&k.vertexNormals.length){q.set(0,0,0);b=0;for(d=k.normal.length;b<d;b++)q.addSelf(k.vertexNormals[b]);q.divideScalar(3)}else{b=this.vertices[k.a];d=this.vertices[k.b];l=this.vertices[k.c];q.sub(l.position,
+d.position);n.sub(b.position,d.position);q.crossSelf(n)}q.isZero()||q.normalize();k.normal.copy(q)}},computeVertexNormals:function(){var a,b,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(ra,za,Aa,ja,va,Ga,Da){k=ra.vertices[za].position;l=ra.vertices[Aa].position;q=ra.vertices[ja].position;n=h[va];w=h[Ga];A=h[Da];y=l.x-k.x;D=q.x-k.x;E=l.y-
+k.y;F=q.y-k.y;H=l.z-k.z;L=q.z-k.z;M=w.u-n.u;V=A.u-n.u;X=w.v-n.v;ca=A.v-n.v;aa=1/(M*ca-V*X);c.set((ca*y-X*D)*aa,(ca*E-X*F)*aa,(ca*H-X*L)*aa);oa.set((M*D-V*y)*aa,(M*F-V*E)*aa,(M*L-V*H)*aa);Y[za].addSelf(c);Y[Aa].addSelf(c);Y[ja].addSelf(c);da[za].addSelf(oa);da[Aa].addSelf(oa);da[ja].addSelf(oa)}var b,d,f,h,k,l,q,n,w,A,y,D,E,F,H,L,M,V,X,ca,aa,Y=[],da=[],c=new THREE.Vector3,oa=new THREE.Vector3,ma=new THREE.Vector3,pa=new THREE.Vector3,qa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){Y[b]=
+new THREE.Vector3;da[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){f=this.faces[b];h=this.uvs[b];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);
+this.vertices[f.c].normal.copy(f.vertexNormals[2]);this.vertices[f.d].normal.copy(f.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){qa.copy(this.vertices[b].normal);f=Y[b];ma.copy(f);ma.subSelf(qa.multiplyScalar(qa.dot(f))).normalize();pa.cross(this.vertices[b].normal,f);f=pa.dot(da[b]);f=f<0?-1:1;this.vertices[b].tangent.set(ma.x,ma.y,ma.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
+this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.Camera=function(a,b,d,f,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var k=new THREE.Vector3;this.translateX=function(l,q){k.sub(this.target.position,this.position).normalize().multiplyScalar(l);k.crossSelf(this.up);if(q)k.y=0;this.position.addSelf(k);this.target.position.addSelf(k)};this.translateZ=
+function(l,q){k.sub(this.target.position,this.position).normalize().multiplyScalar(l);if(q)k.y=0;this.position.subSelf(k);this.target.position.subSelf(k)}};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
@@ -88,93 +88,92 @@ a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!=
 undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
 undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.Texture=function(a,c,d,e,h,l){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==undefined?h:THREE.LinearFilter;this.minFilter=l!==undefined?l:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(a,b,d,f,h,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==undefined?h:THREE.LinearFilter;this.minFilter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
-THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,d,e,h={};for(c in a){h[c]={};for(d in a[c]){e=a[c][d];h[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return h},merge:function(a){var c,d,e,h={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)h[d]=e[d]}return h}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
-THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
+THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var b,d,f,h={};for(b in a){h[b]={};for(d in a[b]){f=a[b][d];h[b][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var b,d,f,h={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(d in f)h[d]=f[d]}return h}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
+THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
-c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
-THREE.Sound=function(a,c,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var h;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)h=
-"audio/mpeg";else if(c.indexOf(".ogg")!==-1)h="audio/ogg";else c.indexOf(".wav")!==-1&&(h="audio/wav");if(this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
+b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
+THREE.Sound=function(a,b,d,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var h;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)h=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)h="audio/ogg";else b.indexOf(".wav")!==-1&&(h="audio/wav");if(this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,d)};
+THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,d)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
-THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
-THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var e,h=d.length;for(e=0;e<h;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
-THREE.WebGLRenderer=function(a){function c(f,j,k){var g,i,u,o=f.vertices,r=o.length,x=f.colors,s=x.length,v=f.__vertexArray,J=f.__colorArray,Q=f.__sortArray,N=f.__dirtyVertices,I=f.__dirtyColors;if(k.sortParticles){ua.multiplySelf(k.matrixWorld);for(g=0;g<r;g++){i=o[g].position;wa.copy(i);ua.multiplyVector3(wa);Q[g]=[wa.z,g]}Q.sort(function(K,G){return G[0]-K[0]});for(g=0;g<r;g++){i=o[Q[g][1]].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}for(g=0;g<s;g++){u=g*3;color=x[Q[g][1]];J[u]=color.r;J[u+1]=
-color.g;J[u+2]=color.b}}else{if(N)for(g=0;g<r;g++){i=o[g].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}if(I)for(g=0;g<s;g++){color=x[g];u=g*3;J[u]=color.r;J[u+1]=color.g;J[u+2]=color.b}}if(N||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,v,j)}if(I||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,J,j)}}function d(f,j){f.fragmentShader=j.fragmentShader;f.vertexShader=j.vertexShader;f.uniforms=Uniforms.clone(j.uniforms)}
-function e(f,j,k,g,i){g.program||la.initMaterial(g,j,k);var u=g.program,o=u.uniforms,r=g.uniforms;if(u!=ka){b.useProgram(u);ka=u;b.uniformMatrix4fv(o.projectionMatrix,!1,Aa)}if(k&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){r.fogNear.value=k.near;r.fogFar.value=k.far}else if(k instanceof
-THREE.FogExp2)r.fogDensity.value=k.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var x,s,v=0,J=0,Q=0,N,I,K,G=la.lights,fa=G.directional.colors,t=G.directional.positions,ca=G.point.colors,ba=G.point.positions,ea=0,z=0;k=s=s=0;for(x=j.length;k<x;k++){s=j[k];N=s.color;I=s.position;K=s.intensity;if(s instanceof THREE.AmbientLight){v+=N.r;J+=N.g;Q+=N.b}else if(s instanceof THREE.DirectionalLight){s=ea*3;fa[s]=N.r*K;fa[s+1]=N.g*K;fa[s+2]=N.b*K;t[s]=I.x;t[s+1]=
-I.y;t[s+2]=I.z;ea+=1}else if(s instanceof THREE.PointLight){s=z*3;ca[s]=N.r*K;ca[s+1]=N.g*K;ca[s+2]=N.b*K;ba[s]=I.x;ba[s+1]=I.y;ba[s+2]=I.z;z+=1}}for(k=ea*3;k<fa.length;k++)fa[k]=0;for(k=z*3;k<ca.length;k++)ca[k]=0;G.point.length=z;G.directional.length=ea;G.ambient[0]=v;G.ambient[1]=J;G.ambient[2]=Q;j=la.lights;r.enableLighting.value=j.directional.length+j.point.length;r.ambientLightColor.value=j.ambient;r.directionalLightColor.value=j.directional.colors;r.directionalLightDirection.value=j.directional.positions;
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
+THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var f,h=d.length;for(f=0;f<h;f++){a=d[f];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.WebGLRenderer=function(a){function b(e,j,m){var g,i,u,o=e.vertices,r=o.length,x=e.colors,s=x.length,v=e.__vertexArray,J=e.__colorArray,P=e.__sortArray,N=e.__dirtyVertices,I=e.__dirtyColors;if(m.sortParticles){va.multiplySelf(m.matrixWorld);for(g=0;g<r;g++){i=o[g].position;Ba.copy(i);va.multiplyVector3(Ba);P[g]=[Ba.z,g]}P.sort(function(K,G){return G[0]-K[0]});for(g=0;g<r;g++){i=o[P[g][1]].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}for(g=0;g<s;g++){u=g*3;color=x[P[g][1]];J[u]=color.r;J[u+1]=
+color.g;J[u+2]=color.b}}else{if(N)for(g=0;g<r;g++){i=o[g].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}if(I)for(g=0;g<s;g++){color=x[g];u=g*3;J[u]=color.r;J[u+1]=color.g;J[u+2]=color.b}}if(N||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,j)}if(I||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,J,j)}}function d(e,j){e.fragmentShader=j.fragmentShader;e.vertexShader=j.vertexShader;e.uniforms=Uniforms.clone(j.uniforms)}
+function f(e,j,m,g,i){g.program||pa.initMaterial(g,j,m);var u=g.program,o=u.uniforms,r=g.uniforms;if(u!=oa){c.useProgram(u);oa=u;c.uniformMatrix4fv(o.projectionMatrix,!1,Ga)}if(m&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){r.fogNear.value=m.near;r.fogFar.value=m.far}else if(m instanceof
+THREE.FogExp2)r.fogDensity.value=m.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var x,s,v=0,J=0,P=0,N,I,K,G=pa.lights,ha=G.directional.colors,t=G.directional.positions,ea=G.point.colors,ba=G.point.positions,ga=0,z=0;m=s=s=0;for(x=j.length;m<x;m++){s=j[m];N=s.color;I=s.position;K=s.intensity;if(s instanceof THREE.AmbientLight){v+=N.r;J+=N.g;P+=N.b}else if(s instanceof THREE.DirectionalLight){s=ga*3;ha[s]=N.r*K;ha[s+1]=N.g*K;ha[s+2]=N.b*K;t[s]=I.x;t[s+1]=
+I.y;t[s+2]=I.z;ga+=1}else if(s instanceof THREE.PointLight){s=z*3;ea[s]=N.r*K;ea[s+1]=N.g*K;ea[s+2]=N.b*K;ba[s]=I.x;ba[s+1]=I.y;ba[s+2]=I.z;z+=1}}for(m=ga*3;m<ha.length;m++)ha[m]=0;for(m=z*3;m<ea.length;m++)ea[m]=0;G.point.length=z;G.directional.length=ga;G.ambient[0]=v;G.ambient[1]=J;G.ambient[2]=P;j=pa.lights;r.enableLighting.value=j.directional.length+j.point.length;r.ambientLightColor.value=j.ambient;r.directionalLightColor.value=j.directional.colors;r.directionalLightDirection.value=j.directional.positions;
 r.pointLightColor.value=j.point.colors;r.pointLightPosition.value=j.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.map.texture=g.map;r.lightMap.texture=g.lightMap;r.envMap.texture=g.envMap;r.reflectivity.value=g.reflectivity;r.refractionRatio.value=g.refractionRatio;r.combine.value=g.combine;r.useRefract.value=
 g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.size.value=g.size;r.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(g.ambient.r,g.ambient.g,
-g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=f.near;r.mFar.value=f.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var B in r)if(v=u.uniforms[B]){k=r[B];x=k.type;j=k.value;if(x=="i")b.uniform1i(v,j);else if(x=="f")b.uniform1f(v,j);else if(x=="fv1")b.uniform1fv(v,j);else if(x=="fv")b.uniform3fv(v,j);else if(x=="v2")b.uniform2f(v,
-j.x,j.y);else if(x=="v3")b.uniform3f(v,j.x,j.y,j.z);else if(x=="c")b.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){b.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(!k.image.__webGLTextureCube)k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
-b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);(k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0?b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR):b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR);for(x=0;x<6;++x)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[x]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+
-j);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,null)}else{k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-
-1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,
-null);k.__wasSetOnce=!0}k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&b.uniform3f(o.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&b.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);
-(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(o.viewMatrix,!1,Ca);if(g.skinning){b.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(f,j,k,g,i,u){f=e(f,j,k,g,u).attributes;b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(f.position,3,b.FLOAT,!1,0,0);if(f.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);
-b.vertexAttribPointer(f.color,3,b.FLOAT,!1,0,0)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,!1,0,0)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.vertexAttribPointer(f.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
-i.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(f.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(f.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(f.skinIndex,
-4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(f.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?
-b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=b.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=b.createBuffer();if(f.hasPos){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,f.positionArray,
-b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,!1,0,0)}if(f.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,f.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,f.count);f.count=0}function m(f){if(ma!=f.doubleSided){f.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ma=
-f.doubleSided}if(ra!=f.flipSided){f.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ra=f.flipSided}}function q(f){if(qa!=f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);qa=f}}function n(f){ha[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ha[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ha[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ha[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ha[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ha[5].set(f.n41+
-f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=ha[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,k=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ha[g].x*j.n14+ha[g].y*j.n24+ha[g].z*j.n34+ha[g].w;if(f<=k)return!1}return!0}function A(f,j){f.list[f.count]=j;f.count+=1}function y(f){var j,k,g=f.object,i=f.opaque,u=f.transparent;u.count=0;f=i.count=0;for(j=g.materials.length;f<j;f++){k=
-g.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(f){var j,k,g,i,u=f.object,o=f.buffer,r=f.opaque,x=f.transparent;x.count=0;f=r.count=0;for(g=u.materials.length;f<g;f++){j=u.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(f,j){return j.z-
-f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var Q=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?Q.push("undefined"):Q.push(J[k].id);return Q.join("_")}var k,g,i,u,o,r,x,s,v={};f.geometryGroups={};i=0;for(u=f.faces.length;i<u;i++){o=f.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+
-"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);f.geometryGroups[s].vertices+=o}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=pa){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);
-b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}pa=f}}function Z(f,j){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=
-b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(f.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(f.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(f.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(f.minFilter));b.texImage2D(b.TEXTURE_2D,
-0,O(f.format),f.width,f.height,0,O(f.format),O(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var k,g,i;if(f){k=f.__webGLFramebuffer;g=f.width;i=f.height}else{k=null;g=W.width;i=W.height}if(k!=
-oa){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,g,i);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);oa=k}}function X(f,j){var k;if(f=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else f=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,j);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(k));return null}return k}function O(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
-case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
-case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var W=document.createElement("canvas"),b,ka=null,oa=null,la=this,ma=null,ra=null,pa=null,qa=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),wa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ma=a.clearAlpha}this.domElement=W;this.autoClear=!0;this.sortObjects=!0;(function(f,j,k){try{if(!(b=W.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(g){console.error(g)}b.clearColor(0,
-0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Fa,La,Ma);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){W.width=f;W.height=j;b.viewport(0,0,W.width,W.height)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);
-b.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){b.clearColor(f.r,f.g,f.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,k){var g,i;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof
-THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=f.fragmentShader;j=f.vertexShader;u={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,
-skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-b.attachShader(k,X("fragment",i+x));b.attachShader(k,X("vertex",u+j));b.linkProgram(k);b.getProgramParameter(k,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(k,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");k.uniforms={};k.attributes={};f.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)k.push(g);g=f.program;x=0;for(j=k.length;x<
-j;x++){i=k[x];g.uniforms[i]=b.getUniformLocation(g,i)}g=f.program;k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];x=0;for(j=k.length;x<j;x++){i=k[x];g.attributes[i]=b.getAttribLocation(g,i)}g=f.program.attributes;b.enableVertexAttribArray(g.position);g.color>=0&&b.enableVertexAttribArray(g.color);g.normal>=0&&b.enableVertexAttribArray(g.normal);g.tangent>=0&&b.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
-0&&g.skinIndex>=0&&g.skinWeight>=0){b.enableVertexAttribArray(g.skinVertexA);b.enableVertexAttribArray(g.skinVertexB);b.enableVertexAttribArray(g.skinIndex);b.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,j,k,g){var i,u,o,r,x,s,v,J,Q=f.lights,N=f.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Ca);j.projectionMatrix.flattenToArray(Aa);ua.multiply(j.projectionMatrix,j.matrixWorldInverse);n(ua);f.update(undefined,!1,j);this.initWebGLObjects(f,j);Z(k,g!==undefined?
-g:!0);this.autoClear&&this.clear();x=f.__webglObjects.length;for(g=0;g<x;g++){i=f.__webglObjects[g];v=i.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);D(i);i.render=!0;if(this.sortObjects){wa.copy(v.position);ua.multiplyVector3(wa);i.z=wa.z}}else i.render=!1;else i.render=!1}this.sortObjects&&f.__webglObjects.sort(E);s=f.__webglObjectsImmediate.length;for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];v=i.object;if(v.visible){v.matrixAutoUpdate&&
-v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);y(i)}}M(THREE.NormalBlending);for(g=0;g<x;g++){i=f.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;o=i.opaque;m(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);h(j,Q,N,r,J,v)}}}for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.opaque;m(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);u=e(j,Q,N,r,v);v.render(function(I){l(I,u)})}}}for(g=0;g<x;g++){i=f.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;
-o=i.transparent;m(v);for(i=0;i<o.count;i++){r=o.list[i];M(r.blending);q(r.depthTest);h(j,Q,N,r,J,v)}}}for(g=0;g<s;g++){i=f.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.transparent;m(v);for(i=0;i<o.count;i++){r=o.list[i];M(r.blending);q(r.depthTest);u=e(j,Q,N,r,v);v.render(function(I){l(I,u)})}}}if(k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var j=f.__objectsAdded[0],k=f,g=void 0,i=void 0,u=void 0;if(j._modelViewMatrix==undefined){j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}if(j instanceof THREE.Mesh){i=j.geometry;i.geometryGroups==undefined&&H(i);for(g in i.geometryGroups){u=
-i.geometryGroups[g];if(!u.__webGLVertexBuffer){var o=u;o.__webGLVertexBuffer=b.createBuffer();o.__webGLNormalBuffer=b.createBuffer();o.__webGLTangentBuffer=b.createBuffer();o.__webGLColorBuffer=b.createBuffer();o.__webGLUVBuffer=b.createBuffer();o.__webGLUV2Buffer=b.createBuffer();o.__webGLSkinVertexABuffer=b.createBuffer();o.__webGLSkinVertexBBuffer=b.createBuffer();o.__webGLSkinIndicesBuffer=b.createBuffer();o.__webGLSkinWeightsBuffer=b.createBuffer();o.__webGLFaceBuffer=b.createBuffer();o.__webGLLineBuffer=
-b.createBuffer();o=u;var r=j,x=void 0,s=void 0,v=0,J=0,Q=0,N=r.geometry.faces,I=o.faces;x=0;for(s=I.length;x<s;x++){fi=I[x];face=N[fi];if(face instanceof THREE.Face3){v+=3;J+=1;Q+=3}else if(face instanceof THREE.Face4){v+=4;J+=2;Q+=4}}o.__vertexArray=new Float32Array(v*3);o.__normalArray=new Float32Array(v*3);o.__tangentArray=new Float32Array(v*4);o.__colorArray=new Float32Array(v*3);o.__uvArray=new Float32Array(v*2);o.__uv2Array=new Float32Array(v*2);o.__skinVertexAArray=new Float32Array(v*4);o.__skinVertexBArray=
-new Float32Array(v*4);o.__skinIndexArray=new Float32Array(v*4);o.__skinWeightArray=new Float32Array(v*4);o.__faceArray=new Uint16Array(J*3);o.__lineArray=new Uint16Array(Q*2);s=x=o;v=void 0;N=void 0;var K=void 0,G=void 0;K=void 0;I=!1;v=0;for(N=r.materials.length;v<N;v++){K=r.materials[v];if(K instanceof THREE.MeshFaceMaterial){K=0;for(G=s.materials.length;K<G;K++)if(s.materials[K]&&s.materials[K].shading!=undefined&&s.materials[K].shading==THREE.SmoothShading){I=!0;break}}else if(K&&K.shading!=undefined&&
-K.shading==THREE.SmoothShading){I=!0;break}if(I)break}x.__needsSmoothNormals=I;o.__webGLFaceCount=J*3;o.__webGLLineCount=Q*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}L(k.__webglObjects,u,j)}}else if(j instanceof THREE.Ribbon){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=
-new Float32Array(u*3);g.__webGLVertexCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLLineCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;
-if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__sortArray=[];g.__webGLParticleCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,
-1)}for(;f.__objectsRemoved.length;){j=f.__objectsRemoved[0];k=f;i=void 0;g=void 0;for(i=k.__webglObjects.length-1;i>=0;i--){g=k.__webglObjects[i].object;j==g&&k.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(k=f.__webglObjects.length;j<k;j++){g=f.__webglObjects[j].object;u=void 0;i=void 0;o=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(u in i.geometryGroups){o=i.geometryGroups[u];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=
-b.DYNAMIC_DRAW;Q=void 0;x=void 0;var fa=void 0,t=void 0,ca=void 0,ba=void 0,ea=void 0;fa=void 0;var z=void 0,B=void 0,C=void 0,P=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;t=void 0;ba=void 0;ca=void 0;ea=void 0;var ga=G=K=I=N=v=r=s=0,Y=0,p=0,$=o.__vertexArray,Da=o.__uvArray,Ea=o.__uv2Array,na=o.__normalArray,R=o.__tangentArray,
-aa=o.__colorArray,S=o.__skinVertexAArray,T=o.__skinVertexBArray,U=o.__skinIndexArray,V=o.__skinWeightArray,sa=o.__faceArray,ia=o.__lineArray,Na=o.__needsSmoothNormals,da=g.geometry,Ga=da.__dirtyVertices,Ha=da.__dirtyElements,Ba=da.__dirtyUvs,Ia=da.__dirtyNormals,Ja=da.__dirtyTangents,Ka=da.__dirtyColors,ja=da.vertices,Oa=o.faces,Pa=da.faces,Qa=da.uvs,Ra=da.uvs2,ta=da.colors,xa=da.skinVerticesA,ya=da.skinVerticesB,za=da.skinIndices,va=da.skinWeights;Q=0;for(x=Oa.length;Q<x;Q++){fa=Oa[Q];t=Pa[fa];ea=
-Qa[fa];fa=Ra[fa];ca=t.vertexNormals;ba=t.normal;if(t instanceof THREE.Face3){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;r+=9}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];V[p]=z.x;V[p+1]=z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;z=za[t.a];B=za[t.b];C=za[t.c];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;
-U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;p+=12}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;
-aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;Y+=9}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;G+=12}if(Ia)if(ca.length==3&&Na)for(t=0;t<3;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<3;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<3;t++){ca=ea[t];Da[v]=ca.u;Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=
-0;t<3;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+2;ia[ga+4]=s+1;ia[ga+5]=s+2;ga+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;P=ja[t.d].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;$[r+9]=P.x;$[r+10]=P.y;$[r+11]=P.z;r+=12}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];P=va[t.d];V[p]=z.x;V[p+1]=
-z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;V[p+12]=P.x;V[p+13]=P.y;V[p+14]=P.z;V[p+15]=P.w;z=za[t.a];B=za[t.b];C=za[t.c];P=za[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=P.x;U[p+13]=P.y;U[p+14]=P.z;U[p+15]=P.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];P=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+
-7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=P.x;S[p+13]=P.y;S[p+14]=P.z;S[p+15]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];P=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;T[p+12]=P.x;T[p+13]=P.y;T[p+14]=P.z;T[p+15]=1;p+=16}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];P=ta[t.d];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;aa[Y+9]=P.r;aa[Y+10]=P.g;
-aa[Y+11]=P.b;Y+=12}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;t=ja[t.d].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;R[G+12]=t.x;R[G+13]=t.y;R[G+14]=t.z;R[G+15]=t.w;G+=16}if(Ia)if(ca.length==4&&Na)for(t=0;t<4;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<4;t++){ca=ea[t];Da[v]=ca.u;
-Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=0;t<4;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;sa[I+3]=s;sa[I+4]=s+2;sa[I+5]=s+3;I+=6;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+3;ia[ga+4]=s+1;ia[ga+5]=s+2;ia[ga+6]=s+2;ia[ga+7]=s+3;ga+=8;s+=4}}}if(Ga){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,$,J)}if(Ka&&ta.length){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,aa,J)}if(Ia){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);
-b.bufferData(b.ARRAY_BUFFER,na,J)}if(Ja&&da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,R,J)}if(Ba&&v>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Da,J)}if(Ba&&N>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ea,J)}if(Ha){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,sa,J);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,
-ia,J)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,S,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,T,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,U,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,V,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof
-THREE.Ribbon){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;u=b.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;Q=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,I,u)}if(K){for(s=0;s<Q;s++){color=J[s];o=s*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,
-g.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Line){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;u=b.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;Q=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,
-I,u)}if(K){for(s=0;s<Q;s++){color=J[s];o=s*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,g.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){i=g.geometry;(i.__dirtyVertices||i.__dirtyColors||g.sortParticles)&&c(i,b.DYNAMIC_DRAW,g);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);
-else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var B in r)if(v=u.uniforms[B]){m=r[B];x=m.type;j=m.value;if(x=="i")c.uniform1i(v,j);else if(x=="f")c.uniform1f(v,j);else if(x=="fv1")c.uniform1fv(v,j);else if(x=="fv")c.uniform3fv(v,j);else if(x=="v2")c.uniform2f(v,
+j.x,j.y);else if(x=="v3")c.uniform3f(v,j.x,j.y,j.z);else if(x=="c")c.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){c.uniform1i(v,j);if(m=m.texture)if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(m.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube);for(x=0;x<6;++x)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,c.RGBA,c.UNSIGNED_BYTE,m.image[x])}else{m.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube);
+for(x=0;x<6;++x)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image[x]);m.__wasSetOnce=!0}V(c.TEXTURE_CUBE_MAP,m,m.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube)}}else{if(m.needsUpdate){if(m.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,m.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,m.image)}else{m.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,
+m.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image);m.__wasSetOnce=!0}V(c.TEXTURE_2D,m,m.image);c.bindTexture(c.TEXTURE_2D,null);m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,m.__webGLTexture)}}}c.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);c.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(o.cameraPosition,e.position.x,
+e.position.y,e.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(o.viewMatrix,!1,Da);if(g.skinning){c.uniformMatrix4fv(o.cameraInverseMatrix,!1,Da);c.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(e,j,m,g,i,u){e=f(e,j,m,g,u).attributes;c.bindBuffer(c.ARRAY_BUFFER,
+i.__webGLVertexBuffer);c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0);if(e.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(e.color,3,c.FLOAT,!1,0,0)}if(e.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(e.normal,3,c.FLOAT,!1,0,0)}if(e.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(e.tangent,4,c.FLOAT,!1,0,0)}if(e.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUVBuffer);
+c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv)}else c.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(e.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv2)}else c.disableVertexAttribArray(e.uv2);if(g.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(e.skinVertexA,4,c.FLOAT,
+!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(e.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(e.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(e.skinWeight,4,c.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,i.__webGLLineCount,
+c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function k(e,j){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=
+c.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=c.createBuffer();if(e.hasPos){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,e.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.attributes.position,3,c.FLOAT,!1,0,0)}if(e.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,e.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal,
+3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,e.count);e.count=0}function l(e){if(qa!=e.doubleSided){e.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);qa=e.doubleSided}if(ra!=e.flipSided){e.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ra=e.flipSided}}function q(e){if(Aa!=e){e?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Aa=e}}function n(e){ja[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);ja[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);ja[2].set(e.n41+e.n21,e.n42+e.n22,
+e.n43+e.n23,e.n44+e.n24);ja[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);ja[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);ja[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var j;for(e=0;e<6;e++){j=ja[e];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(e){for(var j=e.matrixWorld,m=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),g=0;g<6;g++){e=ja[g].x*j.n14+ja[g].y*j.n24+ja[g].z*j.n34+ja[g].w;if(e<=m)return!1}return!0}function A(e,
+j){e.list[e.count]=j;e.count+=1}function y(e){var j,m,g=e.object,i=e.opaque,u=e.transparent;u.count=0;e=i.count=0;for(j=g.materials.length;e<j;e++){m=g.materials[e];m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?A(u,m):A(i,m)}}function D(e){var j,m,g,i,u=e.object,o=e.buffer,r=e.opaque,x=e.transparent;x.count=0;e=r.count=0;for(g=u.materials.length;e<g;e++){j=u.materials[e];if(j instanceof THREE.MeshFaceMaterial){j=0;for(m=o.materials.length;j<m;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<
+1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(e,j){return j.z-e.z}function F(e,j){e._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function H(e){function j(J){var P=[];m=0;for(g=J.length;m<g;m++)J[m]==undefined?P.push("undefined"):P.push(J[m].id);return P.join("_")}var m,
+g,i,u,o,r,x,s,v={};e.geometryGroups={};i=0;for(u=e.faces.length;i<u;i++){o=e.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+"_"+v[x].counter;e.geometryGroups[s]==undefined&&(e.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(e.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;e.geometryGroups[s]==undefined&&(e.geometryGroups[s]={faces:[],materials:r,vertices:0})}e.geometryGroups[s].faces.push(i);
+e.geometryGroups[s].vertices+=o}}function L(e,j,m){e.push({buffer:j,object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(e){if(e!=za){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);
+c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}za=e}}function V(e,j,m){if((m.width&m.width-1)==0&&(m.height&m.height-1)==0){c.texParameteri(e,c.TEXTURE_WRAP_S,Y(j.wrapS));c.texParameteri(e,c.TEXTURE_WRAP_T,Y(j.wrapT));c.texParameteri(e,c.TEXTURE_MAG_FILTER,Y(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,Y(j.minFilter));c.generateMipmap(e)}else{c.texParameteri(e,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_WRAP_T,
+c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,aa(j.minFilter))}}function X(e,j){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=c.createFramebuffer();e.__webGLRenderbuffer=c.createRenderbuffer();e.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,e.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,e.width,e.height);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texParameteri(c.TEXTURE_2D,
+c.TEXTURE_WRAP_S,Y(e.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,Y(e.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,Y(e.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,Y(e.minFilter));c.texImage2D(c.TEXTURE_2D,0,Y(e.format),e.width,e.height,0,Y(e.format),Y(e.type),null);c.bindFramebuffer(c.FRAMEBUFFER,e.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,e.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,
+c.RENDERBUFFER,e.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var m,g,i;if(e){m=e.__webGLFramebuffer;g=e.width;i=e.height}else{m=null;g=da.width;i=da.height}if(m!=ma){c.bindFramebuffer(c.FRAMEBUFFER,m);c.viewport(0,0,g,i);j&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);ma=m}}function ca(e,j){var m;if(e=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else e=="vertex"&&(m=c.createShader(c.VERTEX_SHADER));c.shaderSource(m,
+j);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(m));return null}return m}function aa(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function Y(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
+case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
+case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var da=document.createElement("canvas"),c,oa=null,ma=null,pa=this,qa=null,ra=null,za=null,Aa=null,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ga=new Float32Array(16),Da=new Float32Array(16),Ba=new THREE.Vector4,Ma=!0,Na=new THREE.Color(0),Oa=0;if(a){if(a.antialias!==undefined)Ma=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Oa=a.clearAlpha}this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(e,j,m){try{if(!(c=da.getContext("experimental-webgl",{antialias:e})))throw"Error creating WebGL context.";}catch(g){console.error(g)}c.clearColor(0,
+0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(j.r,j.g,j.b,m);_cullEnabled=!0})(Ma,Na,Oa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,j){da.width=e;da.height=j;c.viewport(0,0,da.width,da.height)};this.setClearColorHex=function(e,j){var m=
+new THREE.Color(e);c.clearColor(m.r,m.g,m.b,j)};this.setClearColor=function(e,j){c.clearColor(e.r,e.g,e.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,j,m){var g,i;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);
+else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);var u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=e.fragmentShader;j=e.vertexShader;u={fog:m,map:e.map,envMap:e.envMap,lightMap:e.lightMap,
+vertexColors:e.vertexColors,skinning:e.skinning,maxDirLights:i.directional,maxPointLights:i.point};m=c.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+u=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(m,ca("fragment",i+x));c.attachShader(m,ca("vertex",u+j));c.linkProgram(m);c.getProgramParameter(m,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(m,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");m.uniforms={};m.attributes={};e.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in e.uniforms)m.push(g);g=e.program;x=0;for(j=m.length;x<
+j;x++){i=m[x];g.uniforms[i]=c.getUniformLocation(g,i)}g=e.program;m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];x=0;for(j=m.length;x<j;x++){i=m[x];g.attributes[i]=c.getAttribLocation(g,i)}g=e.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(e.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
+0&&g.skinIndex>=0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(e,j,m,g){var i,u,o,r,x,s,v,J,P=e.lights,N=e.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Da);j.projectionMatrix.flattenToArray(Ga);va.multiply(j.projectionMatrix,j.matrixWorldInverse);n(va);e.update(undefined,!1,j);this.initWebGLObjects(e,j);X(m,g!==undefined?
+g:!0);this.autoClear&&this.clear();x=e.__webglObjects.length;for(g=0;g<x;g++){i=e.__webglObjects[g];v=i.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);D(i);i.render=!0;if(this.sortObjects){Ba.copy(v.position);va.multiplyVector3(Ba);i.z=Ba.z}}else i.render=!1;else i.render=!1}this.sortObjects&&e.__webglObjects.sort(E);s=e.__webglObjectsImmediate.length;for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);y(i)}}M(THREE.NormalBlending);for(g=0;g<x;g++){i=e.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;o=i.opaque;l(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);h(j,P,N,r,J,v)}}}for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.opaque;l(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);u=f(j,P,N,r,v);v.render(function(I){k(I,u)})}}}for(g=0;g<x;g++){i=e.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;
+o=i.transparent;l(v);for(i=0;i<o.count;i++){r=o.list[i];M(r.blending);q(r.depthTest);h(j,P,N,r,J,v)}}}for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.transparent;l(v);for(i=0;i<o.count;i++){r=o.list[i];M(r.blending);q(r.depthTest);u=f(j,P,N,r,v);v.render(function(I){k(I,u)})}}}if(m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,m.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[]}for(;e.__objectsAdded.length;){var j=e.__objectsAdded[0],m=e,g=void 0,i=void 0,u=void 0;if(j._modelViewMatrix==undefined){j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}if(j instanceof THREE.Mesh){i=j.geometry;i.geometryGroups==undefined&&H(i);for(g in i.geometryGroups){u=
+i.geometryGroups[g];if(!u.__webGLVertexBuffer){var o=u;o.__webGLVertexBuffer=c.createBuffer();o.__webGLNormalBuffer=c.createBuffer();o.__webGLTangentBuffer=c.createBuffer();o.__webGLColorBuffer=c.createBuffer();o.__webGLUVBuffer=c.createBuffer();o.__webGLUV2Buffer=c.createBuffer();o.__webGLSkinVertexABuffer=c.createBuffer();o.__webGLSkinVertexBBuffer=c.createBuffer();o.__webGLSkinIndicesBuffer=c.createBuffer();o.__webGLSkinWeightsBuffer=c.createBuffer();o.__webGLFaceBuffer=c.createBuffer();o.__webGLLineBuffer=
+c.createBuffer();o=u;var r=j,x=void 0,s=void 0,v=0,J=0,P=0,N=r.geometry.faces,I=o.faces;x=0;for(s=I.length;x<s;x++){fi=I[x];face=N[fi];if(face instanceof THREE.Face3){v+=3;J+=1;P+=3}else if(face instanceof THREE.Face4){v+=4;J+=2;P+=4}}o.__vertexArray=new Float32Array(v*3);o.__normalArray=new Float32Array(v*3);o.__tangentArray=new Float32Array(v*4);o.__colorArray=new Float32Array(v*3);o.__uvArray=new Float32Array(v*2);o.__uv2Array=new Float32Array(v*2);o.__skinVertexAArray=new Float32Array(v*4);o.__skinVertexBArray=
+new Float32Array(v*4);o.__skinIndexArray=new Float32Array(v*4);o.__skinWeightArray=new Float32Array(v*4);o.__faceArray=new Uint16Array(J*3);o.__lineArray=new Uint16Array(P*2);s=x=o;v=void 0;N=void 0;var K=void 0,G=void 0;K=void 0;I=!1;v=0;for(N=r.materials.length;v<N;v++){K=r.materials[v];if(K instanceof THREE.MeshFaceMaterial){K=0;for(G=s.materials.length;K<G;K++)if(s.materials[K]&&s.materials[K].shading!=undefined&&s.materials[K].shading==THREE.SmoothShading){I=!0;break}}else if(K&&K.shading!=undefined&&
+K.shading==THREE.SmoothShading){I=!0;break}if(I)break}x.__needsSmoothNormals=I;o.__webGLFaceCount=J*3;o.__webGLLineCount=P*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}L(m.__webglObjects,u,j)}}else if(j instanceof THREE.Ribbon){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=
+new Float32Array(u*3);g.__webGLVertexCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(m.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLLineCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(m.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;
+if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__sortArray=[];g.__webGLParticleCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(m.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&m.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,
+1)}for(;e.__objectsRemoved.length;){j=e.__objectsRemoved[0];m=e;i=void 0;g=void 0;for(i=m.__webglObjects.length-1;i>=0;i--){g=m.__webglObjects[i].object;j==g&&m.__webglObjects.splice(i,1)}e.__objectsRemoved.splice(0,1)}j=0;for(m=e.__webglObjects.length;j<m;j++){g=e.__webglObjects[j].object;u=void 0;i=void 0;o=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(u in i.geometryGroups){o=i.geometryGroups[u];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=
+c.DYNAMIC_DRAW;P=void 0;x=void 0;var ha=void 0,t=void 0,ea=void 0,ba=void 0,ga=void 0;ha=void 0;var z=void 0,B=void 0,C=void 0,O=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;t=void 0;ba=void 0;ea=void 0;ga=void 0;var ia=G=K=I=N=v=r=s=0,W=0,p=0,Z=o.__vertexArray,Ea=o.__uvArray,Fa=o.__uv2Array,na=o.__normalArray,Q=o.__tangentArray,
+$=o.__colorArray,R=o.__skinVertexAArray,S=o.__skinVertexBArray,T=o.__skinIndexArray,U=o.__skinWeightArray,sa=o.__faceArray,ka=o.__lineArray,Pa=o.__needsSmoothNormals,fa=g.geometry,Ha=fa.__dirtyVertices,Ia=fa.__dirtyElements,Ca=fa.__dirtyUvs,Ja=fa.__dirtyNormals,Ka=fa.__dirtyTangents,La=fa.__dirtyColors,la=fa.vertices,Qa=o.faces,Ra=fa.faces,Sa=fa.uvs,Ta=fa.uvs2,ta=fa.colors,wa=fa.skinVerticesA,xa=fa.skinVerticesB,ya=fa.skinIndices,ua=fa.skinWeights;P=0;for(x=Qa.length;P<x;P++){ha=Qa[P];t=Ra[ha];ga=
+Sa[ha];ha=Ta[ha];ea=t.vertexNormals;ba=t.normal;if(t instanceof THREE.Face3){if(Ha){z=la[t.a].position;B=la[t.b].position;C=la[t.c].position;Z[r]=z.x;Z[r+1]=z.y;Z[r+2]=z.z;Z[r+3]=B.x;Z[r+4]=B.y;Z[r+5]=B.z;Z[r+6]=C.x;Z[r+7]=C.y;Z[r+8]=C.z;r+=9}if(ua.length){z=ua[t.a];B=ua[t.b];C=ua[t.c];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;z=ya[t.a];B=ya[t.b];C=ya[t.c];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=z.w;T[p+4]=B.x;
+T[p+5]=B.y;T[p+6]=B.z;T[p+7]=B.w;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=C.w;z=wa[t.a];B=wa[t.b];C=wa[t.c];R[p]=z.x;R[p+1]=z.y;R[p+2]=z.z;R[p+3]=1;R[p+4]=B.x;R[p+5]=B.y;R[p+6]=B.z;R[p+7]=1;R[p+8]=C.x;R[p+9]=C.y;R[p+10]=C.z;R[p+11]=1;z=xa[t.a];B=xa[t.b];C=xa[t.c];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;p+=12}if(La&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];$[W]=z.r;$[W+1]=z.g;$[W+2]=z.b;$[W+3]=B.r;$[W+4]=B.g;$[W+
+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;W+=9}if(Ka&&fa.hasTangents){z=la[t.a].tangent;B=la[t.b].tangent;C=la[t.c].tangent;Q[G]=z.x;Q[G+1]=z.y;Q[G+2]=z.z;Q[G+3]=z.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;G+=12}if(Ja)if(ea.length==3&&Pa)for(t=0;t<3;t++){ba=ea[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<3;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ca&&ga)for(t=0;t<3;t++){ea=ga[t];Ea[v]=ea.u;Ea[v+1]=ea.v;v+=2}if(Ca&&ha)for(t=0;t<
+3;t++){ga=ha[t];Fa[N]=ga.u;Fa[N+1]=ga.v;N+=2}if(Ia){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ka[ia]=s;ka[ia+1]=s+1;ka[ia+2]=s;ka[ia+3]=s+2;ka[ia+4]=s+1;ka[ia+5]=s+2;ia+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ha){z=la[t.a].position;B=la[t.b].position;C=la[t.c].position;O=la[t.d].position;Z[r]=z.x;Z[r+1]=z.y;Z[r+2]=z.z;Z[r+3]=B.x;Z[r+4]=B.y;Z[r+5]=B.z;Z[r+6]=C.x;Z[r+7]=C.y;Z[r+8]=C.z;Z[r+9]=O.x;Z[r+10]=O.y;Z[r+11]=O.z;r+=12}if(ua.length){z=ua[t.a];B=ua[t.b];C=ua[t.c];O=ua[t.d];U[p]=z.x;U[p+1]=z.y;
+U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=O.x;U[p+13]=O.y;U[p+14]=O.z;U[p+15]=O.w;z=ya[t.a];B=ya[t.b];C=ya[t.c];O=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=z.w;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=B.w;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=C.w;T[p+12]=O.x;T[p+13]=O.y;T[p+14]=O.z;T[p+15]=O.w;z=wa[t.a];B=wa[t.b];C=wa[t.c];O=wa[t.d];R[p]=z.x;R[p+1]=z.y;R[p+2]=z.z;R[p+3]=1;R[p+4]=B.x;R[p+5]=B.y;R[p+6]=B.z;R[p+7]=1;
+R[p+8]=C.x;R[p+9]=C.y;R[p+10]=C.z;R[p+11]=1;R[p+12]=O.x;R[p+13]=O.y;R[p+14]=O.z;R[p+15]=1;z=xa[t.a];B=xa[t.b];C=xa[t.c];O=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=O.x;S[p+13]=O.y;S[p+14]=O.z;S[p+15]=1;p+=16}if(La&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];O=ta[t.d];$[W]=z.r;$[W+1]=z.g;$[W+2]=z.b;$[W+3]=B.r;$[W+4]=B.g;$[W+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;$[W+9]=O.r;$[W+10]=O.g;$[W+11]=O.b;W+=
+12}if(Ka&&fa.hasTangents){z=la[t.a].tangent;B=la[t.b].tangent;C=la[t.c].tangent;t=la[t.d].tangent;Q[G]=z.x;Q[G+1]=z.y;Q[G+2]=z.z;Q[G+3]=z.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;Q[G+12]=t.x;Q[G+13]=t.y;Q[G+14]=t.z;Q[G+15]=t.w;G+=16}if(Ja)if(ea.length==4&&Pa)for(t=0;t<4;t++){ba=ea[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ca&&ga)for(t=0;t<4;t++){ea=ga[t];Ea[v]=ea.u;Ea[v+1]=ea.v;
+v+=2}if(Ca&&ha)for(t=0;t<4;t++){ga=ha[t];Fa[N]=ga.u;Fa[N+1]=ga.v;N+=2}if(Ia){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;sa[I+3]=s;sa[I+4]=s+2;sa[I+5]=s+3;I+=6;ka[ia]=s;ka[ia+1]=s+1;ka[ia+2]=s;ka[ia+3]=s+3;ka[ia+4]=s+1;ka[ia+5]=s+2;ka[ia+6]=s+2;ka[ia+7]=s+3;ia+=8;s+=4}}}if(Ha){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,J)}if(La&&ta.length){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,$,J)}if(Ja){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLNormalBuffer);
+c.bufferData(c.ARRAY_BUFFER,na,J)}if(Ka&&fa.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,Q,J)}if(Ca&&v>0){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,J)}if(Ca&&N>0){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Fa,J)}if(Ia){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,sa,J);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,
+ka,J)}if(p>0){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,R,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,S,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,T,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,U,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof
+THREE.Ribbon){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;u=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;P=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,u)}if(K){for(s=0;s<P;s++){color=J[s];o=s*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
+g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Line){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;u=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;P=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,
+I,u)}if(K){for(s=0;s<P;s++){color=J[s];o=s*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){i=g.geometry;(i.__dirtyVertices||i.__dirtyColors||g.sortParticles)&&b(i,c.DYNAMIC_DRAW,g);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(e,j){if(e){!j||j=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);
+else e=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",

+ 1 - 0
examples/scenes/test_scene.js

@@ -131,6 +131,7 @@ var scene = {
 		"depth" : 10, 
 		"segmentsWidth"  : 1, 
 		"segmentsHeight" : 1,
+		"segmentsDepth"  : 1,
 		"flipped" : false, 
 		"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
 	},

二进制
examples/textures/758px-Canestra_di_frutta_(Caravaggio).jpg


+ 213 - 0
examples/webgl_materials_texture_filters.html

@@ -0,0 +1,213 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - texture filtering</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				color: #aaa;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+
+				background-color: #000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+				z-index:100;
+			}
+			
+			a { color:red }						
+			
+		</style>
+	</head>
+
+	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - texture filtering example
+			- painting by <a href="http://en.wikipedia.org/wiki/Basket_of_Fruit_%28Caravaggio%29">Caravaggio</a>
+		</div>		
+		
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+			
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var container,stats;
+
+			var camera, scene, renderer;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+			animate();
+
+
+			function init() {
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000 );
+				camera.position.z = 1500;
+
+				scene = new THREE.Scene();
+				scene.fog = new THREE.Fog( 0x000000, 1500, 4000 );
+				
+				// GROUND
+
+				var imageCanvas = document.createElement( "canvas" ),
+					context = imageCanvas.getContext( "2d" );
+
+				imageCanvas.width = imageCanvas.height = 128;
+
+				context.fillStyle = "#444";
+				context.fillRect( 0, 0, 128, 128 );
+				context.fillStyle = "#fff";
+				context.fillRect( 0, 0, 64, 64);
+				context.fillRect( 64, 64, 64, 64 );
+				
+				var textureCanvas = new THREE.Texture( imageCanvas, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping );
+					materialCanvas = new THREE.MeshBasicMaterial( { map: textureCanvas } );
+
+				textureCanvas.needsUpdate = true;
+				
+				var i, j, uvs,
+					geometryRepeat = new Plane( 100, 100, 1, 1 );
+					
+				for( i = 0; i < geometryRepeat.uvs.length; i++ ) {
+					
+					uvs = geometryRepeat.uvs[i];
+					
+					for ( j = 0; j < uvs.length; j++ ) {
+					
+						uvs[j].u *= 1000;
+						uvs[j].v *= 1000;
+
+					}
+
+				}
+				
+				
+				var meshCanvas = new THREE.Mesh( geometryRepeat, materialCanvas );
+				meshCanvas.position.x = 0;
+				meshCanvas.position.y = 0;
+				meshCanvas.position.z = 0;
+				meshCanvas.rotation.x = Math.PI / 2;
+				meshCanvas.scale.x = meshCanvas.scale.y = meshCanvas.scale.z = 1000;
+				meshCanvas.doubleSided = true;
+				scene.addObject( meshCanvas );
+
+				// PAINTING
+				
+				var callbackPainting = function( image ) {
+				
+					var geometry = new Plane( 100, 100, 1, 1 ),
+						mesh = new THREE.Mesh( geometry, materialPainting );
+
+					mesh.position.x = 0;
+					mesh.position.y = 0;
+					mesh.position.z = 0;
+					mesh.scale.x = image.width / 100;
+					mesh.scale.y = image.height / 100;
+					mesh.scale.z = 1;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000 } )  );
+
+					mesh.position.x = 0;
+					mesh.position.y = 0;
+					mesh.position.z = -0.5;
+					mesh.scale.x = 1.1 * image.width / 100;
+					mesh.scale.y = 1.1 * image.height / 100;
+					mesh.scale.z = 1;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.9 } )  );
+
+					mesh.position.x = 0;
+					mesh.position.y = 0;
+					mesh.position.z = - 1.1 * image.height/2;
+					mesh.scale.x = 1.1 * image.width / 100;
+					mesh.scale.y = 1.1 * image.height / 100;
+					mesh.scale.z = 1;
+					mesh.rotation.x = -Math.PI / 2;
+					scene.addObject( mesh );
+
+					mesh.position.y = - 1.1 * image.height/2;
+					meshCanvas.position.y = - 1.1125 * image.height/2;
+					
+				};
+				
+				var texturePainting = ImageUtils.loadTexture( "textures/758px-Canestra_di_frutta_(Caravaggio).jpg", THREE.UVMapping, callbackPainting ),
+					materialPainting = new THREE.MeshBasicMaterial( { color:0xffffff, map: texturePainting } );
+					
+				//texturePainting.minFilter = texturePainting.magFilter = THREE.NearestFilter;
+				texturePainting.minFilter = texturePainting.magFilter = THREE.LinearFilter;
+
+
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				renderer.domElement.style.position = "relative";
+				container.appendChild( renderer.domElement );
+				
+				renderer.setClearColor( scene.fog.color, 1 );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				stats.domElement.style.zIndex = 100;
+				container.appendChild( stats.domElement );
+				
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+			}
+
+
+			function onDocumentMouseMove(event) {
+
+				mouseX = ( event.clientX - windowHalfX );
+				mouseY = ( event.clientY - windowHalfY );
+
+			}
+
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function render() {
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - ( mouseY - 200) - camera.position.y ) * .05;
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 1 - 1
src/extras/SceneUtils.js

@@ -260,7 +260,7 @@ var SceneUtils = {
 
 				if ( g.type == "cube" ) {
 
-					geometry = new Cube( g.width, g.height, g.depth, g.segmentsWidth, g.segmentsHeight, null, g.flipped, g.sides );
+					geometry = new Cube( g.width, g.height, g.depth, g.segmentsWidth, g.segmentsHeight, g.segmentsDepth, null, g.flipped, g.sides );
 					result.geometries[ dg ] = geometry;
 
 				} else if ( g.type == "plane" ) {

+ 57 - 56
src/renderers/WebGLRenderer.js

@@ -2717,36 +2717,40 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function setTexture( texture, slot ) {
+	function setTextureParameters( textureType, texture, image ) {
 
-		if ( texture.needsUpdate ) {
+		if ( isPowerOfTwo( image.width ) && isPowerOfTwo( image.height ) ) {
 
-			if ( !texture.__wasSetOnce ) {
+			_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
+			_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
 
-				texture.__webGLTexture = _gl.createTexture();
+			_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
+			_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
 
-				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
-				_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
+			_gl.generateMipmap( textureType );
 
-				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
+		} else {
 
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
+			_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
+			_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
+			
+			_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
+			_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
 
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
+		}
 
-					_gl.generateMipmap( _gl.TEXTURE_2D );
+	};
+	
+	function setTexture( texture, slot ) {
 
-				} else {
+		if ( texture.needsUpdate ) {
 
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
-					_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 );
+			if ( !texture.__wasSetOnce ) {
 
-				}
+				texture.__webGLTexture = _gl.createTexture();
 
-				_gl.bindTexture( _gl.TEXTURE_2D, null );
+				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
+				_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
 
 				texture.__wasSetOnce = true;
 
@@ -2755,28 +2759,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
 				_gl.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
 
-				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
-
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
-
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
-
-					_gl.generateMipmap( _gl.TEXTURE_2D );
-
-				} else {
-
-					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
-					_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.bindTexture( _gl.TEXTURE_2D, null );
-
 			}
 
+			setTextureParameters( _gl.TEXTURE_2D, texture, texture.image );
+			_gl.bindTexture( _gl.TEXTURE_2D, null );
+			
 			texture.needsUpdate = false;
 
 		}
@@ -2791,42 +2778,38 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( texture.image.length == 6 ) {
 
 			if ( texture.needsUpdate ) {
-
-				if ( !texture.image.__webGLTextureCube ) {
+				
+				if ( !texture.__wasSetOnce ) {
 
 					texture.image.__webGLTextureCube = _gl.createTexture();
 
-				}
-
-				_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webGLTextureCube );
-
-				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
-				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
+					_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webGLTextureCube );
 
-				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, _gl.LINEAR );
+					for ( var i = 0; i < 6; ++i ) {
 
-				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
+						_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image[ i ] );
 
-					_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_LINEAR );
+					}
+				
+					texture.__wasSetOnce = true;
 
 				} else {
 
-					_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
+					_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webGLTextureCube );
 
-				}
+					for ( var i = 0; i < 6; ++i ) {
 
-				for ( var i = 0; i < 6; ++i ) {
+						_gl.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image[ i ] );
 
-					_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image[ i ] );
+					}
 
 				}
 
-				_gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );
-
+				setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, texture.image[0] );
 				_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null );
 
 				texture.needsUpdate = false;
-
+				
 			}
 
 			_gl.activeTexture( _gl.TEXTURE0 + slot );
@@ -2967,6 +2950,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	// fallback filters for non-power-of-2 textures
+	
+	function filterFallback ( f ) {
+		
+		switch ( f ) {
+
+			case THREE.NearestFilter:
+			case THREE.NearestMipMapNearestFilter:
+			case THREE.NearestMipMapLinearFilter: return _gl.NEAREST; break;
+
+			case THREE.LinearFilter:
+			case THREE.LinearMipMapNearestFilter:
+			case THREE.LinearMipMapLinearFilter: return _gl.LINEAR; break;
+
+		}
+		
+	};
+	
 	function paramThreeToGL( p ) {
 
 		switch ( p ) {

部分文件因为文件数量过多而无法显示