Browse Source

Added frustumCulled flag to Object3D.

alteredq 14 years ago
parent
commit
75952217a2

+ 10 - 10
build/Three.js

@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.
 THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+h)/(k-h);j.n34=-2*k*h/(k-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var j,m,p,o;j=new THREE.Matrix4;m=c-b;p=e-f;o=k-h;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+f)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((k+h)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
+!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
@@ -247,14 +247,14 @@ function m(b,e,c){ja!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_
 b.n34);for(var e,b=0;b<6;b++)e=Z[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function o(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Z[f].x*e.n14+Z[f].y*e.n24+Z[f].z*e.n34+Z[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function v(b){var e,c,f=b.object,j=b.opaque,h=b.transparent;h.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(h,c):t(j,c)}
 function w(b){var e,c,f,j,h=b.object,k=b.buffer,m=b.opaque,n=b.transparent;n.count=0;b=m.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=k.materials.length;e<c;e++)(j=k.materials[e])&&(j.transparent?t(n,j):t(m,j))}else(j=e)&&(j.transparent?t(n,j):t(m,j))}function u(b,e){return e.z-b.z}function y(b,c){var m,v,t,u=0,w,y,z,x,D=b.lights;ea||(ea=new THREE.Camera(S.shadowCameraFov,c.aspect,S.shadowCameraNear,S.shadowCameraFar));m=0;for(v=D.length;m<
 v;m++)if(t=D[m],t instanceof THREE.SpotLight&&t.castShadow){S.shadowMap[u]||(S.shadowMap[u]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ya[u]||(ya[u]=new THREE.Matrix4);w=S.shadowMap[u];y=ya[u];ea.position.copy(t.position);ea.target.position.copy(t.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);y.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ea.projectionMatrix);
-y.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(la);ea.projectionMatrix.flattenToArray(ra);N.multiply(ea.projectionMatrix,ea.matrixWorldInverse);p(N);S.initWebGLObjects(b);F(w);n.clearColor(1,1,1,1);S.clear();n.clearColor(pa.r,pa.g,pa.b,ta);y=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(w=0;w<y;w++)z=b.__webglObjects[w],x=z.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||o(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),B(x,ea,!1),z.render=
-!0):z.render=!1:z.render=!1;j(!0);O(THREE.NormalBlending);for(w=0;w<y;w++)if(z=b.__webglObjects[w],z.render)x=z.object,buffer=z.buffer,k(x),z=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?Ea:wa,f(ea,D,null,z,buffer,x);for(w=0;w<t;w++)z=b.__webglObjectsImmediate[w],x=z.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),B(x,ea,!1),k(x),program=e(ea,D,null,wa,x),x.render(function(b){h(b,program,wa.shading)}));u++}}function x(b,
-e){var c,f,j;c=T.attributes;var h=T.uniforms,k=ma/ia,m,o=[],p=ia*0.5,v=ma*0.5,t=!0;n.useProgram(T.program);fa=T.program;aa=U=-1;Aa||(n.enableVertexAttribArray(T.attributes.position),n.enableVertexAttribArray(T.attributes.uv),Aa=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,T.vertexBuffer);n.vertexAttribPointer(c.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(c.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,
-!1,ra);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,1),n.uniform3f(h.screenPosition,
-(j.position.x-p)/p,(v-j.position.y)/v,Math.max(0,Math.min(1,j.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,j.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?ma:1),o[0]=m*k*j.scale.x,o[1]=m*j.scale.y,n.uniform2f(h.uvScale,j.uvScale.x,j.uvScale.y),n.uniform2f(h.uvOffset,j.uvOffset.x,j.uvOffset.y),n.uniform2f(h.alignment,j.alignment.x,j.alignment.y),n.uniform1f(h.opacity,j.opacity),
-n.uniform1f(h.rotation,j.rotation),n.uniform2fv(h.scale,o),j.mergeWith3D&&!t?(n.enable(n.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(n.disable(n.DEPTH_TEST),t=!1),O(j.blending),I(j.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(da)}function B(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function z(b){var e,
-c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function E(b){function e(b){var j=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?j.push("undefined"):j.push(b[c].id);return j.join("_")}var c,
-f,j,h,k,m,n,o,p={},v=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};j=0;for(h=b.faces.length;j<h;j++)k=b.faces[j],m=k.materials,n=e(m),p[n]==void 0&&(p[n]={hash:n,counter:0}),o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:m,vertices:0,numMorphTargets:v}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+k>65535&&(p[n].counter+=1,o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],
+y.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(la);ea.projectionMatrix.flattenToArray(ra);N.multiply(ea.projectionMatrix,ea.matrixWorldInverse);p(N);S.initWebGLObjects(b);F(w);n.clearColor(1,1,1,1);S.clear();n.clearColor(pa.r,pa.g,pa.b,ta);y=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(w=0;w<y;w++)z=b.__webglObjects[w],x=z.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||o(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),
+B(x,ea,!1),z.render=!0):z.render=!1:z.render=!1;j(!0);O(THREE.NormalBlending);for(w=0;w<y;w++)if(z=b.__webglObjects[w],z.render)x=z.object,buffer=z.buffer,k(x),z=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?Ea:wa,f(ea,D,null,z,buffer,x);for(w=0;w<t;w++)z=b.__webglObjectsImmediate[w],x=z.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),B(x,ea,!1),k(x),program=e(ea,D,null,wa,x),x.render(function(b){h(b,program,wa.shading)}));
+u++}}function x(b,e){var c,f,j;c=T.attributes;var h=T.uniforms,k=ma/ia,m,o=[],p=ia*0.5,v=ma*0.5,t=!0;n.useProgram(T.program);fa=T.program;aa=U=-1;Aa||(n.enableVertexAttribArray(T.attributes.position),n.enableVertexAttribArray(T.attributes.uv),Aa=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,T.vertexBuffer);n.vertexAttribPointer(c.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(c.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);
+n.uniformMatrix4fv(h.projectionMatrix,!1,ra);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,
+1),n.uniform3f(h.screenPosition,(j.position.x-p)/p,(v-j.position.y)/v,Math.max(0,Math.min(1,j.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,j.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?ma:1),o[0]=m*k*j.scale.x,o[1]=m*j.scale.y,n.uniform2f(h.uvScale,j.uvScale.x,j.uvScale.y),n.uniform2f(h.uvOffset,j.uvOffset.x,j.uvOffset.y),n.uniform2f(h.alignment,j.alignment.x,j.alignment.y),
+n.uniform1f(h.opacity,j.opacity),n.uniform1f(h.rotation,j.rotation),n.uniform2fv(h.scale,o),j.mergeWith3D&&!t?(n.enable(n.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(n.disable(n.DEPTH_TEST),t=!1),O(j.blending),I(j.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(da)}function B(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function z(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function E(b){function e(b){var j=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?j.push("undefined"):j.push(b[c].id);return j.join("_")}
+var c,f,j,h,k,m,n,o,p={},v=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};j=0;for(h=b.faces.length;j<h;j++)k=b.faces[j],m=k.materials,n=e(m),p[n]==void 0&&(p[n]={hash:n,counter:0}),o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:m,vertices:0,numMorphTargets:v}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+k>65535&&(p[n].counter+=1,o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],
 materials:m,vertices:0,numMorphTargets:v})),b.geometryGroups[o].faces.push(j),b.geometryGroups[o].vertices+=k}function J(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,
 n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function K(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,L(e.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,L(e.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,L(e.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),
 n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(e.minFilter)))}function I(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.image.width,b.image.height,0,L(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,
@@ -288,7 +288,7 @@ h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.ma
 {};w.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)f.push(x);x=f;f=0;for(m=x.length;f<m;f++)o=x[f],w.uniforms[o]=n.getUniformLocation(w,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)f.push("morphTarget"+x);for(u in e)f.push(u);u=f;x=0;for(e=u.length;x<e;x++)c=
 u[x],w.attributes[c]=n.getAttribLocation(w,c);V.push({program:w,code:k});u=w}b.program=u;u=b.program.attributes;u.position>=0&&n.enableVertexAttribArray(u.position);u.color>=0&&n.enableVertexAttribArray(u.color);u.normal>=0&&n.enableVertexAttribArray(u.normal);u.tangent>=0&&n.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(n.enableVertexAttribArray(u.skinVertexA),n.enableVertexAttribArray(u.skinVertexB),n.enableVertexAttribArray(u.skinIndex),
 n.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(j in b.attributes)u[j]!==void 0&&u[j]>=0&&n.enableVertexAttribArray(u[j]);if(b.morphTargets)for(j=b.numSupportedMorphTargets=0;j<this.maxMorphTargets;j++)x="morphTarget"+j,u[x]>=0&&(n.enableVertexAttribArray(u[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){F(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,t){var z,D,C,E,Z,I,J,G,K=b.lights,
-M=b.fog;this.shadowMapEnabled&&y(b,c);S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Z=b.__webglObjects.length;for(t=0;t<Z;t++)if(z=b.__webglObjects[t],J=z.object,J.visible)if(!(J instanceof THREE.Mesh)||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
+M=b.fog;this.shadowMapEnabled&&y(b,c);S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Z=b.__webglObjects.length;for(t=0;t<Z;t++)if(z=b.__webglObjects[t],J=z.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
 B(J,c,!0),w(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(sa.copy(J.position),N.multiplyVector3(sa),z.z=sa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(u);I=b.__webglObjectsImmediate.length;for(t=0;t<I;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),B(J,c,!0),v(z));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(t=
 0;t<Z;t++)if(z=b.__webglObjects[t],z.render)J=z.object,G=z.buffer,k(J),f(c,K,M,b.overrideMaterial,G,J);for(t=0;t<I;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(k(J),D=e(c,K,M,b.overrideMaterial,J),J.render(function(c){h(c,D,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(t=Z-1;t>=0;t--)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,
 K,M,E,G,J)}for(t=0;t<I;t++)if(z=b.__webglObjectsImmediate[t],J=z.object,J.visible){C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,K,M,E,J),J.render(function(b){h(b,D,E.shading)})}for(t=0;t<Z;t++)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.transparent;k(J);for(z=0;z<C.count;z++)E=C.list[z],O(E.blending),j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,K,M,E,G,J)}for(t=

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,l;f=new THREE.Matrix4;h=b-a;j=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
+!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),

+ 1 - 1
build/custom/ThreeDOM.js

@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,i;f=new THREE.Matrix4;h=b-a;j=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
+!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),

+ 1 - 1
build/custom/ThreeSVG.js

@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
+!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),

+ 49 - 49
build/custom/ThreeWebGL.js

@@ -16,38 +16,38 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e;e=d.clone().subSelf(b).dot(c);if(e<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
 d=d.clone().subSelf(c),j=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(j),h=d.dot(d),d=d.dot(j),j=1/(b*h-c*c),h=(h*e-c*d)*j,b=(b*d-c*e)*j;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,p,n,s,q,w,C=b.geometry,y=C.vertices,F=[],e=0;for(j=C.faces.length;e<j;e++)if(h=C.faces[e],q=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(h.centroid.clone()).subSelf(q),s=k.dot(w),!(s<=0)&&(k=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),r=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-s=w.dot(n),b.doubleSided||(b.flipSided?s>0:s<0)))if(s=n.dot((new THREE.Vector3).sub(k,q))/s,q=q.addSelf(w.multiplyScalar(s)),h instanceof THREE.Face3)d(q,k,m,r)&&(h={distance:this.origin.distanceTo(q),point:q,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(q,k,m,p)||d(q,m,r,p)))h={distance:this.origin.distanceTo(q),point:q,face:h,object:b},F.push(h);F.sort(function(b,c){return b.distance-c.distance});return F}else return[]}};
-THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,n,s){m=!1;c=h;d=k;e=n;j=s;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=c<h?c:h,d=d<k?d:k,e=e>h?e:h,j=j>k?j:k);b()};this.add3Points=
-function(h,k,n,s,q,w){m?(m=!1,c=h<n?h<q?h:q:n<q?n:q,d=k<s?k<w?k:w:s<w?s:w,e=h>n?h>q?h:q:n>q?n:q,j=k>s?k>w?k:w:s>w?s:w):(c=h<n?h<q?h<c?h:c:q<c?q:c:n<q?n<c?n:c:q<c?q:c,d=k<s?k<w?k<d?k:d:w<d?w:d:s<w?s<d?s:d:w<d?w:d,e=h>n?h>q?h>e?h:e:q>e?q:e:n>q?n>e?n:e:q>e?q:e,j=k>s?k>w?k>j?k:j:w>j?w:j:s>w?s>j?s:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),e=e>h.getRight()?e:h.getRight(),j=j>
+Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,p,n,q,s,w,C=b.geometry,y=C.vertices,F=[],e=0;for(j=C.faces.length;e<j;e++)if(h=C.faces[e],s=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(h.centroid.clone()).subSelf(s),q=k.dot(w),!(q<=0)&&(k=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),r=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+q=w.dot(n),b.doubleSided||(b.flipSided?q>0:q<0)))if(q=n.dot((new THREE.Vector3).sub(k,s))/q,s=s.addSelf(w.multiplyScalar(q)),h instanceof THREE.Face3)d(s,k,m,r)&&(h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(s,k,m,p)||d(s,m,r,p)))h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h);F.sort(function(b,c){return b.distance-c.distance});return F}else return[]}};
+THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,n,q){m=!1;c=h;d=k;e=n;j=q;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=c<h?c:h,d=d<k?d:k,e=e>h?e:h,j=j>k?j:k);b()};this.add3Points=
+function(h,k,n,q,s,w){m?(m=!1,c=h<n?h<s?h:s:n<s?n:s,d=k<q?k<w?k:w:q<w?q:w,e=h>n?h>s?h:s:n>s?n:s,j=k>q?k>w?k:w:q>w?q:w):(c=h<n?h<s?h<c?h:c:s<c?s:c:n<s?n<c?n:c:s<c?s:c,d=k<q?k<w?k<d?k:d:w<d?w:d:q<w?q<d?q:d:w<d?w:d,e=h>n?h>s?h>e?h:e:s>e?s:e:n>s?n>e?n:e:s>e?s:e,j=k>q?k>w?k>j?k:j:w>j?w:j:q>w?q>j?q:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),e=e>h.getRight()?e:h.getRight(),j=j>
 h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e<h.getRight()?e:h.getRight();j=j<h.getBottom()?j:h.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=e=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,p,n,s,q,w,C,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,p||0,n||1,s||0,q||0,w||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,p,n,s,q,w,C,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=p;this.n33=n;this.n34=s;this.n41=q;this.n42=w;this.n43=C;this.n44=y;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,p||0,n||1,q||0,s||0,w||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=p;this.n33=n;this.n34=q;this.n41=s;this.n42=w;this.n43=C;this.n44=y;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());j.cross(h,e).normalize();this.n11=e.x;this.n12=j.x;this.n13=h.x;this.n21=e.y;this.n22=j.y;this.n23=h.y;this.n31=e.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,j=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*j;
 b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+
-d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,s=b.n32,q=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44,xa=c.n11,ya=
-c.n12,ka=c.n13,oa=c.n14,R=c.n21,M=c.n22,v=c.n23,U=c.n24,N=c.n31,Z=c.n32,S=c.n33,V=c.n34,H=c.n41,f=c.n42,ua=c.n43,Fa=c.n44;this.n11=d*xa+e*R+j*N+h*H;this.n12=d*ya+e*M+j*Z+h*f;this.n13=d*ka+e*v+j*S+h*ua;this.n14=d*oa+e*U+j*V+h*Fa;this.n21=k*xa+m*R+r*N+p*H;this.n22=k*ya+m*M+r*Z+p*f;this.n23=k*ka+m*v+r*S+p*ua;this.n24=k*oa+m*U+r*V+p*Fa;this.n31=n*xa+s*R+q*N+w*H;this.n32=n*ya+s*M+q*Z+w*f;this.n33=n*ka+s*v+q*S+w*ua;this.n34=n*oa+s*U+q*V+w*Fa;this.n41=C*xa+y*R+F*N+L*H;this.n42=C*ya+y*M+F*Z+L*f;this.n43=
+d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44,xa=c.n11,ya=
+c.n12,ka=c.n13,oa=c.n14,R=c.n21,M=c.n22,v=c.n23,U=c.n24,N=c.n31,Z=c.n32,S=c.n33,V=c.n34,H=c.n41,f=c.n42,ua=c.n43,Fa=c.n44;this.n11=d*xa+e*R+j*N+h*H;this.n12=d*ya+e*M+j*Z+h*f;this.n13=d*ka+e*v+j*S+h*ua;this.n14=d*oa+e*U+j*V+h*Fa;this.n21=k*xa+m*R+r*N+p*H;this.n22=k*ya+m*M+r*Z+p*f;this.n23=k*ka+m*v+r*S+p*ua;this.n24=k*oa+m*U+r*V+p*Fa;this.n31=n*xa+q*R+s*N+w*H;this.n32=n*ya+q*M+s*Z+w*f;this.n33=n*ka+q*v+s*S+w*ua;this.n34=n*oa+q*U+s*V+w*Fa;this.n41=C*xa+y*R+F*N+L*H;this.n42=C*ya+y*M+F*Z+L*f;this.n43=
 C*ka+y*v+F*S+L*ua;this.n44=C*oa+y*U+F*V+L*Fa;return this},multiplyToArray:function(b,c,d){this.multiply(b,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(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
-b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,p=this.n32,n=this.n33,s=this.n34,q=this.n41,w=this.n42,C=this.n43,y=this.n44;return e*k*p*q-d*m*p*q-e*h*n*q+c*m*n*q+d*h*s*q-c*k*s*q-e*k*r*w+d*m*r*w+e*j*n*w-b*m*n*w-d*j*s*w+b*k*s*w+e*h*r*C-c*m*r*C-e*j*p*C+b*m*p*C+c*j*s*C-b*h*s*C-d*h*r*y+c*k*
+b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,p=this.n32,n=this.n33,q=this.n34,s=this.n41,w=this.n42,C=this.n43,y=this.n44;return e*k*p*s-d*m*p*s-e*h*n*s+c*m*n*s+d*h*q*s-c*k*q*s-e*k*r*w+d*m*r*w+e*j*n*w-b*m*n*w-d*j*q*w+b*k*q*w+e*h*r*C-c*m*r*C-e*j*p*C+b*m*p*C+c*j*q*C-b*h*q*C-d*h*r*y+c*k*
 r*y+d*j*p*y-b*k*p*y-c*j*n*y+b*h*n*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
 b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
 this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
 0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,p=j*k;this.set(r*h+d,r*k-e*m,r*m+e*k,0,r*k+e*m,p*k+d,p*m-e*h,0,r*m-e*k,p*m+e*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
 new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var r=
-k*m,p=k*j,n=e*m,s=e*j;this.n11=r+s*d;this.n12=n*d-p;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=p*d-n;this.n32=s+r*d;this.n33=h*k;break;case "ZXY":r=k*m;p=k*j;n=e*m;s=e*j;this.n11=r-s*d;this.n12=-h*j;this.n13=n+p*d;this.n21=p+n*d;this.n22=h*m;this.n23=s-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;p=h*j;n=d*m;s=d*j;this.n11=k*m;this.n12=n*e-p;this.n13=r*e+s;this.n21=k*j;this.n22=s*e+r;this.n23=p*e-n;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;p=
-h*e;n=d*k;s=d*e;this.n11=k*m;this.n12=s-r*j;this.n13=n*j+p;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=p*j+n;this.n33=r-s*j;break;case "XZY":r=h*k;p=h*e;n=d*k;s=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+s;this.n22=h*m;this.n23=p*j-n;this.n31=n*j-p;this.n32=d*m;this.n33=s*j+r;break;default:r=h*m,p=h*j,n=d*m,s=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=p+n*e,this.n22=r-s*e,this.n23=-d*k,this.n31=s-r*e,this.n32=n+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
+k*m,p=k*j,n=e*m,q=e*j;this.n11=r+q*d;this.n12=n*d-p;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=p*d-n;this.n32=q+r*d;this.n33=h*k;break;case "ZXY":r=k*m;p=k*j;n=e*m;q=e*j;this.n11=r-q*d;this.n12=-h*j;this.n13=n+p*d;this.n21=p+n*d;this.n22=h*m;this.n23=q-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;p=h*j;n=d*m;q=d*j;this.n11=k*m;this.n12=n*e-p;this.n13=r*e+q;this.n21=k*j;this.n22=q*e+r;this.n23=p*e-n;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;p=
+h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=q-r*j;this.n13=n*j+p;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=p*j+n;this.n33=r-q*j;break;case "XZY":r=h*k;p=h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+q;this.n22=h*m;this.n23=p*j-n;this.n31=n*j-p;this.n32=d*m;this.n33=q*j+r;break;default:r=h*m,p=h*j,n=d*m,q=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=p+n*e,this.n22=r-q*e,this.n23=-d*k,this.n31=q-r*e,this.n32=n+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
 b.x,d=b.y,e=b.z,j=b.w,h=c+c,k=d+d,m=e+e,b=c*h,r=c*k;c*=m;var p=d*k;d*=m;e*=m;h*=j;k*=j;j*=m;this.n11=1-(p+e);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+e);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;
 e.identity();e.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(e,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();
 d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*j;this.n23=
 b.n23*j;this.n33=b.n33*j}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,s=b.n32,q=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*w*y-p*q*y+p*s*F-m*w*F-r*s*L+m*q*L;c.n12=h*q*y-j*w*y-h*s*F+e*w*F+j*s*L-e*q*L;c.n13=j*p*y-h*r*y+h*m*F-e*p*F-j*m*L+e*r*L;c.n14=h*r*s-j*p*s-h*m*q+e*p*q+j*m*w-e*r*w;c.n21=p*q*C-r*w*C-p*n*F+k*w*F+r*n*L-k*q*L;c.n22=j*w*C-h*q*C+h*n*F-d*w*F-j*n*L+d*q*L;c.n23=h*r*C-j*p*C-h*k*F+d*p*F+j*k*L-d*r*L;c.n24=
-j*p*n-h*r*n+h*k*q-d*p*q-j*k*w+d*r*w;c.n31=m*w*C-p*s*C+p*n*y-k*w*y-m*n*L+k*s*L;c.n32=h*s*C-e*w*C-h*n*y+d*w*y+e*n*L-d*s*L;c.n33=j*p*C-h*m*C+h*k*y-d*p*y-e*k*L+d*m*L;c.n34=h*m*n-e*p*n-h*k*s+d*p*s+e*k*w-d*m*w;c.n41=r*s*C-m*q*C-r*n*y+k*q*y+m*n*F-k*s*F;c.n42=e*q*C-j*s*C+j*n*y-d*q*y-e*n*F+d*s*F;c.n43=j*m*C-e*r*C-j*k*y+d*r*y+e*k*F-d*m*F;c.n44=e*r*n-j*m*n+j*k*s-d*r*s-e*k*q+d*m*q;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,s=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*p;d[7]=b*n;d[8]=b*s;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*w*y-p*s*y+p*q*F-m*w*F-r*q*L+m*s*L;c.n12=h*s*y-j*w*y-h*q*F+e*w*F+j*q*L-e*s*L;c.n13=j*p*y-h*r*y+h*m*F-e*p*F-j*m*L+e*r*L;c.n14=h*r*q-j*p*q-h*m*s+e*p*s+j*m*w-e*r*w;c.n21=p*s*C-r*w*C-p*n*F+k*w*F+r*n*L-k*s*L;c.n22=j*w*C-h*s*C+h*n*F-d*w*F-j*n*L+d*s*L;c.n23=h*r*C-j*p*C-h*k*F+d*p*F+j*k*L-d*r*L;c.n24=
+j*p*n-h*r*n+h*k*s-d*p*s-j*k*w+d*r*w;c.n31=m*w*C-p*q*C+p*n*y-k*w*y-m*n*L+k*q*L;c.n32=h*q*C-e*w*C-h*n*y+d*w*y+e*n*L-d*q*L;c.n33=j*p*C-h*m*C+h*k*y-d*p*y-e*k*L+d*m*L;c.n34=h*m*n-e*p*n-h*k*q+d*p*q+e*k*w-d*m*w;c.n41=r*q*C-m*s*C-r*n*y+k*s*y+m*n*F-k*q*F;c.n42=e*s*C-j*q*C+j*n*y-d*s*y-e*n*F+d*q*F;c.n43=j*m*C-e*r*C-j*k*y+d*r*y+e*k*F-d*m*F;c.n44=e*r*n-j*m*n+j*k*q-d*r*q-e*k*s+d*m*s;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*p;d[7]=b*n;d[8]=b*q;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,e,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,e){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,e)};
 THREE.Matrix4.makeOrtho=function(b,c,d,e,j,h){var k,m,r,p;k=new THREE.Matrix4;m=c-b;r=d-e;p=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+e)/r);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+j)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
-!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
+!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,j;d=0;for(e=this.children.length;d<e;d++){j=this.children[d];if(j.name===b)return j;if(c&&(j=j.getChildByName(b,c),j!==void 0))return j}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
@@ -55,8 +55,8 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,j=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=e*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=e*c*h+b*j*d;this.z=b*j*h-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
 this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,p=r*d+k*j-m*e,n=r*e+m*d-h*j,s=r*j+h*e-k*d,d=-h*
-d-k*e-m*j;c.x=p*r+d*-h+n*-m-s*-k;c.y=n*r+d*-k+s*-h-p*-m;c.z=s*r+d*-m+p*-k-n*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d};
+this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,p=r*d+k*j-m*e,n=r*e+m*d-h*j,q=r*j+h*e-k*d,d=-h*
+d-k*e-m*j;c.x=p*r+d*-h+n*-m-q*-k;c.y=n*r+d*-k+q*-h-p*-m;c.z=q*r+d*-m+p*-k-n*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,j,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,j,h,k){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -65,15 +65,15 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
 d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,j,h,k,m=new THREE.Vector3,r=new THREE.Vector3;e=0;for(j=this.faces.length;e<j;e++){h=this.faces[e];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,d.position),r.sub(c.position,d.position),m.crossSelf(r);m.isZero()||
 m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],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;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):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));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],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])):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 b(b,f,c,d,e,j,h){m=b.vertices[f].position;r=b.vertices[c].position;p=b.vertices[d].position;n=k[e];s=k[j];q=k[h];w=r.x-m.x;C=p.x-m.x;y=r.y-m.y;F=p.y-m.y;L=r.z-m.z;xa=p.z-m.z;ya=s.u-n.u;ka=q.u-n.u;oa=s.v-n.v;R=q.v-n.v;M=1/(ya*R-ka*oa);Z.set((R*
-w-oa*C)*M,(R*y-oa*F)*M,(R*L-oa*xa)*M);S.set((ya*C-ka*w)*M,(ya*F-ka*y)*M,(ya*xa-ka*L)*M);U[f].addSelf(Z);U[c].addSelf(Z);U[d].addSelf(Z);N[f].addSelf(S);N[c].addSelf(S);N[d].addSelf(S)}var c,d,e,j,h,k,m,r,p,n,s,q,w,C,y,F,L,xa,ya,ka,oa,R,M,v,U=[],N=[],Z=new THREE.Vector3,S=new THREE.Vector3,V=new THREE.Vector3,H=new THREE.Vector3,f=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):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 b(b,f,c,d,e,j,h){m=b.vertices[f].position;r=b.vertices[c].position;p=b.vertices[d].position;n=k[e];q=k[j];s=k[h];w=r.x-m.x;C=p.x-m.x;y=r.y-m.y;F=p.y-m.y;L=r.z-m.z;xa=p.z-m.z;ya=q.u-n.u;ka=s.u-n.u;oa=q.v-n.v;R=s.v-n.v;M=1/(ya*R-ka*oa);Z.set((R*
+w-oa*C)*M,(R*y-oa*F)*M,(R*L-oa*xa)*M);S.set((ya*C-ka*w)*M,(ya*F-ka*y)*M,(ya*xa-ka*L)*M);U[f].addSelf(Z);U[c].addSelf(Z);U[d].addSelf(Z);N[f].addSelf(S);N[c].addSelf(S);N[d].addSelf(S)}var c,d,e,j,h,k,m,r,p,n,q,s,w,C,y,F,L,xa,ya,ka,oa,R,M,v,U=[],N=[],Z=new THREE.Vector3,S=new THREE.Vector3,V=new THREE.Vector3,H=new THREE.Vector3,f=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],
 h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var ua=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)f.copy(h.vertexNormals[e]),j=h[ua[e]],v=U[j],V.copy(v),V.subSelf(f.multiplyScalar(f.dot(v))).normalize(),H.cross(h.vertexNormals[e],v),j=H.dot(N[j]),j=j<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(V.x,V.y,V.z,j)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 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++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===
 void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=1,b[c].array.push(d))}var d,e,j,h,k,m={};d=0;for(e=this.faces.length;d<e;d++)k=this.faces[d],k instanceof THREE.Face3?(j=b(k.a,k.b),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.a,k.c),c(m,j,d)):k instanceof THREE.Face4&&(j=b(k.b,k.d),c(m,j,d),j=b(k.a,k.b),c(m,j,d),j=b(k.a,k.d),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.c,k.d),c(m,j,d));d=0;for(e=this.edges.length;d<e;d++){k=this.edges[d];j=k.vertexIndices[0];h=k.vertexIndices[1];
 k.faceIndices=m[b(j,h)].array;for(j=0;j<k.faceIndices.length;j++)h=k.faceIndices[j],k.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,e,j,h,k){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*k+(-3*(c-d)-2*b-e)*h+b*j+c}this.points=b;var d=[],e={x:0,y:0,z:0},j,h,k,m,r,p,n,s,q;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];n=this.points[d[1]];
-s=this.points[d[2]];q=this.points[d[3]];m=k*k;r=k*m;e.x=c(p.x,n.x,s.x,q.x,k,m,r);e.y=c(p.y,n.y,s.y,q.y,k,m,r);e.z=c(p.z,n.z,s.z,q.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+THREE.Spline=function(b){function c(b,c,d,e,j,h,k){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*k+(-3*(c-d)-2*b-e)*h+b*j+c}this.points=b;var d=[],e={x:0,y:0,z:0},j,h,k,m,r,p,n,q,s;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];n=this.points[d[1]];
+q=this.points[d[2]];s=this.points[d[3]];m=k*k;r=k*m;e.x=c(p.x,n.x,q.x,s.x,k,m,r);e.y=c(p.y,n.y,q.y,s.y,k,m,r);e.z=c(p.z,n.z,q.z,s.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
 m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(k[c]=m,e=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,e,j,h,k,m=[],p=new THREE.Vector3,r=this.getLength();m.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=r.chunks[c]-r.chunks[c-1];k=Math.ceil(b*d/r.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)e=j+d*(1/k)*(h-j),position=this.getPoint(e),m.push(p.copy(position).clone());
 m.push(p.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
@@ -128,14 +128,14 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.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(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var f=0,d=1,e=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return e>=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),d<f?!1:(b.lerpSelf(c,f),c.lerpSelf(b,1-d),!0))}var e,j,h=[],k,m,r=[],p,n,s=[],q,w=[],C,y,F=[],L,xa,ya=[],ka=[],oa=[],R=new THREE.Vector4,
+THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var f=0,d=1,e=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return e>=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),d<f?!1:(b.lerpSelf(c,f),c.lerpSelf(b,1-d),!0))}var e,j,h=[],k,m,r=[],p,n,q=[],s,w=[],C,y,F=[],L,xa,ya=[],ka=[],oa=[],R=new THREE.Vector4,
 M=new THREE.Vector4,v=new THREE.Matrix4,U=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,f){var k,
-m;j=ka.length=0;k=b.objects;b=0;for(d=k.length;b<d;b++){m=k[b];var p;if(!(p=!m.visible))if(p=m instanceof THREE.Mesh){a:{p=void 0;for(var r=m.matrixWorld,n=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),s=0;s<6;s++)if(p=N[s].x*r.n14+N[s].y*r.n24+N[s].z*r.n34+N[s].w,p<=n){p=!1;break a}p=!0}p=!p}if(!p)p=h[j]=h[j]||new THREE.RenderableObject,j++,e=p,R.copy(m.position),v.multiplyVector3(R),e.object=m,e.z=R.z,ka.push(e)}f&&ka.sort(c);return ka};this.projectScene=function(e,
-j,f){var h=j.near,R=j.far,ka,va,W,$,I,X,P,ma,ga,Q,za,Da,Ea,ia,sa,Aa,Ca;xa=y=q=n=oa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);e.update(void 0,!1,j);v.multiply(j.projectionMatrix,j.matrixWorldInverse);N[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);N[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);N[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);N[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);N[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);N[5].set(v.n41+
+m;j=ka.length=0;k=b.objects;b=0;for(d=k.length;b<d;b++){m=k[b];var p;if(!(p=!m.visible))if(p=m instanceof THREE.Mesh){a:{p=void 0;for(var r=m.matrixWorld,n=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),q=0;q<6;q++)if(p=N[q].x*r.n14+N[q].y*r.n24+N[q].z*r.n34+N[q].w,p<=n){p=!1;break a}p=!0}p=!p}if(!p)p=h[j]=h[j]||new THREE.RenderableObject,j++,e=p,R.copy(m.position),v.multiplyVector3(R),e.object=m,e.z=R.z,ka.push(e)}f&&ka.sort(c);return ka};this.projectScene=function(e,
+j,f){var h=j.near,R=j.far,ka,va,W,$,I,X,P,ma,ga,Q,za,Da,Ea,ia,sa,Aa,Ca;xa=y=s=n=oa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);e.update(void 0,!1,j);v.multiply(j.projectionMatrix,j.matrixWorldInverse);N[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);N[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);N[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);N[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);N[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);N[5].set(v.n41+
 v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ka=0;ka<6;ka++)ga=N[ka],ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z));ga=this.projectObjects(e,j,!0);e=0;for(ka=ga.length;e<ka;e++)if(Q=ga[e].object,Q.visible)if(za=Q.matrixWorld,Da=Q.matrixRotationWorld,Ea=Q.materials,ia=Q.overdraw,m=0,Q instanceof THREE.Mesh){sa=Q.geometry;$=sa.vertices;Aa=sa.faces;sa=sa.faceVertexUvs;va=0;for(W=$.length;va<W;va++)k=b(),k.positionWorld.copy($[va].position),za.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
-v.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<R;$=0;for(va=Aa.length;$<va;$++){W=Aa[$];if(W instanceof THREE.Face3)if(I=r[W.a],X=r[W.b],P=r[W.c],I.visible&&X.visible&&P.visible&&(Q.doubleSided||Q.flipSided!=(P.positionScreen.x-I.positionScreen.x)*(X.positionScreen.y-I.positionScreen.y)-(P.positionScreen.y-I.positionScreen.y)*(X.positionScreen.x-I.positionScreen.x)<0))ma=s[n]=s[n]||
+v.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<R;$=0;for(va=Aa.length;$<va;$++){W=Aa[$];if(W instanceof THREE.Face3)if(I=r[W.a],X=r[W.b],P=r[W.c],I.visible&&X.visible&&P.visible&&(Q.doubleSided||Q.flipSided!=(P.positionScreen.x-I.positionScreen.x)*(X.positionScreen.y-I.positionScreen.y)-(P.positionScreen.y-I.positionScreen.y)*(X.positionScreen.x-I.positionScreen.x)<0))ma=q[n]=q[n]||
 new THREE.RenderableFace3,n++,p=ma,p.v1.copy(I),p.v2.copy(X),p.v3.copy(P);else continue;else if(W instanceof THREE.Face4)if(I=r[W.a],X=r[W.b],P=r[W.c],ma=r[W.d],I.visible&&X.visible&&P.visible&&ma.visible&&(Q.doubleSided||Q.flipSided!=((ma.positionScreen.x-I.positionScreen.x)*(X.positionScreen.y-I.positionScreen.y)-(ma.positionScreen.y-I.positionScreen.y)*(X.positionScreen.x-I.positionScreen.x)<0||(X.positionScreen.x-P.positionScreen.x)*(ma.positionScreen.y-P.positionScreen.y)-(X.positionScreen.y-
-P.positionScreen.y)*(ma.positionScreen.x-P.positionScreen.x)<0)))Ca=w[q]=w[q]||new THREE.RenderableFace4,q++,p=Ca,p.v1.copy(I),p.v2.copy(X),p.v3.copy(P),p.v4.copy(ma);else continue;p.normalWorld.copy(W.normal);Da.multiplyVector3(p.normalWorld);p.centroidWorld.copy(W.centroid);za.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);P=W.vertexNormals;I=0;for(X=P.length;I<X;I++)ma=p.vertexNormalsWorld[I],ma.copy(P[I]),Da.multiplyVector3(ma);I=0;
+P.positionScreen.y)*(ma.positionScreen.x-P.positionScreen.x)<0)))Ca=w[s]=w[s]||new THREE.RenderableFace4,s++,p=Ca,p.v1.copy(I),p.v2.copy(X),p.v3.copy(P),p.v4.copy(ma);else continue;p.normalWorld.copy(W.normal);Da.multiplyVector3(p.normalWorld);p.centroidWorld.copy(W.centroid);za.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);P=W.vertexNormals;I=0;for(X=P.length;I<X;I++)ma=p.vertexNormalsWorld[I],ma.copy(P[I]),Da.multiplyVector3(ma);I=0;
 for(X=sa.length;I<X;I++)if(Ca=sa[I][$]){P=0;for(ma=Ca.length;P<ma;P++)p.uvs[I][P]=Ca[P]}p.meshMaterials=Ea;p.faceMaterials=W.materials;p.overdraw=ia;p.z=p.centroidScreen.z;oa.push(p)}}else if(Q instanceof THREE.Line){U.multiply(v,za);$=Q.geometry.vertices;I=b();I.positionScreen.copy($[0].position);U.multiplyVector4(I.positionScreen);va=1;for(W=$.length;va<W;va++)if(I=b(),I.positionScreen.copy($[va].position),U.multiplyVector4(I.positionScreen),X=r[m-2],Z.copy(I.positionScreen),S.copy(X.positionScreen),
 d(Z,S))Z.multiplyScalar(1/Z.w),S.multiplyScalar(1/S.w),za=F[y]=F[y]||new THREE.RenderableLine,y++,C=za,C.v1.positionScreen.copy(Z),C.v2.positionScreen.copy(S),C.z=Math.max(Z.z,S.z),C.materials=Q.materials,oa.push(C)}else if(Q instanceof THREE.Particle&&(M.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),v.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,L=za,L.x=M.x/M.w,L.y=M.y/M.w,L.z=M.z,L.rotation=Q.rotation.z,L.scale.x=Q.scale.x*Math.abs(L.x-
 (M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)),L.scale.y=Q.scale.y*Math.abs(L.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24)),L.materials=Q.materials,oa.push(L);f&&oa.sort(c);return oa}};
@@ -174,18 +174,18 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,B=k.length,m=b.colors,T=m.length,p=b.__vertexArray,D=b.__colorArray,r=b.__sortArray,s=b.__dirtyVertices,n=b.__dirtyColors,q=b.__webglCustomAttributes,v,u;if(q)for(v in q)q[v].offset=0;if(d.sortParticles){sa.multiplySelf(d.matrixWorld);for(e=0;e<B;e++)j=k[e].position,Ka.copy(j),sa.multiplyVector3(Ka),r[e]=[Ka.z,e];r.sort(function(b,c){return c[0]-b[0]});for(e=0;e<B;e++)j=k[r[e][1]].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;
-for(e=0;e<T;e++)h=e*3,color=m[r[e][1]],D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(q)for(v in q){e=q[v];m=e.value.length;for(h=0;h<m;h++){index=r[h][1];T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[index];e.size===2?(e.array[T]=u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=
-u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}else{if(s)for(e=0;e<B;e++)j=k[e].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;if(n)for(e=0;e<T;e++)color=m[e],h=e*3,D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(q)for(v in q)if(e=q[v],e.__original.needsUpdate){m=e.value.length;for(h=0;h<m;h++){T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[h];e.size===2?(e.array[T]=
-u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}if(s||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(n||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(q)for(v in q)if(e=q[v],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
+THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,B=k.length,m=b.colors,T=m.length,p=b.__vertexArray,D=b.__colorArray,r=b.__sortArray,q=b.__dirtyVertices,n=b.__dirtyColors,s=b.__webglCustomAttributes,v,u;if(s)for(v in s)s[v].offset=0;if(d.sortParticles){sa.multiplySelf(d.matrixWorld);for(e=0;e<B;e++)j=k[e].position,Ka.copy(j),sa.multiplyVector3(Ka),r[e]=[Ka.z,e];r.sort(function(b,c){return c[0]-b[0]});for(e=0;e<B;e++)j=k[r[e][1]].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;
+for(e=0;e<T;e++)h=e*3,color=m[r[e][1]],D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(s)for(v in s){e=s[v];m=e.value.length;for(h=0;h<m;h++){index=r[h][1];T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[index];e.size===2?(e.array[T]=u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=
+u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}else{if(q)for(e=0;e<B;e++)j=k[e].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;if(n)for(e=0;e<T;e++)color=m[e],h=e*3,D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(s)for(v in s)if(e=s[v],e.__original.needsUpdate){m=e.value.length;for(h=0;h<m;h++){T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[h];e.size===2?(e.array[T]=
+u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}if(q||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(n||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(s)for(v in s)if(e=s[v],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
 e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,j){e.program||H.initMaterial(e,c,d,j);if(e.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var h=0,k=H.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=e.program,k=h.uniforms,B=e.uniforms;h!=Fa&&(f.useProgram(h),Fa=h);f.uniformMatrix4fv(k.projectionMatrix,!1,Aa);if(d&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
-e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(B.fogColor.value=d.color,d instanceof THREE.Fog)B.fogNear.value=d.near,B.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)B.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,p,E,D=0,r=0,s=0,n,u,q,w=Ta,G=w.directional.colors,K=w.directional.positions,C=w.point.colors,A=w.point.positions,y=w.point.distances,
-L=0,F=0,d=p=q=0;for(m=c.length;d<m;d++)if(p=c[d],E=p.color,n=p.position,u=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)D+=E.r,r+=E.g,s+=E.b;else if(p instanceof THREE.DirectionalLight)q=L*3,G[q]=E.r*u,G[q+1]=E.g*u,G[q+2]=E.b*u,K[q]=n.x,K[q+1]=n.y,K[q+2]=n.z,L+=1;else if(p instanceof THREE.SpotLight)q=L*3,G[q]=E.r*u,G[q+1]=E.g*u,G[q+2]=E.b*u,E=1/n.length(),K[q]=n.x*E,K[q+1]=n.y*E,K[q+2]=n.z*E,L+=1;else if(p instanceof THREE.PointLight)p=F*3,C[p]=E.r*u,C[p+1]=E.g*u,C[p+2]=E.b*u,A[p]=n.x,
-A[p+1]=n.y,A[p+2]=n.z,y[F]=q,F+=1;for(d=L*3;d<G.length;d++)G[d]=0;for(d=F*3;d<C.length;d++)C[d]=0;w.point.length=F;w.directional.length=L;w.ambient[0]=D;w.ambient[1]=r;w.ambient[2]=s;c=Ta;B.enableLighting.value=c.directional.length+c.point.length;B.ambientLightColor.value=c.ambient;B.directionalLightColor.value=c.directional.colors;B.directionalLightDirection.value=c.directional.positions;B.pointLightColor.value=c.point.colors;B.pointLightPosition.value=c.point.positions;B.pointLightDistance.value=
+e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(B.fogColor.value=d.color,d instanceof THREE.Fog)B.fogNear.value=d.near,B.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)B.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,p,E,D=0,r=0,q=0,n,u,s,w=Ta,G=w.directional.colors,K=w.directional.positions,C=w.point.colors,A=w.point.positions,y=w.point.distances,
+L=0,F=0,d=p=s=0;for(m=c.length;d<m;d++)if(p=c[d],E=p.color,n=p.position,u=p.intensity,s=p.distance,p instanceof THREE.AmbientLight)D+=E.r,r+=E.g,q+=E.b;else if(p instanceof THREE.DirectionalLight)s=L*3,G[s]=E.r*u,G[s+1]=E.g*u,G[s+2]=E.b*u,K[s]=n.x,K[s+1]=n.y,K[s+2]=n.z,L+=1;else if(p instanceof THREE.SpotLight)s=L*3,G[s]=E.r*u,G[s+1]=E.g*u,G[s+2]=E.b*u,E=1/n.length(),K[s]=n.x*E,K[s+1]=n.y*E,K[s+2]=n.z*E,L+=1;else if(p instanceof THREE.PointLight)p=F*3,C[p]=E.r*u,C[p+1]=E.g*u,C[p+2]=E.b*u,A[p]=n.x,
+A[p+1]=n.y,A[p+2]=n.z,y[F]=s,F+=1;for(d=L*3;d<G.length;d++)G[d]=0;for(d=F*3;d<C.length;d++)C[d]=0;w.point.length=F;w.directional.length=L;w.ambient[0]=D;w.ambient[1]=r;w.ambient[2]=q;c=Ta;B.enableLighting.value=c.directional.length+c.point.length;B.ambientLightColor.value=c.ambient;B.directionalLightColor.value=c.directional.colors;B.directionalLightDirection.value=c.directional.positions;B.pointLightColor.value=c.point.colors;B.pointLightPosition.value=c.point.positions;B.pointLightDistance.value=
 c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)B.diffuse.value=e.color,B.opacity.value=e.opacity,(B.map.texture=e.map)&&B.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),B.lightMap.texture=e.lightMap,B.envMap.texture=e.envMap,B.reflectivity.value=e.reflectivity,B.refractionRatio.value=e.refractionRatio,B.combine.value=e.combine,B.useRefract.value=e.envMap&&e.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)B.diffuse.value=e.color,B.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)B.psColor.value=e.color,B.opacity.value=e.opacity,B.size.value=e.size,B.scale.value=Ga.height/2,B.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)B.ambient.value=e.ambient,B.specular.value=e.specular,B.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)B.mNear.value=b.near,B.mFar.value=b.far,B.opacity.value=
 e.opacity;else if(e instanceof THREE.MeshNormalMaterial)B.opacity.value=e.opacity;if(j.receiveShadow&&!e._shadowPass&&B.shadowMatrix){for(c=0;c<La.length;c++)B.shadowMatrix.value[c]=La[c],B.shadowMap.texture[c]=H.shadowMap[c];B.shadowDarkness.value=H.shadowMapDarkness;B.shadowBias.value=H.shadowMapBias}for(var O in B)if(m=h.uniforms[O])if(d=B[O],D=d.type,c=d.value,D=="i")f.uniform1i(m,c);else if(D=="f")f.uniform1f(m,c);else if(D=="v2")f.uniform2f(m,c.x,c.y);else if(D=="v3")f.uniform3f(m,c.x,c.y,c.z);
-else if(D=="v4")f.uniform4f(m,c.x,c.y,c.z,c.w);else if(D=="c")f.uniform3f(m,c.r,c.g,c.b);else if(D=="fv1")f.uniform1fv(m,c);else if(D=="fv")f.uniform3fv(m,c);else if(D=="v3v"){if(!d._array)d._array=new Float32Array(3*c.length);D=0;for(r=c.length;D<r;D++)s=D*3,d._array[s]=c[D].x,d._array[s+1]=c[D].y,d._array[s+2]=c[D].z;f.uniform3fv(m,d._array)}else if(D=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);f.uniformMatrix4fv(m,!1,d._array)}else if(D=="m4v"){if(!d._array)d._array=
+else if(D=="v4")f.uniform4f(m,c.x,c.y,c.z,c.w);else if(D=="c")f.uniform3f(m,c.r,c.g,c.b);else if(D=="fv1")f.uniform1fv(m,c);else if(D=="fv")f.uniform3fv(m,c);else if(D=="v3v"){if(!d._array)d._array=new Float32Array(3*c.length);D=0;for(r=c.length;D<r;D++)q=D*3,d._array[q]=c[D].x,d._array[q+1]=c[D].y,d._array[q+2]=c[D].z;f.uniform3fv(m,d._array)}else if(D=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);f.uniformMatrix4fv(m,!1,d._array)}else if(D=="m4v"){if(!d._array)d._array=
 new Float32Array(16*c.length);D=0;for(r=c.length;D<r;D++)c[D].flattenToArrayOffset(d._array,D*16);f.uniformMatrix4fv(m,!1,d._array)}else if(D=="t"){if(f.uniform1i(m,c),m=d.texture)if(m.image instanceof Array&&m.image.length==6){if(d=m,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,
 f.RGBA,f.RGBA,f.UNSIGNED_BYTE,d.image[c]);M(f.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(d=m,f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.__webglTexture)):v(m,c)}else if(D=="tv"){if(!d._array){d._array=[];D=0;for(r=d.texture.length;D<r;D++)d._array[D]=c+D}f.uniform1iv(m,d._array);D=0;for(r=d.texture.length;D<r;D++)(m=d.texture[D])&&
 v(m,d._array[D])}f.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&f.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&k.cameraPosition!==null&&f.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning||j.receiveShadow)&&k.objectMatrix!==null&&f.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);
@@ -197,17 +197,17 @@ f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.
 f.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),
 f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(f.lineWidth(j.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),H.data.vertices+=h.__webglFaceCount,H.data.faces+=h.__webglFaceCount/3,H.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?
 f.LINE_STRIP:f.LINES,f.lineWidth(j.linewidth),f.drawArrays(k,0,h.__webglLineCount),H.data.drawCalls++):k instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),H.data.drawCalls++):k instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),H.data.drawCalls++)}}function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),
-f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,j,k,m,p,r,E,D,n,s=b.count*3;for(n=0;n<s;n+=9)d=b.normalArray,e=d[n],h=d[n+1],j=d[n+2],k=d[n+3],p=d[n+4],E=d[n+5],m=d[n+6],r=d[n+7],D=d[n+8],e=(e+k+m)/3,h=(h+p+r)/3,j=(j+E+D)/3,d[n]=e,d[n+1]=h,d[n+2]=j,d[n+3]=e,d[n+4]=h,d[n+5]=j,d[n+
+f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,j,k,m,p,r,E,D,n,q=b.count*3;for(n=0;n<q;n+=9)d=b.normalArray,e=d[n],h=d[n+1],j=d[n+2],k=d[n+3],p=d[n+4],E=d[n+5],m=d[n+6],r=d[n+7],D=d[n+8],e=(e+k+m)/3,h=(h+p+r)/3,j=(j+E+D)/3,d[n]=e,d[n+1]=h,d[n+2]=j,d[n+3]=e,d[n+4]=h,d[n+5]=j,d[n+
 6]=e,d[n+7]=h,d[n+8]=j}f.bufferData(f.ARRAY_BUFFER,b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),W=b.doubleSided;if($!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),$=b.flipSided}function k(b){X!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),X=b)}function m(b,
 c,d){P!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),P=b);if(b&&(ma!=c||ga!=d))f.polygonOffset(c,d),ma=c,ga=d}function r(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);
-for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ia[d].x*c.n14+ia[d].y*c.n24+ia[d].z*c.n34+ia[d].w,b<=f)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function s(b){var c,d,f=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?n(h,d):n(e,d)}function q(b){var c,
-d,f,e,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(e=j.materials[c])&&(e.transparent?n(m,e):n(k,e))}else(e=c)&&(e.transparent?n(m,e):n(k,e))}function w(b,c){return c.z-b.z}function C(b,c){var m,Sa,J,n=0,ha,B,s,q,E=b.lights;pa||(pa=new THREE.Camera(H.shadowCameraFov,c.aspect,H.shadowCameraNear,H.shadowCameraFar));m=0;for(Sa=E.length;m<Sa;m++)if(J=
+for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ia[d].x*c.n14+ia[d].y*c.n24+ia[d].z*c.n34+ia[d].w,b<=f)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function q(b){var c,d,f=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?n(h,d):n(e,d)}function s(b){var c,
+d,f,e,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(e=j.materials[c])&&(e.transparent?n(m,e):n(k,e))}else(e=c)&&(e.transparent?n(m,e):n(k,e))}function w(b,c){return c.z-b.z}function C(b,c){var m,Sa,J,n=0,ha,B,q,s,E=b.lights;pa||(pa=new THREE.Camera(H.shadowCameraFov,c.aspect,H.shadowCameraNear,H.shadowCameraFar));m=0;for(Sa=E.length;m<Sa;m++)if(J=
 E[m],J instanceof THREE.SpotLight&&J.castShadow){H.shadowMap[n]||(H.shadowMap[n]=new THREE.WebGLRenderTarget(H.shadowMapWidth,H.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));La[n]||(La[n]=new THREE.Matrix4);ha=H.shadowMap[n];B=La[n];pa.position.copy(J.position);pa.target.position.copy(J.target.position);pa.update(void 0,!0);b.update(void 0,!1,pa);B.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);B.multiplySelf(pa.projectionMatrix);B.multiplySelf(pa.matrixWorldInverse);
-pa.matrixWorldInverse.flattenToArray(Ca);pa.projectionMatrix.flattenToArray(Aa);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);r(sa);H.initWebGLObjects(b);U(ha);f.clearColor(1,1,1,1);H.clear();f.clearColor(wa.r,wa.g,wa.b,Ia);B=b.__webglObjects.length;J=b.__webglObjectsImmediate.length;for(ha=0;ha<B;ha++)s=b.__webglObjects[ha],q=s.object,q.visible&&q.castShadow?!(q instanceof THREE.Mesh)||p(q)?(q.matrixWorld.flattenToArray(q._objectMatrixArray),F(q,pa,!1),s.render=!0):s.render=!1:s.render=
-!1;k(!0);R(THREE.NormalBlending);for(ha=0;ha<B;ha++)if(s=b.__webglObjects[ha],s.render)q=s.object,buffer=s.buffer,h(q),s=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?Ua:Qa,e(pa,E,null,s,buffer,q);for(ha=0;ha<J;ha++)s=b.__webglObjectsImmediate[ha],q=s.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),F(q,pa,!1),h(q),program=d(pa,E,null,Qa,q),q.render(function(b){j(b,program,Qa.shading)}));n++}}function y(b,c){var d,
-e,h;d=u.attributes;var j=u.uniforms,k=Ea/Da,m,p=[],n=Da*0.5,q=Ea*0.5,D=!0;f.useProgram(u.program);Fa=u.program;X=I=-1;Va||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),Va=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(j.projectionMatrix,
+pa.matrixWorldInverse.flattenToArray(Ca);pa.projectionMatrix.flattenToArray(Aa);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);r(sa);H.initWebGLObjects(b);U(ha);f.clearColor(1,1,1,1);H.clear();f.clearColor(wa.r,wa.g,wa.b,Ia);B=b.__webglObjects.length;J=b.__webglObjectsImmediate.length;for(ha=0;ha<B;ha++)q=b.__webglObjects[ha],s=q.object,s.visible&&s.castShadow?!(s instanceof THREE.Mesh)||!s.frustumCulled||p(s)?(s.matrixWorld.flattenToArray(s._objectMatrixArray),F(s,pa,!1),q.render=!0):q.render=
+!1:q.render=!1;k(!0);R(THREE.NormalBlending);for(ha=0;ha<B;ha++)if(q=b.__webglObjects[ha],q.render)s=q.object,buffer=q.buffer,h(s),q=s.customDepthMaterial?s.customDepthMaterial:s.geometry.morphTargets.length?Ua:Qa,e(pa,E,null,q,buffer,s);for(ha=0;ha<J;ha++)q=b.__webglObjectsImmediate[ha],s=q.object,s.visible&&s.castShadow&&(s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray),F(s,pa,!1),h(s),program=d(pa,E,null,Qa,s),s.render(function(b){j(b,program,Qa.shading)}));n++}}function y(b,
+c){var d,e,h;d=u.attributes;var j=u.uniforms,k=Ea/Da,m,p=[],n=Da*0.5,s=Ea*0.5,D=!0;f.useProgram(u.program);Fa=u.program;X=I=-1;Va||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),Va=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(j.projectionMatrix,
 !1,Aa);f.activeTexture(f.TEXTURE0);f.uniform1i(j.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(j.useScreenCoordinates,1),f.uniform3f(j.screenPosition,
-(h.position.x-n)/n,(q-h.position.y)/q,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(j.useScreenCoordinates,0),f.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Ea:1),p[0]=m*k*h.scale.x,p[1]=m*h.scale.y,f.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(j.alignment,h.alignment.x,h.alignment.y),f.uniform1f(j.opacity,h.opacity),
+(h.position.x-n)/n,(s-h.position.y)/s,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(j.useScreenCoordinates,0),f.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Ea:1),p[0]=m*k*h.scale.x,p[1]=m*h.scale.y,f.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(j.alignment,h.alignment.x,h.alignment.y),f.uniform1f(j.opacity,h.opacity),
 f.uniform1f(j.rotation,h.rotation),f.uniform2fv(j.scale,p),h.mergeWith3D&&!D?(f.enable(f.DEPTH_TEST),D=!0):!h.mergeWith3D&&D&&(f.disable(f.DEPTH_TEST),D=!1),R(h.blending),v(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(va)}function F(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function L(b){var c,
 d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function ya(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ka(b){function c(b){var e=[];d=0;for(f=b.length;d<f;d++)b[d]==void 0?e.push("undefined"):e.push(b[d].id);return e.join("_")}
 var d,f,e,h,j,k,m,p,n={},D=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)j=b.faces[e],k=j.materials,m=c(k),n[m]==void 0&&(n[m]={hash:m,counter:0}),p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:D}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
@@ -234,18 +234,18 @@ d,e){Q=b;za=c;Da=d;Ea=e;f.viewport(Q,za,Da,Ea)};this.setScissor=function(b,c,d,e
 this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);
 f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d])}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);
 else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,c,d,e){var h,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
-THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,n,q;p=q=m=0;for(n=c.length;p<n;p++)j=c[p],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&
-q++,j instanceof THREE.PointLight&&m++;m+q<=_maxLights?p=q:(p=Math.ceil(_maxLights*q/(m+q)),m=_maxLights-p);j={directional:p,point:m};m=q=0;for(p=c.length;m<p;m++)n=c[m],n instanceof THREE.SpotLight&&n.castShadow&&q++;var D=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)D=e.bones.length;var r;a:{p=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,
-morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:D,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},s,e=[];k?e.push(k):(e.push(p),e.push(n));for(s in d)e.push(s),e.push(d[s]);k=e.join();s=0;for(e=ua.length;s<e;s++)if(ua[s].code==k){r=ua[s].program;break a}s=f.createProgram();e=
+THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,n,s;p=s=m=0;for(n=c.length;p<n;p++)j=c[p],j instanceof THREE.SpotLight&&s++,j instanceof THREE.DirectionalLight&&
+s++,j instanceof THREE.PointLight&&m++;m+s<=_maxLights?p=s:(p=Math.ceil(_maxLights*s/(m+s)),m=_maxLights-p);j={directional:p,point:m};m=s=0;for(p=c.length;m<p;m++)n=c[m],n instanceof THREE.SpotLight&&n.castShadow&&s++;var D=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)D=e.bones.length;var r;a:{p=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,
+morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:D,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:s,alphaTest:b.alphaTest},q,e=[];k?e.push(k):(e.push(p),e.push(n));for(q in d)e.push(q),e.push(d[q]);k=e.join();q=0;for(e=ua.length;q<e;q++)if(ua[q].code==k){r=ua[q].program;break a}q=f.createProgram();e=
 [Xa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?
 "#define USE_SIZEATTENUATION":"","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 vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(s,Z("fragment",j+p));f.attachShader(s,Z("vertex",e+n));f.linkProgram(s);f.getProgramParameter(s,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(s,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");s.uniforms=
-{};s.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in m)e.push(u);u=e;e=0;for(m=u.length;e<m;e++)p=u[e],s.uniforms[p]=f.getUniformLocation(s,p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(r in c)e.push(r);r=e;u=0;for(c=r.length;u<c;u++)d=
-r[u],s.attributes[d]=f.getAttribLocation(s,d);ua.push({program:s,code:k});r=s}b.program=r;r=b.program.attributes;r.position>=0&&f.enableVertexAttribArray(r.position);r.color>=0&&f.enableVertexAttribArray(r.color);r.normal>=0&&f.enableVertexAttribArray(r.normal);r.tangent>=0&&f.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(f.enableVertexAttribArray(r.skinVertexA),f.enableVertexAttribArray(r.skinVertexB),f.enableVertexAttribArray(r.skinIndex),
+"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(q,Z("fragment",j+p));f.attachShader(q,Z("vertex",e+n));f.linkProgram(q);f.getProgramParameter(q,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(q,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");q.uniforms=
+{};q.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in m)e.push(u);u=e;e=0;for(m=u.length;e<m;e++)p=u[e],q.uniforms[p]=f.getUniformLocation(q,p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(r in c)e.push(r);r=e;u=0;for(c=r.length;u<c;u++)d=
+r[u],q.attributes[d]=f.getAttribLocation(q,d);ua.push({program:q,code:k});r=q}b.program=r;r=b.program.attributes;r.position>=0&&f.enableVertexAttribArray(r.position);r.color>=0&&f.enableVertexAttribArray(r.color);r.normal>=0&&f.enableVertexAttribArray(r.normal);r.tangent>=0&&f.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(f.enableVertexAttribArray(r.skinVertexA),f.enableVertexAttribArray(r.skinVertexB),f.enableVertexAttribArray(r.skinIndex),
 f.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&f.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,r[u]>=0&&(f.enableVertexAttribArray(r[u]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,e){U(b);b=0;c&&(b|=f.COLOR_BUFFER_BIT);d&&(b|=f.DEPTH_BUFFER_BIT);e&&(b|=f.STENCIL_BUFFER_BIT);f.clear(b)};this.render=function(b,c,f,n){var J,u,ha,B,v,T,E,D,L=b.lights,
-Pa=b.fog;this.shadowMapEnabled&&C(b,c);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ca);c.projectionMatrix.flattenToArray(Aa);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);r(sa);this.initWebGLObjects(b);U(f);(this.autoClear||n)&&this.clear();v=b.__webglObjects.length;for(n=0;n<v;n++)if(J=b.__webglObjects[n],E=J.object,E.visible)if(!(E instanceof THREE.Mesh)||p(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),
-F(E,c,!0),q(J),J.render=!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(Ka.copy(E.position),sa.multiplyVector3(Ka),J.z=Ka.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(w);T=b.__webglObjectsImmediate.length;for(n=0;n<T;n++)J=b.__webglObjectsImmediate[n],E=J.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),s(J));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(n=
+Pa=b.fog;this.shadowMapEnabled&&C(b,c);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ca);c.projectionMatrix.flattenToArray(Aa);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);r(sa);this.initWebGLObjects(b);U(f);(this.autoClear||n)&&this.clear();v=b.__webglObjects.length;for(n=0;n<v;n++)if(J=b.__webglObjects[n],E=J.object,E.visible)if(!(E instanceof THREE.Mesh)||!E.frustumCulled||p(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),
+F(E,c,!0),s(J),J.render=!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(Ka.copy(E.position),sa.multiplyVector3(Ka),J.z=Ka.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(w);T=b.__webglObjectsImmediate.length;for(n=0;n<T;n++)J=b.__webglObjectsImmediate[n],E=J.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),q(J));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(n=
 0;n<v;n++)if(J=b.__webglObjects[n],J.render)E=J.object,D=J.buffer,h(E),e(c,L,Pa,b.overrideMaterial,D,E);for(n=0;n<T;n++)J=b.__webglObjectsImmediate[n],E=J.object,E.visible&&(h(E),u=d(c,L,Pa,b.overrideMaterial,E),E.render(function(c){j(c,u,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);for(n=v-1;n>=0;n--)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.opaque;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),
 e(c,L,Pa,B,D,E)}for(n=0;n<T;n++)if(J=b.__webglObjectsImmediate[n],E=J.object,E.visible){ha=J.opaque;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),u=d(c,L,Pa,B,E),E.render(function(b){j(b,u,B.shading)})}for(n=0;n<v;n++)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.transparent;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],R(B.blending),k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),e(c,L,
 Pa,B,D,E)}for(n=0;n<T;n++)if(J=b.__webglObjectsImmediate[n],E=J.object,E.visible){ha=J.transparent;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],R(B.blending),k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),u=d(c,L,Pa,B,E),E.render(function(b){j(b,u,B.shading)})}}b.__webglSprites.length&&y(b,c);f&&f.minFilter!==THREE.NearestFilter&&f.minFilter!==THREE.LinearFilter&&N(f)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],

+ 2 - 0
examples/webgl_performance.html

@@ -70,6 +70,8 @@
 						mesh.matrixAutoUpdate = false;
 						mesh.updateMatrix();
 
+						//mesh.frustumCulled = false;
+
 						scene.addObject( mesh );
 
 					}

+ 2 - 0
src/core/Object3D.js

@@ -45,6 +45,8 @@ THREE.Object3D = function() {
 	this.castShadow = false;
 	this.receiveShadow = false;
 
+	this.frustumCulled = true;
+
 	this._vector = new THREE.Vector3();
 
 	this.name = "";

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -3464,7 +3464,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					if ( object.visible && object.castShadow ) {
 
-						if ( ! ( object instanceof THREE.Mesh ) || isInFrustum( object ) ) {
+						if ( ! ( object instanceof THREE.Mesh ) || ! ( object.frustumCulled ) || isInFrustum( object ) ) {
 
 							object.matrixWorld.flattenToArray( object._objectMatrixArray );
 
@@ -3615,7 +3615,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( object.visible ) {
 
-				if ( ! ( object instanceof THREE.Mesh ) || isInFrustum( object ) ) {
+				if ( ! ( object instanceof THREE.Mesh ) || ! ( object.frustumCulled ) || isInFrustum( object ) ) {
 
 					object.matrixWorld.flattenToArray( object._objectMatrixArray );