Browse Source

More strict equality checking.

Just for the sake of consistency, when object properties are not involved performance difference is negligible.
alteredq 14 years ago
parent
commit
f166079dcc
3 changed files with 144 additions and 144 deletions
  1. 65 65
      build/Three.js
  2. 28 28
      build/custom/ThreeWebGL.js
  3. 51 51
      src/renderers/WebGLRenderer.js

+ 65 - 65
build/Three.js

@@ -232,67 +232,67 @@ l;e++)f=h[e].position,za.copy(f),sa.multiplyVector3(za),u[e]=[za.z,e];u.sort(fun
 l.value[index];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}else{if(v)for(e=0;e<l;e++)f=h[e].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;if(G)for(e=0;e<p;e++)color=n[e],k=e*3,o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate){p=
 l.value.length;for(n=0;n<p;n++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=l.value[n];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}if(v||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),
 m.bufferData(m.ARRAY_BUFFER,t,c);if(G||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,o,c);if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,l.buffer),m.bufferData(m.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||S.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var f=0,h=S.maxMorphTargets;f<
-h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!=U&&(m.useProgram(f),U=f,l=!0);if(e.id!=da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
+h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!==U&&(m.useProgram(f),U=f,l=!0);if(e.id!==da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
 $=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,I=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
 THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=I*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[I]=x,I+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=I*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=I;y.directional.length=
 B;y.ambient[0]=o;y.ambient[1]=u;y.ambient[2]=v;c=Fa;n.enableLighting.value=c.directional.length+c.point.length;n.ambientLightColor.value=c.ambient;n.directionalLightColor.value=c.directional.colors;n.directionalLightDirection.value=c.directional.positions;n.pointLightColor.value=c.point.colors;n.pointLightPosition.value=c.point.positions;n.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
 e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
 if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=xa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
 THREE.MeshLambertMaterial)S.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(c=0;c<ka.length;c++)n.shadowMatrix.value[c]=ka[c],n.shadowMap.texture[c]=S.shadowMap[c];n.shadowDarkness.value=S.shadowMapDarkness;n.shadowBias.value=S.shadowMapBias}c=
-e.uniformsList;n=0;for(b=c.length;n<b;n++)if(u=f.uniforms[c[n][1]])if(o=c[n][0],v=o.type,l=o.value,v=="i")m.uniform1i(u,l);else if(v=="f")m.uniform1f(u,l);else if(v=="v2")m.uniform2f(u,l.x,l.y);else if(v=="v3")m.uniform3f(u,l.x,l.y,l.z);else if(v=="v4")m.uniform4f(u,l.x,l.y,l.z,l.w);else if(v=="c")m.uniform3f(u,l.r,l.g,l.b);else if(v=="fv1")m.uniform1fv(u,l);else if(v=="fv")m.uniform3fv(u,l);else if(v=="v3v"){if(!o._array)o._array=new Float32Array(3*l.length);v=0;for(G=l.length;v<G;v++)y=v*3,o._array[y]=
-l[v].x,o._array[y+1]=l[v].y,o._array[y+2]=l[v].z;m.uniform3fv(u,o._array)}else if(v=="m4"){if(!o._array)o._array=new Float32Array(16);l.flattenToArray(o._array);m.uniformMatrix4fv(u,!1,o._array)}else if(v=="m4v"){if(!o._array)o._array=new Float32Array(16*l.length);v=0;for(G=l.length;v<G;v++)l[v].flattenToArrayOffset(o._array,v*16);m.uniformMatrix4fv(u,!1,o._array)}else if(v=="t"){if(m.uniform1i(u,l),u=o.texture)if(u.image instanceof Array&&u.image.length==6){if(o=u,o.image.length==6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=
-m.createTexture();m.activeTexture(m.TEXTURE0+l);m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(l=0;l<6;l++)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,o.image[l]);M(m.TEXTURE_CUBE_MAP,o,o.image[0]);o.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube?(o=u,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.__webglTexture)):E(u,l)}else if(v==
-"tv"){if(!o._array){o._array=[];v=0;for(G=o.texture.length;v<G;v++)o._array[v]=l+v}m.uniform1iv(u,o._array);v=0;for(G=o.texture.length;v<G;v++)(u=o.texture[v])&&E(u,o._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&m.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&
-m.uniformMatrix4fv(h.viewMatrix,!1,Ea);e.skinning&&(m.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ea),m.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}m.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&m.uniformMatrix4fv(h.objectMatrix,!1,k._objectMatrixArray);return f}function f(a,c,b,k,f,h){if(k.opacity!=
-0){var l,n,b=e(a,c,b,k,h),a=b.attributes,c=!1,b=f.id*16777215+b.id*2+(k.wireframe?1:0);b!=ia&&(ia=b,c=!0);if(!k.morphTargets&&a.position>=0)c&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0)):b.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),
-m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<p.length;)m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[p[l]],l++}else{var p=[],t=-1,o=0;n=h.morphTargetInfluences;var v,u=n.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(v=
-0;v<u;v++)!p[v]&&n[v]>t&&(o=v,t=n[o]);m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(n=f.__webglCustomAttributesList.length;l<n;l++)b=f.__webglCustomAttributesList[l],a[b.buffer.belongsToAttribute]>=
-0&&(m.bindBuffer(m.ARRAY_BUFFER,b.buffer),m.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,m.FLOAT,!1,0,0))}a.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglColorBuffer),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0));a.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglNormalBuffer),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));a.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglTangentBuffer),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,
-f.__webglUVBuffer),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUV2Buffer),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv2)):m.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexABuffer),m.vertexAttribPointer(a.skinVertexA,4,
-m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),m.vertexAttribPointer(a.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(m.lineWidth(k.wireframeLinewidth),c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),m.drawElements(m.LINES,f.__webglLineCount,
-m.UNSIGNED_SHORT,0)):(c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),m.drawElements(m.TRIANGLES,f.__webglFaceCount,m.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(k.linewidth),m.drawArrays(h,0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,f.__webglParticleCount),S.info.render.calls++):
-h instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=m.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=m.createBuffer();a.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,
-a.__webglNormalBuffer);if(b==THREE.FlatShading){var e,f,k,h,l,n,p,t,o,v,u=a.count*3;for(v=0;v<u;v+=9)b=a.normalArray,e=b[v],f=b[v+1],k=b[v+2],h=b[v+3],n=b[v+4],t=b[v+5],l=b[v+6],p=b[v+7],o=b[v+8],e=(e+h+l)/3,f=(f+n+p)/3,k=(k+t+o)/3,b[v]=e,b[v+1]=f,b[v+2]=k,b[v+3]=e,b[v+4]=f,b[v+5]=k,b[v+6]=e,b[v+7]=f,b[v+8]=k}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,
-0,a.count);a.count=0}function k(a){if(ja!==a.doubleSided)a.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),ja=a.doubleSided;if(ca!==a.flipSided)a.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ca=a.flipSided}function l(a){R!=a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),R=a)}function n(a){Y!=a&&(m.depthMask(a),Y=a)}function p(a,c,b){X!=a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),X=a);if(a&&(ga!=c||oa!=b))m.polygonOffset(c,b),ga=c,oa=b}function u(a){ua[0].set(a.n41-
-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
-Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=
-c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=-1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,
-I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,
-G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),
-m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!=0)f.useScreenCoordinates?
-f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,
-0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),
-f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)if(e.attributes[f].needsUpdate)return!0;
-return!1}function C(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)e.attributes[f].needsUpdate=!1}function B(a,c){var b;for(b=a.length-1;b>=0;b--)a[b].object==c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!=Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);
-m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)==0&&(b.height&b.height-1)==0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,
-m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,
-a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
-m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);
-M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),
-a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);
-m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!=ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),
-m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a=="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a=="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}
-function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}
-var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
-!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),
-Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,
-0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=
--1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,
-W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=
-m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");
-W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?
-m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};this.clear=function(a,c,b){var e=0;if(a==void 0||a)e|=m.COLOR_BUFFER_BIT;if(c==void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b==void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=
-function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);
-m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof
-THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
-a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof
-THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;
-for(e=aa.length;w<e;w++)if(aa[w].code==l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":
-"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.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");
+e.uniformsList;n=0;for(b=c.length;n<b;n++)if(u=f.uniforms[c[n][1]])if(o=c[n][0],v=o.type,l=o.value,v==="i")m.uniform1i(u,l);else if(v==="f")m.uniform1f(u,l);else if(v==="v2")m.uniform2f(u,l.x,l.y);else if(v==="v3")m.uniform3f(u,l.x,l.y,l.z);else if(v==="v4")m.uniform4f(u,l.x,l.y,l.z,l.w);else if(v==="c")m.uniform3f(u,l.r,l.g,l.b);else if(v==="fv1")m.uniform1fv(u,l);else if(v==="fv")m.uniform3fv(u,l);else if(v==="v3v"){if(!o._array)o._array=new Float32Array(3*l.length);v=0;for(G=l.length;v<G;v++)y=
+v*3,o._array[y]=l[v].x,o._array[y+1]=l[v].y,o._array[y+2]=l[v].z;m.uniform3fv(u,o._array)}else if(v==="m4"){if(!o._array)o._array=new Float32Array(16);l.flattenToArray(o._array);m.uniformMatrix4fv(u,!1,o._array)}else if(v==="m4v"){if(!o._array)o._array=new Float32Array(16*l.length);v=0;for(G=l.length;v<G;v++)l[v].flattenToArrayOffset(o._array,v*16);m.uniformMatrix4fv(u,!1,o._array)}else if(v==="t"){if(m.uniform1i(u,l),u=o.texture)if(u.image instanceof Array&&u.image.length===6){if(o=u,o.image.length===
+6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=m.createTexture();m.activeTexture(m.TEXTURE0+l);m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(l=0;l<6;l++)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,o.image[l]);M(m.TEXTURE_CUBE_MAP,o,o.image[0]);o.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube?(o=u,m.activeTexture(m.TEXTURE0+
+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.__webglTexture)):E(u,l)}else if(v==="tv"){if(!o._array){o._array=[];v=0;for(G=o.texture.length;v<G;v++)o._array[v]=l+v}m.uniform1iv(u,o._array);v=0;for(G=o.texture.length;v<G;v++)(u=o.texture[v])&&E(u,o._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&m.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
+e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&m.uniformMatrix4fv(h.viewMatrix,!1,Ea);e.skinning&&(m.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ea),m.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}m.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&m.uniformMatrix4fv(h.objectMatrix,
+!1,k._objectMatrixArray);return f}function f(a,c,b,k,f,h){if(k.opacity!==0){var l,n,b=e(a,c,b,k,h),a=b.attributes,c=!1,b=f.id*16777215+b.id*2+(k.wireframe?1:0);b!==ia&&(ia=b,c=!0);if(!k.morphTargets&&a.position>=0)c&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),m.vertexAttribPointer(b.position,
+3,m.FLOAT,!1,0,0)):b.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<p.length;)m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[p[l]],l++}else{var p=[],t=-1,o=0;n=h.morphTargetInfluences;var v,
+u=n.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(v=0;v<u;v++)!p[v]&&n[v]>t&&(o=v,t=n[o]);m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(n=
+f.__webglCustomAttributesList.length;l<n;l++)b=f.__webglCustomAttributesList[l],a[b.buffer.belongsToAttribute]>=0&&(m.bindBuffer(m.ARRAY_BUFFER,b.buffer),m.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,m.FLOAT,!1,0,0))}a.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglColorBuffer),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0));a.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglNormalBuffer),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));a.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,
+f.__webglTangentBuffer),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUVBuffer),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUV2Buffer),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv2)):m.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
+0&&a.skinIndex>=0&&a.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexABuffer),m.vertexAttribPointer(a.skinVertexA,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),m.vertexAttribPointer(a.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?
+(m.lineWidth(k.wireframeLinewidth),c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),m.drawElements(m.LINES,f.__webglLineCount,m.UNSIGNED_SHORT,0)):(c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),m.drawElements(m.TRIANGLES,f.__webglFaceCount,m.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(k.linewidth),m.drawArrays(h,
+0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,f.__webglParticleCount),S.info.render.calls++):h instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=m.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=m.createBuffer();a.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,
+m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(b===THREE.FlatShading){var e,f,k,h,l,n,p,t,o,v,u=a.count*3;for(v=0;v<u;v+=9)b=a.normalArray,e=b[v],f=b[v+1],k=b[v+2],h=b[v+3],n=b[v+4],t=b[v+5],l=b[v+6],p=b[v+7],o=b[v+8],e=(e+h+l)/3,f=(f+n+p)/3,k=(k+t+o)/3,b[v]=e,b[v+1]=f,b[v+2]=k,b[v+3]=e,b[v+4]=f,b[v+5]=k,b[v+6]=e,b[v+7]=f,b[v+8]=k}m.bufferData(m.ARRAY_BUFFER,
+a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,0,a.count);a.count=0}function k(a){if(ja!==a.doubleSided)a.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),ja=a.doubleSided;if(ca!==a.flipSided)a.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ca=a.flipSided}function l(a){R!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),R=a)}function n(a){Y!==a&&(m.depthMask(a),Y=a)}function p(a,
+c,b){X!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),X=a);if(a&&(ga!==c||oa!==b))m.polygonOffset(c,b),ga=c,oa=b}function u(a){ua[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);
+for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=
+b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=
+-1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);
+pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);
+for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));
+p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);
+m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&
+(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),
+m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
+a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)if(e.attributes[f].needsUpdate)return!0;return!1}function C(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)e.attributes[f].needsUpdate=!1}function B(a,c){var b;for(b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}
+function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-
+1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,
+a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),
+null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,
+a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,
+c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,
+m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;
+case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;
+case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),
+Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?
+a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=
+!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=
+m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=
+3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms=
+{};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,
+"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,
+c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=
+function(){return N};this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];
+m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<
+e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),
+S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof
+THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&
+o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+
+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.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");
 h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
 "",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(w,P("fragment",h+p));m.attachShader(w,
 P("vertex",e+t));m.linkProgram(w);m.getProgramParameter(w,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(w,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");w.uniforms={};w.attributes={};var G,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(G in n)e.push(G);G=e;e=0;for(n=G.length;e<n;e++)p=G[e],w.uniforms[p]=m.getUniformLocation(w,
@@ -304,20 +304,20 @@ B.z=B.object.renderDepth:(za.copy(I.position),sa.multiplyVector3(za),B.z=za.z)}e
 k(I),f(c,E,na,a.overrideMaterial,K,I);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,k(I),ma=e(c,E,na,a.overrideMaterial,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K,
 I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
 f(c,E,na,$,K,I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&H(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups==void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
-v=t=void 0,u=void 0,G={},w=l.morphTargets!==void 0?l.morphTargets.length:0;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]==void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
+v=t=void 0,u=void 0,G={},w=l.morphTargets!==void 0?l.morphTargets.length:0;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]===void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]=
 {faces:[],materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer=
 m.createBuffer();n.__webglUV2Buffer=m.createBuffer();n.__webglSkinVertexABuffer=m.createBuffer();n.__webglSkinVertexBBuffer=m.createBuffer();n.__webglSkinIndicesBuffer=m.createBuffer();n.__webglSkinWeightsBuffer=m.createBuffer();n.__webglFaceBuffer=m.createBuffer();n.__webglLineBuffer=m.createBuffer();if(n.numMorphTargets){o=p=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(o=n.numMorphTargets;p<o;p++)n.__webglMorphTargetsBuffers.push(m.createBuffer())}S.info.memory.geometries++;for(var o=e,x=t=G=
-void 0,v=x=w=x=void 0,u=v=n=0,y=t=void 0,ma=void 0,t=p=w=G=void 0,w=o.geometry,y=w.faces,ma=l.faces,G=0,t=ma.length;G<t;G++)x=ma[G],x=y[x],x instanceof THREE.Face3?(n+=3,v+=1,u+=3):x instanceof THREE.Face4&&(n+=4,v+=2,u+=4);G=b(o,l);t=G.map||G.lightMap||G instanceof THREE.ShaderMaterial?!0:!1;ma=G instanceof THREE.MeshBasicMaterial&&!G.envMap||G instanceof THREE.MeshDepthMaterial?!1:G&&G.shading!=void 0&&G.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;y=G.vertexColors?G.vertexColors:
+void 0,v=x=w=x=void 0,u=v=n=0,y=t=void 0,ma=void 0,t=p=w=G=void 0,w=o.geometry,y=w.faces,ma=l.faces,G=0,t=ma.length;G<t;G++)x=ma[G],x=y[x],x instanceof THREE.Face3?(n+=3,v+=1,u+=3):x instanceof THREE.Face4&&(n+=4,v+=2,u+=4);G=b(o,l);t=G.map||G.lightMap||G instanceof THREE.ShaderMaterial?!0:!1;ma=G instanceof THREE.MeshBasicMaterial&&!G.envMap||G instanceof THREE.MeshDepthMaterial?!1:G&&G.shading!==void 0&&G.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;y=G.vertexColors?G.vertexColors:
 !1;l.__vertexArray=new Float32Array(n*3);if(ma)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(y)l.__colorArray=new Float32Array(n*3);if(t){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*
-4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(x=l.numMorphTargets;w<x;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ma==THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=y;l.__normalType=ma;l.__webglFaceCount=v*3;l.__webglLineCount=u*2;if(G.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
+4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(x=l.numMorphTargets;w<x;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ma===THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=y;l.__normalType=ma;l.__webglFaceCount=v*3;l.__webglLineCount=u*2;if(G.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
 [];o=void 0;for(o in G.attributes){t=G.attributes[o];w={};for(p in t)w[p]=t[p];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,v=1,w.type==="v2"?v=2:w.type==="v3"?v=3:w.type==="v4"?v=4:w.type==="c"&&(v=3),w.size=v,w.array=new Float32Array(n*v),w.buffer=m.createBuffer(),w.buffer.belongsToAttribute=o,t.needsUpdate=!0,w.__original=t;l.__webglCustomAttributesList.push(w)}}l.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=
 !0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),
 l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=m.createBuffer();l.__webglColorBuffer=m.createBuffer();S.info.geometries++;l=h;p=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=new Float32Array(n*
 3);l.__sortArray=[];l.__webglParticleCount=n;p=p.material;if(p.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];o=void 0;for(o in p.attributes){originalAttribute=p.attributes[o];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
 attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
 e instanceof THREE.ParticleSystem?(h=e.geometry,K(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)B(f.__webglObjects,
-e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,o=l=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(l=k.geometryGroupsList[n],o=z(l,h),k.__dirtyVertices||k.__dirtyMorphTargets||
+e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]===k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,o=l=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(l=k.geometryGroupsList[n],o=z(l,h),k.__dirtyVertices||k.__dirtyMorphTargets||
 k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||o)if(o=l,v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,I=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,H=void 0,F=void 0,fa=void 0,ta=void 0,N=I=O=I=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=I=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,aa=o.__tangentArray,
 da=o.__colorArray,ga=o.__skinVertexAArray,ea=o.__skinVertexBArray,Z=o.__skinIndexArray,ca=o.__skinWeightArray,ja=o.__morphTargetsArrays,oa=o.__webglCustomAttributesList,D=void 0,Ca=o.__faceArray,va=o.__lineArray,Ba=o.__needsSmoothNormals,y=o.__vertexColorType,t=o.__uvType,ma=o.__normalType,sa=h.geometry,Da=sa.__dirtyVertices,Ea=sa.__dirtyElements,za=sa.__dirtyUvs,Fa=sa.__dirtyNormals,xa=sa.__dirtyTangents,Ga=sa.__dirtyColors,Ta=sa.__dirtyMorphTargets,Pa=sa.vertices,bb=o.faces,eb=sa.faces,cb=sa.faceVertexUvs[0],
 db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],I=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=I.vertexNormals,A=I.normal,E=I.vertexColors,na=I.color,O=I.vertexTangents,I instanceof THREE.Face3){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+
@@ -325,16 +325,16 @@ db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices
 void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=D.value[I.c]):D.boundTo==="faces"?(fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,D.array[J+6]=fa.r,D.array[J+
 7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,
 fa=Ia[N].vertices[I.c].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[I.a],
-L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length==3&&y==THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,
-da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length==3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,
+L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,
+da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,
 ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(I instanceof THREE.Face4){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ta=Pa[I.d].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,
 D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c],D.array[J+3]=D.value[I.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=
 D.value[I.c],ta=D.value[I.d]):D.boundTo==="faces"?(ta=fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,D.array[J+6]=fa.r,
 D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=
 fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,ta=Ia[N].vertices[I.d].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],D=Ja[I.d],ca[Q]=N.x,ca[Q+1]=N.y,
 ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],D=Sa[I.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],D=Qa[I.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,
-ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length==4&&y==THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+
-5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length==4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=
+ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+
+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=
 3;if(za&&x!==void 0&&t)for(N=0;N<4;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<4;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+3,Ca[la+3]=R+1,Ca[la+4]=R+2,Ca[la+5]=R+3,la+=6,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+3,va[W+4]=R+1,va[W+5]=R+2,va[W+6]=R+2,va[W+7]=R+3,W+=8,R+=4)}Da&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,ka,v));if(oa){N=0;for(L=oa.length;N<L;N++)D=oa[N],D.__original.needsUpdate&&(m.bindBuffer(m.ARRAY_BUFFER,
 D.buffer),m.bufferData(m.ARRAY_BUFFER,D.array,v))}if(Ta){N=0;for(L=Ia.length;N<L;N++)m.bindBuffer(m.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[N]),m.bufferData(m.ARRAY_BUFFER,ja[N],v)}Ga&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER,
 o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),
@@ -342,7 +342,7 @@ m.bufferData(m.ARRAY_BUFFER,ea,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinIndic
 !1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(l,h)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)G=w[u].position,n=u*3,y[n]=G.x,y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,
 y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)G=w[u].position,n=u*3,y[n]=G.x,
 y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,o=z(k,h),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||o)&&c(k,m.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,C(k,
-h)};this.setFaceCulling=function(a,c){a?(!c||c=="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),a=="back"?m.cullFace(m.BACK):a=="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
+h)};this.setFaceCulling=function(a,c){a?(!c||c==="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),a==="back"?m.cullFace(m.BACK):a==="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 28 - 28
build/custom/ThreeWebGL.js

@@ -184,47 +184,47 @@ u;e++)h=i[e].position,Ja.copy(h),Da.multiplyVector3(Ja),m[e]=[Ja.z,e];m.sort(fun
 u.value[index];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(o)for(e=0;e<q;e++)color=v[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate){q=
 u.value.length;for(v=0;v<q;v++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[v]}else{if(u.boundTo===void 0||u.boundTo==="vertices")l=u.value[v];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
 d.bufferData(d.ARRAY_BUFFER,j,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||G.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,i=G.maxMorphTargets;f<
-i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,v=e.uniforms;f!=Wa&&(d.useProgram(f),Wa=f,u=!0);if(e.id!=J)J=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(v.fogColor.value=c.color,c instanceof THREE.Fog)v.fogNear.value=c.near,v.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)v.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,m=0,P=0,o,p,l,t=Ya,y=t.directional.colors,
+i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,v=e.uniforms;f!==Wa&&(d.useProgram(f),Wa=f,u=!0);if(e.id!==J)J=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(v.fogColor.value=c.color,c instanceof THREE.Fog)v.fogNear.value=c.near,v.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)v.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,m=0,P=0,o,p,l,t=Ya,y=t.directional.colors,
 r=t.directional.positions,A=t.point.colors,C=t.point.positions,B=t.point.distances,E=0,H=0,c=q=l=0,u=b.length;c<u;c++)if(q=b[c],j=q.color,o=q.position,p=q.intensity,l=q.distance,q instanceof THREE.AmbientLight)G.gammaInput?(k+=j.r*j.r,m+=j.g*j.g,P+=j.b*j.b):(k+=j.r,m+=j.g,P+=j.b);else if(q instanceof THREE.DirectionalLight)l=E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),r[l]=o.x,r[l+1]=o.y,r[l+2]=o.z,E+=1;else if(q instanceof THREE.SpotLight)l=
 E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),j=1/o.length(),r[l]=o.x*j,r[l+1]=o.y*j,r[l+2]=o.z*j,E+=1;else if(q instanceof THREE.PointLight)q=H*3,G.gammaInput?(A[q]=j.r*j.r*p*p,A[q+1]=j.g*j.g*p*p,A[q+2]=j.b*j.b*p*p):(A[q]=j.r*p,A[q+1]=j.g*p,A[q+2]=j.b*p),C[q]=o.x,C[q+1]=o.y,C[q+2]=o.z,B[H]=l,H+=1;c=E*3;for(u=y.length;c<u;c++)y[c]=0;c=H*3;for(u=A.length;c<u;c++)A[c]=0;t.point.length=H;t.directional.length=E;t.ambient[0]=k;t.ambient[1]=
 m;t.ambient[2]=P;b=Ya;v.enableLighting.value=b.directional.length+b.point.length;v.ambientLightColor.value=b.ambient;v.directionalLightColor.value=b.directional.colors;v.directionalLightDirection.value=b.directional.positions;v.pointLightColor.value=b.point.colors;v.pointLightPosition.value=b.point.positions;v.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)v.opacity.value=e.opacity,G.gammaInput?
 v.diffuse.value.copyGammaToLinear(e.color):v.diffuse.value=e.color,(v.map.texture=e.map)&&v.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),v.lightMap.texture=e.lightMap,v.envMap.texture=e.envMap,v.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,v.reflectivity.value=e.reflectivity,v.refractionRatio.value=e.refractionRatio,v.combine.value=e.combine,v.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
 THREE.LineBasicMaterial)v.diffuse.value=e.color,v.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)v.psColor.value=e.color,v.opacity.value=e.opacity,v.size.value=e.size,v.scale.value=Ba.height/2,v.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)v.shininess.value=e.shininess,G.gammaInput?(v.ambient.value.copyGammaToLinear(e.ambient),v.specular.value.copyGammaToLinear(e.specular)):(v.ambient.value=e.ambient,v.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)G.gammaInput?
 v.ambient.value.copyGammaToLinear(e.ambient):v.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)v.mNear.value=a.near,v.mFar.value=a.far,v.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)v.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&v.shadowMatrix){for(b=0;b<Sa.length;b++)v.shadowMatrix.value[b]=Sa[b],v.shadowMap.texture[b]=G.shadowMap[b];v.shadowDarkness.value=G.shadowMapDarkness;v.shadowBias.value=G.shadowMapBias}b=e.uniformsList;v=0;for(c=
-b.length;v<c;v++)if(m=f.uniforms[b[v][1]])if(k=b[v][0],P=k.type,u=k.value,P=="i")d.uniform1i(m,u);else if(P=="f")d.uniform1f(m,u);else if(P=="v2")d.uniform2f(m,u.x,u.y);else if(P=="v3")d.uniform3f(m,u.x,u.y,u.z);else if(P=="v4")d.uniform4f(m,u.x,u.y,u.z,u.w);else if(P=="c")d.uniform3f(m,u.r,u.g,u.b);else if(P=="fv1")d.uniform1fv(m,u);else if(P=="fv")d.uniform3fv(m,u);else if(P=="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(o=u.length;P<o;P++)t=P*3,k._array[t]=u[P].x,k._array[t+
-1]=u[P].y,k._array[t+2]=u[P].z;d.uniform3fv(m,k._array)}else if(P=="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(m,!1,k._array)}else if(P=="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(o=u.length;P<o;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(m,!1,k._array)}else if(P=="t"){if(d.uniform1i(m,u),m=k.texture)if(m.image instanceof Array&&m.image.length==6){if(k=m,k.image.length==6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
-d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);F(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(k=m,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):z(m,u)}else if(P==
+b.length;v<c;v++)if(m=f.uniforms[b[v][1]])if(k=b[v][0],P=k.type,u=k.value,P==="i")d.uniform1i(m,u);else if(P==="f")d.uniform1f(m,u);else if(P==="v2")d.uniform2f(m,u.x,u.y);else if(P==="v3")d.uniform3f(m,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(m,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(m,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(m,u);else if(P==="fv")d.uniform3fv(m,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(o=u.length;P<o;P++)t=P*3,k._array[t]=u[P].x,k._array[t+
+1]=u[P].y,k._array[t+2]=u[P].z;d.uniform3fv(m,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(m,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(o=u.length;P<o;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(m,!1,k._array)}else if(P==="t"){if(d.uniform1i(m,u),m=k.texture)if(m.image instanceof Array&&m.image.length===6){if(k=m,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
+d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);F(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(k=m,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):z(m,u)}else if(P===
 "tv"){if(!k._array){k._array=[];P=0;for(o=k.texture.length;P<o;P++)k._array[P]=u+P}d.uniform1iv(m,k._array);P=0;for(o=k.texture.length;P<o;P++)(m=k.texture[P])&&z(m,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
-d.uniformMatrix4fv(i.viewMatrix,!1,Ua);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ua),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!=
-0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!=R&&(R=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
+d.uniformMatrix4fv(i.viewMatrix,!1,Ua);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ua),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!==
+0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==R&&(R=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
 d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var v=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<v.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[v[j]],j++}else{var v=[],q=-1,k=0;u=i.morphTargetInfluences;var m,p=u.length;j=0;for(i.morphTargetBase!==-1&&(v[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(m=
 0;m<p;m++)!v[m]&&u[m]>q&&(k=m,q=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=q;v[k]=1;q=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
 f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
 d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
-d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),G.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++):
+d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),G.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++):
 i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
-a.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,h,i,j,v,k,m,p,o,l=a.count*3;for(o=0;o<l;o+=9)c=a.normalArray,e=c[o],f=c[o+1],h=c[o+2],i=c[o+3],v=c[o+4],m=c[o+5],j=c[o+6],k=c[o+7],p=c[o+8],e=(e+i+j)/3,f=(f+v+k)/3,h=(h+m+p)/3,c[o]=e,c[o+1]=f,c[o+2]=h,c[o+3]=e,c[o+4]=f,c[o+5]=h,c[o+6]=e,c[o+7]=f,c[o+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
-0,a.count);a.count=0}function i(a){if(T!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),T=a.doubleSided;if(X!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),X=a.flipSided}function j(a){aa!=a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),aa=a)}function m(a){O!=a&&(d.depthMask(a),O=a)}function k(a,b,c){za!=a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),za=a);if(a&&(La!=b||Ra!=c))d.polygonOffset(b,c),La=b,Ra=c}function o(a){ha[0].set(a.n41-
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,v,k,m,p,o,l=a.count*3;for(o=0;o<l;o+=9)c=a.normalArray,e=c[o],f=c[o+1],h=c[o+2],i=c[o+3],v=c[o+4],m=c[o+5],j=c[o+6],k=c[o+7],p=c[o+8],e=(e+i+j)/3,f=(f+v+k)/3,h=(h+m+p)/3,c[o]=e,c[o+1]=f,c[o+2]=h,c[o+3]=e,c[o+4]=f,c[o+5]=h,c[o+6]=e,c[o+7]=f,c[o+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
+0,a.count);a.count=0}function i(a){if(T!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),T=a.doubleSided;if(X!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),X=a.flipSided}function j(a){aa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),aa=a)}function m(a){O!==a&&(d.depthMask(a),O=a)}function k(a,b,c){za!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),za=a);if(a&&(La!==b||Ra!==c))d.polygonOffset(b,c),La=b,Ra=c}function o(a){ha[0].set(a.n41-
 a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ha[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
 Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=ha[c].x*b.n14+ha[c].y*b.n24+ha[c].z*b.n34+ha[c].w,a<=d)return!1;return!0}function l(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function t(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=
 b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(a,b){return b.z-a.z}function C(a){var b,c,k,m=0,K,l,u,v,q=a.lights;ra||(ra=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k instanceof THREE.SpotLight&&k.castShadow){J=-1;G.shadowMap[m]||(G.shadowMap[m]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
 Sa[m]||(Sa[m]=new THREE.Matrix4);K=G.shadowMap[m];l=Sa[m];ra.position.copy(k.position);ra.lookAt(k.target.position);ra.update(void 0,!0);a.update(void 0,!1,ra);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(ra.projectionMatrix);l.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Ua);ra.projectionMatrix.flattenToArray(Ta);Da.multiply(ra.projectionMatrix,ra.matrixWorldInverse);o(Da);G.initWebGLObjects(a);U(K);d.clearColor(1,1,1,1);G.clear();d.clearColor(Y.r,
 Y.g,Y.b,Fa);l=a.__webglObjects.length;k=a.__webglObjectsImmediate.length;for(K=0;K<l;K++)u=a.__webglObjects[K],v=u.object,v.visible&&v.castShadow?!(v instanceof THREE.Mesh)||!v.frustumCulled||p(v)?(v.matrixWorld.flattenToArray(v._objectMatrixArray),B(v,ra,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);N(THREE.NormalBlending);for(K=0;K<l;K++)if(u=a.__webglObjects[K],u.render)v=u.object,buffer=u.buffer,i(v),u=v.customDepthMaterial?v.customDepthMaterial:v.geometry.morphTargets.length?Za:Va,f(ra,q,null,
 u,buffer,v);for(K=0;K<k;K++)u=a.__webglObjectsImmediate[K],v=u.object,v.visible&&v.castShadow&&(v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray),R=-1,B(v,ra,!1),i(v),program=e(ra,q,null,Va,v),v.immediateRenderCallback?v.immediateRenderCallback(program,d,ha):v.render(function(a){h(a,program,Va.shading)}));m++}}function E(a,b){var c,e,f;c=r.attributes;var h=r.uniforms,i=ya/Ca,j,k=[],q=Ca*0.5,m=ya*0.5,o=!0;d.useProgram(r.program);Wa=r.program;R=aa=ka=-1;$a||(d.enableVertexAttribArray(r.attributes.position),
-d.enableVertexAttribArray(r.attributes.uv),$a=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,r.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!=0)f.useScreenCoordinates?
-f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(m-f.position.y)/m,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
+d.enableVertexAttribArray(r.attributes.uv),$a=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,r.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?
+f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(m-f.position.y)/m,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
 0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?ya:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),
 f.mergeWith3D&&!o?(d.enable(d.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(d.disable(d.DEPTH_TEST),o=!1),N(f.blending),z(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(O)}function B(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function va(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)if(c.attributes[e].needsUpdate)return!0;
-return!1}function wa(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)c.attributes[e].needsUpdate=!1}function pa(a,b){var d;for(d=a.length-1;d>=0;d--)a[d].object==b&&a.splice(d,1)}function qa(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!=ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;
-case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function F(a,b,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)),
+return!1}function wa(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)c.attributes[e].needsUpdate=!1}function pa(a,b){var d;for(d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function qa(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!==ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;
+case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function F(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)),
 d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,xa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,xa(b.minFilter)))}function z(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,
 Q(a.format),a.image.width,a.image.height,0,Q(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function W(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,
 a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function U(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];
 a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);
 W(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),W(a.__webglRenderbuffer,
-a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ca,a=ya,e=Ha,f=Aa);b!=ua&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ua=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,
-null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function $(a,b){var c;a=="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a=="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
+a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ca,a=ya,e=Ha,f=Aa);b!==ua&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ua=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,
+null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function $(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
 default:return d.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
 var G=this,d,ta=[],Wa=null,ua=null,J=-1,R=null,S=0,T=null,X=null,ka=null,aa=null,O=null,za=null,La=null,Ra=null,Ha=0,Aa=0,Ca=0,ya=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ba=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
@@ -236,14 +236,14 @@ r.vertices[I++]=-1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.verti
 d.bufferData(d.ELEMENT_ARRAY_BUFFER,r.faces,d.STATIC_DRAW);r.program=d.createProgram();d.attachShader(r.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(r.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=d.getAttribLocation(r.program,"position");r.attributes.uv=d.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=d.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=d.getUniformLocation(r.program,
 "uvScale");r.uniforms.rotation=d.getUniformLocation(r.program,"rotation");r.uniforms.scale=d.getUniformLocation(r.program,"scale");r.uniforms.alignment=d.getUniformLocation(r.program,"alignment");r.uniforms.color=d.getUniformLocation(r.program,"color");r.uniforms.map=d.getUniformLocation(r.program,"map");r.uniforms.opacity=d.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=d.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=d.getUniformLocation(r.program,
 "affectedByDistance");r.uniforms.screenPosition=d.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=d.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=d.getUniformLocation(r.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){Ba.width=a;Ba.height=b;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(a,b,c,e){Ha=a;Aa=b;Ca=c;ya=e;d.viewport(Ha,Aa,Ca,ya)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
-function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.setClearColor=function(a,b){Y.copy(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Fa};this.clear=function(a,b,c){var e=0;if(a==void 0||a)e|=d.COLOR_BUFFER_BIT;if(b==void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c==void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.setClearColor=function(a,b){Y.copy(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Fa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
 this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
 d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof
 THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
 a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var q,m,o;q=o=k=0;for(m=b.length;q<m;q++)i=b[q],i instanceof
 THREE.SpotLight&&o++,i instanceof THREE.DirectionalLight&&o++,i instanceof THREE.PointLight&&k++;k+o<=Xa?q=o:(q=Math.ceil(Xa*o/(k+o)),k=Xa-q);i={directional:q,point:k};k=o=0;for(q=b.length;k<q;k++)m=b[k],m instanceof THREE.SpotLight&&m.castShadow&&o++;var p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var l;a:{q=a.fragmentShader;m=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
 sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},t,e=[];j?e.push(j):(e.push(q),e.push(m));for(t in c)e.push(t),e.push(c[t]);j=e.join();t=0;
-for(e=ta.length;t<e;t++)if(ta[t].code==j){l=ta[t].program;break a}t=d.createProgram();e=[bb?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
+for(e=ta.length;t<e;t++)if(ta[t].code===j){l=ta[t].program;break a}t=d.createProgram();e=[bb?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
 "",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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");
 i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
 "",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(t,$("fragment",i+q));d.attachShader(t,
@@ -256,20 +256,20 @@ v.z=v.object.renderDepth:(Ja.copy(q.position),Da.multiplyVector3(Ja),v.z=Ja.z)}e
 i(q),f(b,Pa,Qa,a.overrideMaterial,z,q);for(r=0;r<u;r++)v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,i(q),Ia=e(b,Pa,Qa,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(b){h(b,Ia,a.overrideMaterial.shading)}))}else{N(THREE.NormalBlending);for(r=Ea-1;r>=0;r--)if(v=a.__webglObjects[r],v.render&&(q=v.object,z=v.buffer,K=v.opaque))i(q),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),f(b,Pa,Qa,
 K,z,q);for(r=0;r<u;r++)if(v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,K=v.opaque))i(q),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(a){h(a,Ia,K.shading)});for(r=0;r<Ea;r++)if(v=a.__webglObjects[r],v.render&&(q=v.object,z=v.buffer,K=v.transparent))i(q),N(K.blending),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),
 f(b,Pa,Qa,K,z,q);for(r=0;r<u;r++)if(v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,K=v.transparent))i(q),N(K.blending),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(a){h(a,Ia,K.shading)})}a.__webglSprites.length&&E(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ja(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups==void 0){var j=i,k=void 0,m=void 0,o=void 0,q=void 0,
-l=o=void 0,p=void 0,r={},t=j.morphTargets!==void 0?j.morphTargets.length:0;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)o=j.faces[k],q=o.materialIndex,l=q!==void 0?q:-1,r[l]==void 0&&(r[l]={hash:l,counter:0}),p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t}),o=o instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+o>65535&&(r[l].counter+=1,p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups===void 0){var j=i,k=void 0,m=void 0,o=void 0,q=void 0,
+l=o=void 0,p=void 0,r={},t=j.morphTargets!==void 0?j.morphTargets.length:0;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)o=j.faces[k],q=o.materialIndex,l=q!==void 0?q:-1,r[l]===void 0&&(r[l]={hash:l,counter:0}),p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t}),o=o instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+o>65535&&(r[l].counter+=1,p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]=
 {faces:[],materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=o;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=S++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=
 d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){q=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(q=k.numMorphTargets;m<q;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}G.info.memory.geometries++;for(var q=e,z=o=r=
-void 0,l=z=t=z=void 0,p=l=k=0,A=o=void 0,C=void 0,o=m=t=r=void 0,t=q.geometry,A=t.faces,C=j.faces,r=0,o=C.length;r<o;r++)z=C[r],z=A[z],z instanceof THREE.Face3?(k+=3,l+=1,p+=3):z instanceof THREE.Face4&&(k+=4,l+=2,p+=4);r=b(q,j);o=r.map||r.lightMap||r instanceof THREE.ShaderMaterial?!0:!1;C=r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial?!1:r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=r.vertexColors?r.vertexColors:
+void 0,l=z=t=z=void 0,p=l=k=0,A=o=void 0,C=void 0,o=m=t=r=void 0,t=q.geometry,A=t.faces,C=j.faces,r=0,o=C.length;r<o;r++)z=C[r],z=A[z],z instanceof THREE.Face3?(k+=3,l+=1,p+=3):z instanceof THREE.Face4&&(k+=4,l+=2,p+=4);r=b(q,j);o=r.map||r.lightMap||r instanceof THREE.ShaderMaterial?!0:!1;C=r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial?!1:r&&r.shading!==void 0&&r.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=r.vertexColors?r.vertexColors:
 !1;j.__vertexArray=new Float32Array(k*3);if(C)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(A)j.__colorArray=new Float32Array(k*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),
-j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t<z;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=C==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=A;j.__normalType=C;j.__webglFaceCount=l*3;j.__webglLineCount=p*2;if(r.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
+j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t<z;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=C===THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=A;j.__normalType=C;j.__webglFaceCount=l*3;j.__webglLineCount=p*2;if(r.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
 [];q=void 0;for(q in r.attributes){o=r.attributes[q];t={};for(m in o)t[m]=o[m];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,l=1,t.type==="v2"?l=2:t.type==="v3"?l=3:t.type==="v4"?l=4:t.type==="c"&&(l=3),t.size=l,t.array=new Float32Array(k*l),t.buffer=d.createBuffer(),t.buffer.belongsToAttribute=q,o.needsUpdate=!0,t.__original=o;j.__webglCustomAttributesList.push(t)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
 !0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
 j.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();G.info.geometries++;j=i;m=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
 3);j.__sortArray=[];j.__webglParticleCount=k;m=m.material;if(m.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];q=void 0;for(q in m.attributes){originalAttribute=m.attributes[q];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
 attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=q,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],qa(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof
 THREE.Line||e instanceof THREE.ParticleSystem?(i=e.geometry,qa(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof
-THREE.Line)pa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&pa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,q=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],q=
+THREE.Line)pa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;i=void 0;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&pa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,q=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],q=
 va(j,i),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||q)if(q=j,l=d.DYNAMIC_DRAW,p=!h.dynamic,q.__inittedArrays){var B=t=r=void 0,y=void 0,E=B=void 0,F=void 0,N=void 0,O=void 0,U=z=C=A=o=void 0,H=void 0,L=void 0,M=void 0,I=void 0,w=y=O=y=N=F=void 0,D=void 0,s=D=w=F=void 0,n=void 0,s=D=w=B=B=E=D=w=y=s=D=w=n=s=D=w=n=s=D=w=void 0,ia=0,J=0,X=0,$=0,T=0,Q=0,Z=0,R=0,la=0,x=0,ma=0,V=s=0,V=void 0,na=q.__vertexArray,ja=q.__uvArray,
 ka=q.__uv2Array,W=q.__normalArray,ca=q.__tangentArray,oa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ra=q.__morphTargetsArrays,aa=q.__webglCustomAttributesList,n=void 0,ha=q.__faceArray,Y=q.__lineArray,xa=q.__needsSmoothNormals,A=q.__vertexColorType,o=q.__uvType,C=q.__normalType,sa=i.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,za=sa.__dirtyNormals,Aa=sa.__dirtyTangents,Ca=sa.__dirtyColors,Da=sa.__dirtyMorphTargets,
 Ba=sa.vertices,Fa=q.faces,La=sa.faces,Ha=sa.faceVertexUvs[0],Ja=sa.faceVertexUvs[1],Ma=sa.skinVerticesA,Na=sa.skinVerticesB,Oa=sa.skinIndices,Ka=sa.skinWeights,Ga=sa.morphTargets;if(aa){w=0;for(D=aa.length;w<D;w++)aa[w].offset=0,aa[w].offsetSrc=0}r=0;for(t=Fa.length;r<t;r++)if(B=Fa[r],y=La[B],Ha&&(z=Ha[B]),Ja&&(U=Ja[B]),B=y.vertexNormals,E=y.normal,F=y.vertexColors,N=y.color,O=y.vertexTangents,y instanceof THREE.Face3){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,na[J]=H.x,na[J+
@@ -277,24 +277,24 @@ Ba=sa.vertices,Fa=q.faces,La=sa.faces,Ha=sa.faceVertexUvs[0],Ja=sa.faceVertexUvs
 2]=n.value[V+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],L=n.value[y.b],M=n.value[y.c]):n.boundTo==="faces"?(M=L=H=V=n.value[V],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[V],L=n.value[V+1],M=n.value[V+2],n.offsetSrc+=3),n.size===2?(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=L.x,n.array[s+3]=L.y,n.array[s+4]=M.x,n.array[s+5]=M.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=H.r,n.array[s+1]=H.g,n.array[s+2]=H.b,n.array[s+3]=L.r,n.array[s+
 4]=L.g,n.array[s+5]=L.b,n.array[s+6]=M.r,n.array[s+7]=M.g,n.array[s+8]=M.b):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=L.x,n.array[s+4]=L.y,n.array[s+5]=L.z,n.array[s+6]=M.x,n.array[s+7]=M.y,n.array[s+8]=M.z),n.offset+=9):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=H.w,n.array[s+4]=L.x,n.array[s+5]=L.y,n.array[s+6]=L.z,n.array[s+7]=L.w,n.array[s+8]=M.x,n.array[s+9]=M.y,n.array[s+10]=M.z,n.array[s+11]=M.w,n.offset+=12))}if(Da){w=0;for(D=Ga.length;w<D;w++)H=Ga[w].vertices[y.a].position,
 L=Ga[w].vertices[y.b].position,M=Ga[w].vertices[y.c].position,s=ra[w],s[ma]=H.x,s[ma+1]=H.y,s[ma+2]=H.z,s[ma+3]=L.x,s[ma+4]=L.y,s[ma+5]=L.z,s[ma+6]=M.x,s[ma+7]=M.y,s[ma+8]=M.z;ma+=9}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=s.x,ga[x+9]=s.y,ga[x+10]=s.z,ga[x+11]=s.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=
-s.x,fa[x+9]=s.y,fa[x+10]=s.z,fa[x+11]=s.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,x+=12;if(Ca&&A)F.length==3&&A==THREE.VertexColors?(y=F[0],w=F[1],D=F[2]):D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+
-3]=w.r,oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,la+=9;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,Z+=12;if(za&&C)if(B.length==3&&xa)for(w=0;w<3;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;if(ta&&z!==void 0&&o)for(w=0;w<3;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&
+s.x,fa[x+9]=s.y,fa[x+10]=s.z,fa[x+11]=s.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,x+=12;if(Ca&&A)F.length===3&&A===THREE.VertexColors?(y=F[0],w=F[1],D=F[2]):D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+
+3]=w.r,oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,la+=9;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,Z+=12;if(za&&C)if(B.length===3&&xa)for(w=0;w<3;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;if(ta&&z!==void 0&&o)for(w=0;w<3;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&
 o)for(w=0;w<3;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+2,T+=3,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+2,Y[R+4]=ia+1,Y[R+5]=ia+2,R+=6,ia+=3)}else if(y instanceof THREE.Face4){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,I=Ba[y.d].position,na[J]=H.x,na[J+1]=H.y,na[J+2]=H.z,na[J+3]=L.x,na[J+4]=L.y,na[J+5]=L.z,na[J+6]=M.x,na[J+7]=M.y,na[J+8]=M.z,na[J+9]=I.x,na[J+10]=I.y,na[J+11]=I.z,J+=12;if(aa){w=0;for(D=aa.length;w<D;w++)if(n=aa[w],n.__original.needsUpdate)s=
 n.offset,V=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[y.a],n.array[s+1]=n.value[y.b],n.array[s+2]=n.value[y.c],n.array[s+3]=n.value[y.d]):n.boundTo==="faces"?(V=n.value[V],n.array[s]=V,n.array[s+1]=V,n.array[s+2]=V,n.array[s+3]=V,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[V],n.array[s+1]=n.value[V+1],n.array[s+2]=n.value[V+2],n.array[s+3]=n.value[V+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],
 L=n.value[y.b],M=n.value[y.c],I=n.value[y.d]):n.boundTo==="faces"?(I=M=L=H=V=n.value[V],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[V],L=n.value[V+1],M=n.value[V+2],I=n.value[V+3],n.offsetSrc+=4),n.size===2?(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=L.x,n.array[s+3]=L.y,n.array[s+4]=M.x,n.array[s+5]=M.y,n.array[s+6]=I.x,n.array[s+7]=I.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=H.r,n.array[s+1]=H.g,n.array[s+2]=H.b,n.array[s+3]=L.r,n.array[s+4]=L.g,n.array[s+5]=L.b,n.array[s+
 6]=M.r,n.array[s+7]=M.g,n.array[s+8]=M.b,n.array[s+9]=I.r,n.array[s+10]=I.g,n.array[s+11]=I.b):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=L.x,n.array[s+4]=L.y,n.array[s+5]=L.z,n.array[s+6]=M.x,n.array[s+7]=M.y,n.array[s+8]=M.z,n.array[s+9]=I.x,n.array[s+10]=I.y,n.array[s+11]=I.z),n.offset+=12):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=H.w,n.array[s+4]=L.x,n.array[s+5]=L.y,n.array[s+6]=L.z,n.array[s+7]=L.w,n.array[s+8]=M.x,n.array[s+9]=M.y,n.array[s+10]=M.z,
 n.array[s+11]=M.w,n.array[s+12]=I.x,n.array[s+13]=I.y,n.array[s+14]=I.z,n.array[s+15]=I.w,n.offset+=16))}if(Da){w=0;for(D=Ga.length;w<D;w++)H=Ga[w].vertices[y.a].position,L=Ga[w].vertices[y.b].position,M=Ga[w].vertices[y.c].position,I=Ga[w].vertices[y.d].position,s=ra[w],s[ma]=H.x,s[ma+1]=H.y,s[ma+2]=H.z,s[ma+3]=L.x,s[ma+4]=L.y,s[ma+5]=L.z,s[ma+6]=M.x,s[ma+7]=M.y,s[ma+8]=M.z,s[ma+9]=I.x,s[ma+10]=I.y,s[ma+11]=I.z;ma+=12}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],n=Ka[y.d],ga[x]=w.x,ga[x+1]=w.y,ga[x+
 2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=s.x,ga[x+9]=s.y,ga[x+10]=s.z,ga[x+11]=s.w,ga[x+12]=n.x,ga[x+13]=n.y,ga[x+14]=n.z,ga[x+15]=n.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],n=Oa[y.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=s.x,fa[x+9]=s.y,fa[x+10]=s.z,fa[x+11]=s.w,fa[x+12]=n.x,fa[x+13]=n.y,fa[x+14]=n.z,fa[x+15]=n.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],n=Ma[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,
-da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,da[x+12]=n.x,da[x+13]=n.y,da[x+14]=n.z,da[x+15]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],y=Na[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,ea[x+12]=y.x,ea[x+13]=y.y,ea[x+14]=y.z,ea[x+15]=1,x+=16;if(Ca&&A)F.length==4&&A==THREE.VertexColors?(y=F[0],w=F[1],D=F[2],F=F[3]):F=D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+3]=w.r,oa[la+
-4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,oa[la+9]=F.r,oa[la+10]=F.g,oa[la+11]=F.b,la+=12;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],O=O[3],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,ca[Z+12]=O.x,ca[Z+13]=O.y,ca[Z+14]=O.z,ca[Z+15]=O.w,Z+=16;if(za&&C)if(B.length==4&&xa)for(w=0;w<4;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<4;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=
-3;if(ta&&z!==void 0&&o)for(w=0;w<4;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&o)for(w=0;w<4;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+3,ha[T+3]=ia+1,ha[T+4]=ia+2,ha[T+5]=ia+3,T+=6,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+3,Y[R+4]=ia+1,Y[R+5]=ia+2,Y[R+6]=ia+2,Y[R+7]=ia+3,R+=8,ia+=4)}ua&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(aa){w=0;for(D=aa.length;w<D;w++)n=aa[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
+da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,da[x+12]=n.x,da[x+13]=n.y,da[x+14]=n.z,da[x+15]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],y=Na[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,ea[x+12]=y.x,ea[x+13]=y.y,ea[x+14]=y.z,ea[x+15]=1,x+=16;if(Ca&&A)F.length===4&&A===THREE.VertexColors?(y=F[0],w=F[1],D=F[2],F=F[3]):F=D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+3]=w.r,
+oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,oa[la+9]=F.r,oa[la+10]=F.g,oa[la+11]=F.b,la+=12;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],O=O[3],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,ca[Z+12]=O.x,ca[Z+13]=O.y,ca[Z+14]=O.z,ca[Z+15]=O.w,Z+=16;if(za&&C)if(B.length===4&&xa)for(w=0;w<4;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<4;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=
+E.z,Q+=3;if(ta&&z!==void 0&&o)for(w=0;w<4;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&o)for(w=0;w<4;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+3,ha[T+3]=ia+1,ha[T+4]=ia+2,ha[T+5]=ia+3,T+=6,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+3,Y[R+4]=ia+1,Y[R+5]=ia+2,Y[R+6]=ia+2,Y[R+7]=ia+3,R+=8,ia+=4)}ua&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(aa){w=0;for(D=aa.length;w<D;w++)n=aa[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
 n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,l))}if(Da){w=0;for(D=Ga.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,ra[w],l)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));za&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,W,l));Aa&&sa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l));ta&&X>0&&(d.bindBuffer(d.ARRAY_BUFFER,
 q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ta&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ka,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ha,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,Y,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),
 d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l));p&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}h.__dirtyVertices=
 !1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;wa(j,i)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=p=p=void 0;t=i.vertices;m=i.colors;o=t.length;q=m.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<o;p++)r=t[p].position,k=p*3,A[k]=r.x,A[k+1]=r.y,A[k+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
 A,j)}if(C){for(p=0;p<q;p++)color=m[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=p=p=void 0;t=i.vertices;m=i.colors;o=t.length;q=m.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<o;p++)r=t[p].position,k=p*3,A[k]=r.x,A[k+
 1]=r.y,A[k+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,A,j)}if(C){for(p=0;p<q;p++)color=m[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,q=va(h,i),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||q)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,wa(h,i)};
-this.setFaceCulling=function(a,b){a?(!b||b=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a=="back"?d.cullFace(d.BACK):a=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
+this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 51 - 51
src/renderers/WebGLRenderer.js

@@ -325,9 +325,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var bits = 0;
 
-		if ( color == undefined || color ) bits |= _gl.COLOR_BUFFER_BIT;
-		if ( depth == undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT;
-		if ( stencil == undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT;
+		if ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT;
+		if ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT;
+		if ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT;
 
 		_gl.clear( bits );
 
@@ -871,7 +871,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		geometryGroup.__needsSmoothNormals = ( normalType == THREE.SmoothShading );
+		geometryGroup.__needsSmoothNormals = ( normalType === THREE.SmoothShading );
 
 		geometryGroup.__uvType = uvType;
 		geometryGroup.__vertexColorType = vertexColorType;
@@ -1360,7 +1360,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( dirtyColors && vertexColorType ) {
 
-					if ( vertexColors.length == 3 && vertexColorType == THREE.VertexColors ) {
+					if ( vertexColors.length === 3 && vertexColorType === THREE.VertexColors ) {
 
 						c1 = vertexColors[ 0 ];
 						c2 = vertexColors[ 1 ];
@@ -1417,7 +1417,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( dirtyNormals && normalType ) {
 
-					if ( vertexNormals.length == 3 && needsSmoothNormals ) {
+					if ( vertexNormals.length === 3 && needsSmoothNormals ) {
 
 						for ( i = 0; i < 3; i ++ ) {
 
@@ -1848,7 +1848,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( dirtyColors && vertexColorType ) {
 
-					if ( vertexColors.length == 4 && vertexColorType == THREE.VertexColors ) {
+					if ( vertexColors.length === 4 && vertexColorType === THREE.VertexColors ) {
 
 						c1 = vertexColors[ 0 ];
 						c2 = vertexColors[ 1 ];
@@ -1917,7 +1917,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( dirtyNormals && normalType ) {
 
-					if ( vertexNormals.length == 4 && needsSmoothNormals ) {
+					if ( vertexNormals.length === 4 && needsSmoothNormals ) {
 
 						for ( i = 0; i < 4; i ++ ) {
 
@@ -2838,7 +2838,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			p_uniforms = program.uniforms,
 			m_uniforms = material.uniforms;
 
-		if ( program != _currentProgram ) {
+		if ( program !== _currentProgram ) {
 
 			_gl.useProgram( program );
 			_currentProgram = program;
@@ -2847,7 +2847,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( material.id != _currentMaterialId ) {
+		if ( material.id !== _currentMaterialId ) {
 
 			_currentMaterialId = material.id;
 			refreshMaterial = true;
@@ -2980,7 +2980,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function renderBuffer( camera, lights, fog, material, geometryGroup, object ) {
 
-		if ( material.opacity == 0 ) return;
+		if ( material.opacity === 0 ) return;
 
 		var program, attributes, linewidth, primitives, a, attribute, i, il;
 
@@ -2992,7 +2992,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			wireframeBit = material.wireframe ? 1 : 0,
 			geometryGroupHash = ( geometryGroup.id * 0xffffff ) + ( program.id * 2 ) + wireframeBit;
 
-		if ( geometryGroupHash != _currentGeometryGroupHash ) {
+		if ( geometryGroupHash !== _currentGeometryGroupHash ) {
 
 			_currentGeometryGroupHash = geometryGroupHash;
 			updateBuffers = true;
@@ -3158,7 +3158,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		} else if ( object instanceof THREE.Line ) {
 
-			primitives = ( object.type == THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
+			primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
 
 			_gl.lineWidth( material.linewidth );
 			_gl.drawArrays( primitives, 0, geometryGroup.__webglLineCount );
@@ -3294,7 +3294,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglNormalBuffer );
 
-			if ( shading == THREE.FlatShading ) {
+			if ( shading === THREE.FlatShading ) {
 
 				var nx, ny, nz,
 					nax, nbx, ncx, nay, nby, ncy, naz, nbz, ncz,
@@ -3387,7 +3387,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setDepthTest( depthTest ) {
 
-		if ( _oldDepthTest != depthTest ) {
+		if ( _oldDepthTest !== depthTest ) {
 
 			if( depthTest ) {
 
@@ -3407,7 +3407,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setDepthWrite( depthWrite ) {
 
-		if ( _oldDepthWrite != depthWrite ) {
+		if ( _oldDepthWrite !== depthWrite ) {
 
 			_gl.depthMask( depthWrite );
 			_oldDepthWrite = depthWrite;
@@ -3418,7 +3418,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setPolygonOffset ( polygonoffset, factor, units ) {
 
-		if ( _oldPolygonOffset != polygonoffset ) {
+		if ( _oldPolygonOffset !== polygonoffset ) {
 
 			if ( polygonoffset ) {
 
@@ -3434,7 +3434,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( polygonoffset && ( _oldPolygonOffsetFactor != factor || _oldPolygonOffsetUnits != units ) ) {
+		if ( polygonoffset && ( _oldPolygonOffsetFactor !== factor || _oldPolygonOffsetUnits !== units ) ) {
 
 			_gl.polygonOffset( factor, units );
 
@@ -4166,7 +4166,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			object = scene.__webglSprites[ o ];
 
-			if ( !object.visible || object.opacity == 0 ) continue;
+			if ( !object.visible || object.opacity === 0 ) continue;
 
 			if( !object.useScreenCoordinates ) {
 
@@ -4189,7 +4189,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			object = scene.__webglSprites[ o ];
 
-			if ( !object.visible || object.opacity == 0 ) continue;
+			if ( !object.visible || object.opacity === 0 ) continue;
 
 			if ( object.map && object.map.image && object.map.image.width ) {
 
@@ -4319,7 +4319,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				geometry = object.geometry;
 
-				if ( geometry.geometryGroups == undefined ) {
+				if ( geometry.geometryGroups === undefined ) {
 
 					sortFacesByMaterial( geometry );
 
@@ -4567,7 +4567,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		for ( o = objlist.length - 1; o >= 0; o -- ) {
 
-			if ( objlist[ o ].object == object ) {
+			if ( objlist[ o ].object === object ) {
 
 				objlist.splice( o, 1 );
 
@@ -4583,7 +4583,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		for ( o = objlist.length - 1; o >= 0; o -- ) {
 
-			if ( objlist[ o ] == object ) {
+			if ( objlist[ o ] === object ) {
 
 				objlist.splice( o, 1 );
 
@@ -4630,7 +4630,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			mhash = ( materialIndex !== undefined ) ? materialIndex : -1;
 
-			if ( hash_map[ mhash ] == undefined ) {
+			if ( hash_map[ mhash ] === undefined ) {
 
 				hash_map[ mhash ] = { 'hash': mhash, 'counter': 0 };
 
@@ -4638,7 +4638,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			ghash = hash_map[ mhash ].hash + '_' + hash_map[ mhash ].counter;
 
-			if ( geometry.geometryGroups[ ghash ] == undefined ) {
+			if ( geometry.geometryGroups[ ghash ] === undefined ) {
 
 				geometry.geometryGroups[ ghash ] = { 'faces': [], 'materialIndex': materialIndex, 'vertices': 0, 'numMorphTargets': numMorphTargets };
 
@@ -4651,7 +4651,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				hash_map[ mhash ].counter += 1;
 				ghash = hash_map[ mhash ].hash + '_' + hash_map[ mhash ].counter;
 
-				if ( geometry.geometryGroups[ ghash ] == undefined ) {
+				if ( geometry.geometryGroups[ ghash ] === undefined ) {
 
 					geometry.geometryGroups[ ghash ] = { 'faces': [], 'materialIndex': materialIndex, 'vertices': 0, 'numMorphTargets': numMorphTargets };
 
@@ -4705,7 +4705,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( cullFace ) {
 
-			if ( !frontFace || frontFace == "ccw" ) {
+			if ( !frontFace || frontFace === "ccw" ) {
 
 				_gl.frontFace( _gl.CCW );
 
@@ -4715,11 +4715,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			if( cullFace == "back" ) {
+			if( cullFace === "back" ) {
 
 				_gl.cullFace( _gl.BACK );
 
-			} else if( cullFace == "front" ) {
+			} else if( cullFace === "front" ) {
 
 				_gl.cullFace( _gl.FRONT );
 
@@ -4782,7 +4782,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		for ( p = 0, pl = _programs.length; p < pl; p ++ ) {
 
-			if ( _programs[ p ].code == code ) {
+			if ( _programs[ p ].code === code ) {
 
 				// console.log( "Code already compiled." /*: \n\n" + code*/ );
 
@@ -5015,55 +5015,55 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// single integer
 
-			if( type == "i" ) {
+			if( type === "i" ) {
 
 				_gl.uniform1i( location, value );
 
 			// single float
 
-			} else if( type == "f" ) {
+			} else if( type === "f" ) {
 
 				_gl.uniform1f( location, value );
 
 			// single THREE.Vector2
 
-			} else if( type == "v2" ) {
+			} else if( type === "v2" ) {
 
 				_gl.uniform2f( location, value.x, value.y );
 
 			// single THREE.Vector3
 
-			} else if( type == "v3" ) {
+			} else if( type === "v3" ) {
 
 				_gl.uniform3f( location, value.x, value.y, value.z );
 
 			// single THREE.Vector4
 
-			} else if( type == "v4" ) {
+			} else if( type === "v4" ) {
 
 				_gl.uniform4f( location, value.x, value.y, value.z, value.w );
 
 			// single THREE.Color
 
-			} else if( type == "c" ) {
+			} else if( type === "c" ) {
 
 				_gl.uniform3f( location, value.r, value.g, value.b );
 
 			// flat array of floats (JS or typed array)
 
-			} else if( type == "fv1" ) {
+			} else if( type === "fv1" ) {
 
 				_gl.uniform1fv( location, value );
 
 			// flat array of floats with 3 x N size (JS or typed array)
 
-			} else if( type == "fv" ) {
+			} else if( type === "fv" ) {
 
 				_gl.uniform3fv( location, value );
 
 			// array of THREE.Vector3
 
-			} else if( type == "v3v" ) {
+			} else if( type === "v3v" ) {
 
 				if ( ! uniform._array ) {
 
@@ -5085,7 +5085,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// single THREE.Matrix4
 
-			} else if( type == "m4" ) {
+			} else if( type === "m4" ) {
 
 				if ( ! uniform._array ) {
 
@@ -5098,7 +5098,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// array of THREE.Matrix4
 
-			} else if( type == "m4v" ) {
+			} else if( type === "m4v" ) {
 
 				if ( ! uniform._array ) {
 
@@ -5117,7 +5117,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// single THREE.Texture (2d or cube)
 
-			} else if( type == "t" ) {
+			} else if( type === "t" ) {
 
 				_gl.uniform1i( location, value );
 
@@ -5125,7 +5125,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( !texture ) continue;
 
-				if ( texture.image instanceof Array && texture.image.length == 6 ) {
+				if ( texture.image instanceof Array && texture.image.length === 6 ) {
 
 					setCubeTexture( texture, value );
 
@@ -5141,7 +5141,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// array of THREE.Texture (2d)
 
-			} else if( type == "tv" ) {
+			} else if( type === "tv" ) {
 
 				if ( ! uniform._array ) {
 
@@ -5175,7 +5175,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setBlending( blending ) {
 
-		if ( blending != _oldBlending ) {
+		if ( blending !== _oldBlending ) {
 
 			switch ( blending ) {
 
@@ -5284,7 +5284,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setCubeTexture( texture, slot ) {
 
-		if ( texture.image.length == 6 ) {
+		if ( texture.image.length === 6 ) {
 
 			if ( texture.needsUpdate ) {
 
@@ -5461,7 +5461,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( framebuffer != _currentFramebuffer ) {
+		if ( framebuffer !== _currentFramebuffer ) {
 
 			_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
 			_gl.viewport( vx, vy, width, height );
@@ -5520,11 +5520,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var shader;
 
-		if ( type == "fragment" ) {
+		if ( type === "fragment" ) {
 
 			shader = _gl.createShader( _gl.FRAGMENT_SHADER );
 
-		} else if ( type == "vertex" ) {
+		} else if ( type === "vertex" ) {
 
 			shader = _gl.createShader( _gl.VERTEX_SHADER );
 
@@ -5604,13 +5604,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function isPowerOfTwo( value ) {
 
-		return ( value & ( value - 1 ) ) == 0;
+		return ( value & ( value - 1 ) ) === 0;
 
 	};
 
 	function materialNeedsSmoothNormals( material ) {
 
-		return material && material.shading != undefined && material.shading == THREE.SmoothShading;
+		return material && material.shading !== undefined && material.shading === THREE.SmoothShading;
 
 	};