Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed cameraInverseMatrix uniform.

This was redundant as viewMatrix uniform is the same thing.
  • Loading branch information...
commit 560562c05f715f7a9b5440206ef48647a47d9a07 1 parent 82256dc
@alteredq alteredq authored
View
169 build/Three.js
@@ -252,93 +252,92 @@ h._array[s+1]=k[n].y,h._array[s+2]=k[n].z;j.uniform3fv(l,h._array)}else if("v4v"
16*n);j.uniformMatrix4fv(l,!1,h._array)}else if("t"===n){if(j.uniform1i(l,k),l=h.texture)if(l.image instanceof Array&&6===l.image.length){if(h=l,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(l=0;6>l;l++){n=k;r=l;if(H.autoScaleCubemaps){if(s=h.image[l],F=Oa,!(s.width<=F&&s.height<=F))x=Math.max(s.width,s.height),t=Math.floor(s.width*
F/x),F=Math.floor(s.height*F/x),x=document.createElement("canvas"),x.width=t,x.height=F,x.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,F),s=x}else s=h.image[l];n[r]=s}l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=B(h.format);s=B(h.type);u(j.TEXTURE_CUBE_MAP,h,n);for(l=0;6>l;l++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,s,k[l]);h.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(h=l,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):H.setTexture(l,k)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,r=h.texture.length;n<r;n++)h._array[n]=k+n}j.uniform1iv(l,h._array);for(n=0,r=h.texture.length;n<r;n++)(l=h.texture[n])&&H.setTexture(l,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
-null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,f.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray);
-g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,f._objectMatrixArray);return e}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){fa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
-j.disable(j.POLYGON_OFFSET_FILL),fa=a);if(a&&(Ra!==b||na!==c))j.polygonOffset(b,c),Ra=b,na=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function u(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,B(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,B(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,
-B(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,B(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)))}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,
-j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;
-case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;
-case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==
-a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",A=void 0!==a.alpha?a.alpha:!0,E=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,J=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,Y=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,K=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),O=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;
-this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};
-var H=this,j,X=[],y=null,F=null,P=-1,Q=null,ca=null,ga=0,ba=null,T=null,aa=null,S=null,$=null,fa=null,Ra=null,na=null,Ja=null,Ea=0,Aa=0,ja=0,ab=0,kb=0,db=0,Xa=new THREE.Frustum,Ya=new THREE.Matrix4,Qa=new THREE.Vector4,Fa=new THREE.Vector3,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{alpha:A,premultipliedAlpha:E,antialias:J,stencil:N,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";
-console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(K.r,K.g,K.b,O);this.context=
-j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Oa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<ya};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Ea=a;Aa=b;ja=c;ab=d;j.viewport(Ea,Aa,ja,ab)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):
-j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){K.setHex(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.setClearColor=function(a,b){K.copy(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,
-c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);
-j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=
-void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
-j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=function(a,b){y=null;P=Q=$=S=aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),
-j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,e,g,h,i,m,k,l,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],f=c[n+1],e=c[n+2],g=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+g+h)/3,f=(f+i+m)/3,e=(e+k+l)/3,c[n]=d,c[n+1]=f,c[n+2]=e,c[n+3]=d,c[n+4]=f,c[n+5]=e,
-c[n+6]=d,c[n+7]=f,c[n+8]=e}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(0!==d.opacity&&(c=m(a,b,c,d,e),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?1:0),d!==Q&&(Q=d,b=!0),e instanceof THREE.Mesh)){e=f.offsets;d=0;for(c=e.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexPositionBuffer),
-j.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*e[d].index),0<=a.normal&&f.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexNormalBuffer),j.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*e[d].index)),0<=a.uv&&f.vertexUvBuffer&&(f.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,f.vertexUvBuffer),j.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*e[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),
-0<=a.color&&f.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexColorBuffer),j.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*e[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,e[d].count,j.UNSIGNED_SHORT,2*e[d].start),H.info.render.calls++,H.info.render.vertices+=e[d].count,H.info.render.faces+=e[d].count/3}};this.renderBuffer=function(a,b,c,d,f,e){if(0!==d.opacity){var g,h,c=m(a,b,c,d,e),b=c.attributes,a=!1,c=16777215*
-f.id+2*c.id+(d.wireframe?1:0);c!==Q&&(Q=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;-1!==e.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,
-!1,0,0));if(e.morphTargetForcedOrder.length){g=0;var i=e.morphTargetForcedOrder;for(h=e.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),e.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=e.morphTargetInfluences;var n,o=h.length;g=0;for(-1!==e.morphTargetBase&&(i[e.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>
-k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);e.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(g=0,h=f.__webglCustomAttributesList.length;g<h;g++)c=f.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,
-c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUVBuffer),
-j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(f.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
-f.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ja&&(j.lineWidth(d),Ja=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),j.drawElements(j.LINES,f.__webglLineCount,j.UNSIGNED_SHORT,
-0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),j.drawElements(j.TRIANGLES,f.__webglFaceCount,j.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=f.__webglFaceCount,H.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==Ja&&(j.lineWidth(d),Ja=d),j.drawArrays(e,0,f.__webglLineCount),H.info.render.calls++):e instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,f.__webglParticleCount),H.info.render.calls++,
-H.info.render.points+=f.__webglParticleCount):e instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,f.__webglVertexCount),H.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,m,l,n=a.lights,o=a.fog;P=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=
-0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ya.multiply(b.projectionMatrix,b.matrixWorldInverse);Xa.setFromMatrix(Ya);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-l=a.__webglObjects;for(d=0,f=l.length;d<f;d++)if(g=l[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||Xa.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=g,q=p.object,F=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=F.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?
-(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(Qa.copy(m.position),Ya.multiplyVector3(Qa),g.z=Qa.z)}this.sortObjects&&l.sort(e);l=a.__webglObjectsImmediate;for(d=0,f=l.length;d<f;d++)if(g=l[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),
-this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,
-"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=
-function(a,b,c,d,f){var e=m(a,b,c,d,f);Q=-1;H.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(e,j,Xa):f.render(function(a){H.renderBufferImmediate(a,e,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],h=a,i=void 0,m=void 0,k=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){if(m=e.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,s=void 0,t=void 0,F=void 0,x=void 0,P=void 0,u=void 0,v=void 0,y={},Q=r.morphTargets.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)F=r.faces[s],x=F.materialIndex,u=void 0!==x?x:-1,void 0===y[u]&&(y[u]={hash:u,counter:0}),
-v=y[u].hash+"_"+y[u].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:Q}),P=F instanceof THREE.Face3?3:4,65535<r.geometryGroups[v].vertices+P&&(y[u].counter+=1,v=y[u].hash+"_"+y[u].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:Q})),F instanceof THREE.Face3?r.geometryGroups[v].faces3.push(s):r.geometryGroups[v].faces4.push(s),r.geometryGroups[v].vertices+=
-P;r.geometryGroupsList=[];var C=void 0;for(C in r.geometryGroups)r.geometryGroups[C].id=ga++,r.geometryGroupsList.push(r.geometryGroups[C])}for(i in m.geometryGroups)if(k=m.geometryGroups[i],!k.__webglVertexBuffer){var A=k;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=
-j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var B=void 0,D=void 0;A.__webglMorphTargetsBuffers=[];for(B=0,D=A.numMorphTargets;B<D;B++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}H.info.memory.geometries++;var E=k,M=e,K=M.geometry,J=E.faces3,ca=E.faces4,T=3*J.length+4*ca.length,ba=1*J.length+2*ca.length,N=3*J.length+4*ca.length,S=c(M,E),
-aa=f(S),$=d(S),O=S.vertexColors?S.vertexColors:!1;E.__vertexArray=new Float32Array(3*T);if($)E.__normalArray=new Float32Array(3*T);if(K.hasTangents)E.__tangentArray=new Float32Array(4*T);if(O)E.__colorArray=new Float32Array(3*T);if(aa){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)E.__uvArray=new Float32Array(2*T);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)E.__uv2Array=new Float32Array(2*T)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length)E.__skinVertexAArray=new Float32Array(4*
-T),E.__skinVertexBArray=new Float32Array(4*T),E.__skinIndexArray=new Float32Array(4*T),E.__skinWeightArray=new Float32Array(4*T);E.__faceArray=new Uint16Array(3*ba);E.__lineArray=new Uint16Array(2*N);if(E.numMorphTargets){E.__morphTargetsArrays=[];for(var fa=0,Y=E.numMorphTargets;fa<Y;fa++)E.__morphTargetsArrays.push(new Float32Array(3*T))}E.__webglFaceCount=3*ba;E.__webglLineCount=2*N;if(S.attributes){if(void 0===E.__webglCustomAttributesList)E.__webglCustomAttributesList=[];var X=void 0;for(X in S.attributes){var Ra=
-S.attributes[X],na={},Ja;for(Ja in Ra)na[Ja]=Ra[Ja];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var ja=1;"v2"===na.type?ja=2:"v3"===na.type?ja=3:"v4"===na.type?ja=4:"c"===na.type&&(ja=3);na.size=ja;na.array=new Float32Array(T*ja);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=X;Ra.needsUpdate=!0;na.__original=Ra}E.__webglCustomAttributesList.push(na)}}E.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=
-!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}}else if(e instanceof THREE.Ribbon){if(m=e.geometry,!m.__webglVertexBuffer){var Aa=m;Aa.__webglVertexBuffer=j.createBuffer();Aa.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Ea=m,xa=Ea.vertices.length;Ea.__vertexArray=new Float32Array(3*xa);Ea.__colorArray=new Float32Array(3*xa);Ea.__webglVertexCount=xa;m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(e instanceof THREE.Line){if(m=e.geometry,!m.__webglVertexBuffer){var ya=m;ya.__webglVertexBuffer=
-j.createBuffer();ya.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Fa=m,Oa=e,ab=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*ab);Fa.__colorArray=new Float32Array(3*ab);Fa.__webglLineCount=ab;b(Fa,Oa);m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(e instanceof THREE.ParticleSystem&&(m=e.geometry,!m.__webglVertexBuffer)){var Ya=m;Ya.__webglVertexBuffer=j.createBuffer();Ya.__webglColorBuffer=j.createBuffer();H.info.geometries++;var Qa=m,kb=e,db=Qa.vertices.length;Qa.__vertexArray=
-new Float32Array(3*db);Qa.__colorArray=new Float32Array(3*db);Qa.__sortArray=[];Qa.__webglParticleCount=db;b(Qa,kb);m.__dirtyVertices=!0;m.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)if(m=e.geometry,m instanceof THREE.BufferGeometry)l(h.__webglObjects,m,e);else for(i in m.geometryGroups)k=m.geometryGroups[i],l(h.__webglObjects,k,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(m=e.geometry,l(h.__webglObjects,m,e)):void 0!==THREE.MarchingCubes&&
-e instanceof THREE.MarchingCubes||e.immediateRenderCallback?h.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite?h.__webglSprites.push(e):e instanceof THREE.LensFlare&&h.__webglFlares.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fb=a.__objectsRemoved[0],Xa=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(Xa.__webglObjects,fb):fb instanceof
-THREE.Sprite?q(Xa.__webglSprites,fb):fb instanceof THREE.LensFlare?q(Xa.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(Xa.__webglObjectsImmediate,fb);fb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Mc=0,hd=a.__webglObjects.length;Mc<hd;Mc++){var mb=a.__webglObjects[Mc].object,ia=mb.geometry,jc=void 0,bc=void 0,Va=void 0;if(mb instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=
-!1,ia.__dirtyColors=!1;else{for(var Nc=0,id=ia.geometryGroupsList.length;Nc<id;Nc++)if(jc=ia.geometryGroupsList[Nc],Va=c(mb,jc),bc=Va.attributes&&p(Va),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||bc){var da=jc,jd=mb,bb=j.DYNAMIC_DRAW,kd=!ia.dynamic,xc=Va;if(da.__inittedArrays){var Wc=d(xc),Oc=xc.vertexColors?xc.vertexColors:!1,Xc=f(xc),Yc=Wc===THREE.SmoothShading,G=void 0,R=void 0,jb=void 0,L=void 0,cc=void 0,
-Jb=void 0,nb=void 0,yc=void 0,Db=void 0,dc=void 0,ec=void 0,U=void 0,V=void 0,W=void 0,oa=void 0,ob=void 0,pb=void 0,qb=void 0,kc=void 0,rb=void 0,sb=void 0,tb=void 0,lc=void 0,ub=void 0,vb=void 0,wb=void 0,mc=void 0,xb=void 0,yb=void 0,zb=void 0,nc=void 0,Kb=void 0,Lb=void 0,Mb=void 0,zc=void 0,Nb=void 0,Ob=void 0,Pb=void 0,Ac=void 0,ka=void 0,Zc=void 0,Qb=void 0,fc=void 0,gc=void 0,cb=void 0,$c=void 0,Ia=void 0,za=0,Ga=0,Eb=0,Fb=0,gb=0,Pa=0,pa=0,Sa=0,Ba=0,I=0,Ca=0,z=0,Za=void 0,Ka=da.__vertexArray,
-oc=da.__uvArray,pc=da.__uv2Array,hb=da.__normalArray,ra=da.__tangentArray,La=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Pc=da.__morphTargetsArrays,Qc=da.__webglCustomAttributesList,w=void 0,Ab=da.__faceArray,$a=da.__lineArray,Ta=jd.geometry,ld=Ta.__dirtyElements,ad=Ta.__dirtyUvs,md=Ta.__dirtyNormals,nd=Ta.__dirtyTangents,od=Ta.__dirtyColors,pd=Ta.__dirtyMorphTargets,Wb=Ta.vertices,la=da.faces3,ma=da.faces4,Da=Ta.faces,Rc=Ta.faceVertexUvs[0],
-Sc=Ta.faceVertexUvs[1],Xb=Ta.skinVerticesA,Yb=Ta.skinVerticesB,Zb=Ta.skinIndices,Rb=Ta.skinWeights,Sb=Ta.morphTargets;if(Ta.__dirtyVertices){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=Wb[L.a].position,V=Wb[L.b].position,W=Wb[L.c].position,Ka[Ga]=U.x,Ka[Ga+1]=U.y,Ka[Ga+2]=U.z,Ka[Ga+3]=V.x,Ka[Ga+4]=V.y,Ka[Ga+5]=V.z,Ka[Ga+6]=W.x,Ka[Ga+7]=W.y,Ka[Ga+8]=W.z,Ga+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=Wb[L.a].position,V=Wb[L.b].position,W=Wb[L.c].position,oa=Wb[L.d].position,Ka[Ga]=U.x,Ka[Ga+1]=U.y,Ka[Ga+
-2]=U.z,Ka[Ga+3]=V.x,Ka[Ga+4]=V.y,Ka[Ga+5]=V.z,Ka[Ga+6]=W.x,Ka[Ga+7]=W.y,Ka[Ga+8]=W.z,Ka[Ga+9]=oa.x,Ka[Ga+10]=oa.y,Ka[Ga+11]=oa.z,Ga+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ka,bb)}if(pd)for(cb=0,$c=Sb.length;cb<$c;cb++){Ca=0;for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=Sb[cb].vertices[L.a].position,V=Sb[cb].vertices[L.b].position,W=Sb[cb].vertices[L.c].position,Ia=Pc[cb],Ia[Ca]=U.x,Ia[Ca+1]=U.y,Ia[Ca+2]=U.z,Ia[Ca+3]=V.x,Ia[Ca+4]=V.y,Ia[Ca+5]=V.z,Ia[Ca+6]=W.x,
-Ia[Ca+7]=W.y,Ia[Ca+8]=W.z,Ca+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=Sb[cb].vertices[L.a].position,V=Sb[cb].vertices[L.b].position,W=Sb[cb].vertices[L.c].position,oa=Sb[cb].vertices[L.d].position,Ia=Pc[cb],Ia[Ca]=U.x,Ia[Ca+1]=U.y,Ia[Ca+2]=U.z,Ia[Ca+3]=V.x,Ia[Ca+4]=V.y,Ia[Ca+5]=V.z,Ia[Ca+6]=W.x,Ia[Ca+7]=W.y,Ia[Ca+8]=W.z,Ia[Ca+9]=oa.x,Ia[Ca+10]=oa.y,Ia[Ca+11]=oa.z,Ca+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,Pc[cb],bb)}if(Rb.length){for(G=0,
-R=la.length;G<R;G++)L=Da[la[G]],ub=Rb[L.a],vb=Rb[L.b],wb=Rb[L.c],va[I]=ub.x,va[I+1]=ub.y,va[I+2]=ub.z,va[I+3]=ub.w,va[I+4]=vb.x,va[I+5]=vb.y,va[I+6]=vb.z,va[I+7]=vb.w,va[I+8]=wb.x,va[I+9]=wb.y,va[I+10]=wb.z,va[I+11]=wb.w,xb=Zb[L.a],yb=Zb[L.b],zb=Zb[L.c],ua[I]=xb.x,ua[I+1]=xb.y,ua[I+2]=xb.z,ua[I+3]=xb.w,ua[I+4]=yb.x,ua[I+5]=yb.y,ua[I+6]=yb.z,ua[I+7]=yb.w,ua[I+8]=zb.x,ua[I+9]=zb.y,ua[I+10]=zb.z,ua[I+11]=zb.w,Kb=Xb[L.a],Lb=Xb[L.b],Mb=Xb[L.c],sa[I]=Kb.x,sa[I+1]=Kb.y,sa[I+2]=Kb.z,sa[I+3]=1,sa[I+4]=Lb.x,
-sa[I+5]=Lb.y,sa[I+6]=Lb.z,sa[I+7]=1,sa[I+8]=Mb.x,sa[I+9]=Mb.y,sa[I+10]=Mb.z,sa[I+11]=1,Nb=Yb[L.a],Ob=Yb[L.b],Pb=Yb[L.c],ta[I]=Nb.x,ta[I+1]=Nb.y,ta[I+2]=Nb.z,ta[I+3]=1,ta[I+4]=Ob.x,ta[I+5]=Ob.y,ta[I+6]=Ob.z,ta[I+7]=1,ta[I+8]=Pb.x,ta[I+9]=Pb.y,ta[I+10]=Pb.z,ta[I+11]=1,I+=12;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],ub=Rb[L.a],vb=Rb[L.b],wb=Rb[L.c],mc=Rb[L.d],va[I]=ub.x,va[I+1]=ub.y,va[I+2]=ub.z,va[I+3]=ub.w,va[I+4]=vb.x,va[I+5]=vb.y,va[I+6]=vb.z,va[I+7]=vb.w,va[I+8]=wb.x,va[I+9]=wb.y,va[I+10]=wb.z,va[I+
-11]=wb.w,va[I+12]=mc.x,va[I+13]=mc.y,va[I+14]=mc.z,va[I+15]=mc.w,xb=Zb[L.a],yb=Zb[L.b],zb=Zb[L.c],nc=Zb[L.d],ua[I]=xb.x,ua[I+1]=xb.y,ua[I+2]=xb.z,ua[I+3]=xb.w,ua[I+4]=yb.x,ua[I+5]=yb.y,ua[I+6]=yb.z,ua[I+7]=yb.w,ua[I+8]=zb.x,ua[I+9]=zb.y,ua[I+10]=zb.z,ua[I+11]=zb.w,ua[I+12]=nc.x,ua[I+13]=nc.y,ua[I+14]=nc.z,ua[I+15]=nc.w,Kb=Xb[L.a],Lb=Xb[L.b],Mb=Xb[L.c],zc=Xb[L.d],sa[I]=Kb.x,sa[I+1]=Kb.y,sa[I+2]=Kb.z,sa[I+3]=1,sa[I+4]=Lb.x,sa[I+5]=Lb.y,sa[I+6]=Lb.z,sa[I+7]=1,sa[I+8]=Mb.x,sa[I+9]=Mb.y,sa[I+10]=Mb.z,
-sa[I+11]=1,sa[I+12]=zc.x,sa[I+13]=zc.y,sa[I+14]=zc.z,sa[I+15]=1,Nb=Yb[L.a],Ob=Yb[L.b],Pb=Yb[L.c],Ac=Yb[L.d],ta[I]=Nb.x,ta[I+1]=Nb.y,ta[I+2]=Nb.z,ta[I+3]=1,ta[I+4]=Ob.x,ta[I+5]=Ob.y,ta[I+6]=Ob.z,ta[I+7]=1,ta[I+8]=Pb.x,ta[I+9]=Pb.y,ta[I+10]=Pb.z,ta[I+11]=1,ta[I+12]=Ac.x,ta[I+13]=Ac.y,ta[I+14]=Ac.z,ta[I+15]=1,I+=16;0<I&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,bb),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ta,bb),
-j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,bb),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,bb))}if(od&&Oc){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],nb=L.vertexColors,yc=L.color,3===nb.length&&Oc===THREE.VertexColors?(rb=nb[0],sb=nb[1],tb=nb[2]):tb=sb=rb=yc,La[Ba]=rb.r,La[Ba+1]=rb.g,La[Ba+2]=rb.b,La[Ba+3]=sb.r,La[Ba+4]=sb.g,La[Ba+5]=sb.b,La[Ba+6]=tb.r,La[Ba+7]=tb.g,La[Ba+8]=tb.b,Ba+=9;for(G=0,R=ma.length;G<R;G++)L=
-Da[ma[G]],nb=L.vertexColors,yc=L.color,4===nb.length&&Oc===THREE.VertexColors?(rb=nb[0],sb=nb[1],tb=nb[2],lc=nb[3]):lc=tb=sb=rb=yc,La[Ba]=rb.r,La[Ba+1]=rb.g,La[Ba+2]=rb.b,La[Ba+3]=sb.r,La[Ba+4]=sb.g,La[Ba+5]=sb.b,La[Ba+6]=tb.r,La[Ba+7]=tb.g,La[Ba+8]=tb.b,La[Ba+9]=lc.r,La[Ba+10]=lc.g,La[Ba+11]=lc.b,Ba+=12;0<Ba&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,La,bb))}if(nd&&Ta.hasTangents){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],Db=L.vertexTangents,ob=Db[0],pb=Db[1],
-qb=Db[2],ra[pa]=ob.x,ra[pa+1]=ob.y,ra[pa+2]=ob.z,ra[pa+3]=ob.w,ra[pa+4]=pb.x,ra[pa+5]=pb.y,ra[pa+6]=pb.z,ra[pa+7]=pb.w,ra[pa+8]=qb.x,ra[pa+9]=qb.y,ra[pa+10]=qb.z,ra[pa+11]=qb.w,pa+=12;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],Db=L.vertexTangents,ob=Db[0],pb=Db[1],qb=Db[2],kc=Db[3],ra[pa]=ob.x,ra[pa+1]=ob.y,ra[pa+2]=ob.z,ra[pa+3]=ob.w,ra[pa+4]=pb.x,ra[pa+5]=pb.y,ra[pa+6]=pb.z,ra[pa+7]=pb.w,ra[pa+8]=qb.x,ra[pa+9]=qb.y,ra[pa+10]=qb.z,ra[pa+11]=qb.w,ra[pa+12]=kc.x,ra[pa+13]=kc.y,ra[pa+14]=kc.z,ra[pa+15]=
-kc.w,pa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,bb)}if(md&&Wc){for(G=0,R=la.length;G<R;G++)if(L=Da[la[G]],cc=L.vertexNormals,Jb=L.normal,3===cc.length&&Yc)for(ka=0;3>ka;ka++)Qb=cc[ka],hb[Pa]=Qb.x,hb[Pa+1]=Qb.y,hb[Pa+2]=Qb.z,Pa+=3;else for(ka=0;3>ka;ka++)hb[Pa]=Jb.x,hb[Pa+1]=Jb.y,hb[Pa+2]=Jb.z,Pa+=3;for(G=0,R=ma.length;G<R;G++)if(L=Da[ma[G]],cc=L.vertexNormals,Jb=L.normal,4===cc.length&&Yc)for(ka=0;4>ka;ka++)Qb=cc[ka],hb[Pa]=Qb.x,hb[Pa+1]=Qb.y,hb[Pa+
-2]=Qb.z,Pa+=3;else for(ka=0;4>ka;ka++)hb[Pa]=Jb.x,hb[Pa+1]=Jb.y,hb[Pa+2]=Jb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,bb)}if(ad&&Rc&&Xc){for(G=0,R=la.length;G<R;G++)if(jb=la[G],L=Da[jb],dc=Rc[jb],void 0!==dc)for(ka=0;3>ka;ka++)fc=dc[ka],oc[Eb]=fc.u,oc[Eb+1]=fc.v,Eb+=2;for(G=0,R=ma.length;G<R;G++)if(jb=ma[G],L=Da[jb],dc=Rc[jb],void 0!==dc)for(ka=0;4>ka;ka++)fc=dc[ka],oc[Eb]=fc.u,oc[Eb+1]=fc.v,Eb+=2;0<Eb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUVBuffer),
-j.bufferData(j.ARRAY_BUFFER,oc,bb))}if(ad&&Sc&&Xc){for(G=0,R=la.length;G<R;G++)if(jb=la[G],L=Da[jb],ec=Sc[jb],void 0!==ec)for(ka=0;3>ka;ka++)gc=ec[ka],pc[Fb]=gc.u,pc[Fb+1]=gc.v,Fb+=2;for(G=0,R=ma.length;G<R;G++)if(jb=ma[G],L=Da[jb],ec=Sc[jb],void 0!==ec)for(ka=0;4>ka;ka++)gc=ec[ka],pc[Fb]=gc.u,pc[Fb+1]=gc.v,Fb+=2;0<Fb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,pc,bb))}if(ld){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],Ab[gb]=za,Ab[gb+1]=za+1,Ab[gb+2]=za+2,gb+=3,$a[Sa]=
-za,$a[Sa+1]=za+1,$a[Sa+2]=za,$a[Sa+3]=za+2,$a[Sa+4]=za+1,$a[Sa+5]=za+2,Sa+=6,za+=3;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],Ab[gb]=za,Ab[gb+1]=za+1,Ab[gb+2]=za+3,Ab[gb+3]=za+1,Ab[gb+4]=za+2,Ab[gb+5]=za+3,gb+=6,$a[Sa]=za,$a[Sa+1]=za+1,$a[Sa+2]=za,$a[Sa+3]=za+3,$a[Sa+4]=za+1,$a[Sa+5]=za+2,$a[Sa+6]=za+2,$a[Sa+7]=za+3,Sa+=8,za+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ab,bb);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
-$a,bb)}if(Qc)for(ka=0,Zc=Qc.length;ka<Zc;ka++)if(w=Qc[ka],w.__original.needsUpdate){z=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],w.array[z]=w.value[L.a],w.array[z+1]=w.value[L.b],w.array[z+2]=w.value[L.c],z+=3;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],w.array[z]=w.value[L.a],w.array[z+1]=w.value[L.b],w.array[z+2]=w.value[L.c],w.array[z+3]=w.value[L.d],z+=4}else{if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)Za=w.value[la[G]],w.array[z]=
-Za,w.array[z+1]=Za,w.array[z+2]=Za,z+=3;for(G=0,R=ma.length;G<R;G++)Za=w.value[ma[G]],w.array[z]=Za,w.array[z+1]=Za,w.array[z+2]=Za,w.array[z+3]=Za,z+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,z+=6;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],oa=w.value[L.d],
-w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,w.array[z+6]=oa.x,w.array[z+7]=oa.y,z+=8}else{if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,z+=6;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,w.array[z+6]=oa.x,w.array[z+
-7]=oa.y,z+=8}}else if(3===w.size){var ea;ea="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],z+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],
-oa=w.value[L.d],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],w.array[z+9]=oa[ea[0]],w.array[z+10]=oa[ea[1]],w.array[z+11]=oa[ea[2]],z+=12}else if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+
-6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],z+=9;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],w.array[z+9]=oa[ea[0]],w.array[z+10]=oa[ea[1]],w.array[z+11]=oa[ea[2]],z+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],
-V=w.value[L.b],W=w.value[L.c],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,z+=12;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],oa=w.value[L.d],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+
-9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,w.array[z+12]=oa.x,w.array[z+13]=oa.y,w.array[z+14]=oa.z,w.array[z+15]=oa.w,z+=16}else if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,z+=12;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U.x,w.array[z+1]=U.y,
-w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,w.array[z+12]=oa.x,w.array[z+13]=oa.y,w.array[z+14]=oa.z,w.array[z+15]=oa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,bb)}kd&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,delete da.__tangentArray,delete da.__uvArray,delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,
-delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Va.attributes&&n(Va)}else if(mb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Tb=ia,bd=j.DYNAMIC_DRAW,qc=void 0,rc=void 0,Bc=void 0,Ub=void 0,Cc=void 0,cd=Tb.vertices,dd=Tb.colors,qd=cd.length,
-rd=dd.length,Dc=Tb.__vertexArray,Ec=Tb.__colorArray,sd=Tb.__dirtyColors;if(Tb.__dirtyVertices){for(qc=0;qc<qd;qc++)Bc=cd[qc].position,Ub=3*qc,Dc[Ub]=Bc.x,Dc[Ub+1]=Bc.y,Dc[Ub+2]=Bc.z;j.bindBuffer(j.ARRAY_BUFFER,Tb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Dc,bd)}if(sd){for(rc=0;rc<rd;rc++)Cc=dd[rc],Ub=3*rc,Ec[Ub]=Cc.r,Ec[Ub+1]=Cc.g,Ec[Ub+2]=Cc.b;j.bindBuffer(j.ARRAY_BUFFER,Tb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ec,bd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(mb instanceof
-THREE.Line){Va=c(mb,jc);bc=Va.attributes&&p(Va);if(ia.__dirtyVertices||ia.__dirtyColors||bc){var Gb=ia,Tc=j.DYNAMIC_DRAW,sc=void 0,tc=void 0,Fc=void 0,wa=void 0,Gc=void 0,ed=Gb.vertices,fd=Gb.colors,td=ed.length,ud=fd.length,Hc=Gb.__vertexArray,Ic=Gb.__colorArray,vd=Gb.__dirtyColors,Uc=Gb.__webglCustomAttributesList,Jc=void 0,gd=void 0,Na=void 0,hc=void 0,Wa=void 0,qa=void 0;if(Gb.__dirtyVertices){for(sc=0;sc<td;sc++)Fc=ed[sc].position,wa=3*sc,Hc[wa]=Fc.x,Hc[wa+1]=Fc.y,Hc[wa+2]=Fc.z;j.bindBuffer(j.ARRAY_BUFFER,
-Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Hc,Tc)}if(vd){for(tc=0;tc<ud;tc++)Gc=fd[tc],wa=3*tc,Ic[wa]=Gc.r,Ic[wa+1]=Gc.g,Ic[wa+2]=Gc.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ic,Tc)}if(Uc)for(Jc=0,gd=Uc.length;Jc<gd;Jc++)if(qa=Uc[Jc],qa.needsUpdate&&(void 0===qa.boundTo||"vertices"===qa.boundTo)){wa=0;hc=qa.value.length;if(1===qa.size)for(Na=0;Na<hc;Na++)qa.array[Na]=qa.value[Na];else if(2===qa.size)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,
-qa.array[wa+1]=Wa.y,wa+=2;else if(3===qa.size)if("c"===qa.type)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.r,qa.array[wa+1]=Wa.g,qa.array[wa+2]=Wa.b,wa+=3;else for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,qa.array[wa+1]=Wa.y,qa.array[wa+2]=Wa.z,wa+=3;else if(4===qa.size)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,qa.array[wa+1]=Wa.y,qa.array[wa+2]=Wa.z,qa.array[wa+3]=Wa.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,qa.buffer);j.bufferData(j.ARRAY_BUFFER,qa.array,Tc)}}ia.__dirtyVertices=
-!1;ia.__dirtyColors=!1;Va.attributes&&n(Va)}else if(mb instanceof THREE.ParticleSystem)Va=c(mb,jc),bc=Va.attributes&&p(Va),(ia.__dirtyVertices||ia.__dirtyColors||mb.sortParticles||bc)&&g(ia,j.DYNAMIC_DRAW,mb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Va.attributes&&n(Va)}};this.initMaterial=function(a,b,c,d){var f,e,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?
-i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var m=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var k,l;e=m=0;for(k=0,l=b.length;k<l;k++)f=b[k],f.onlyShadow||(f instanceof THREE.DirectionalLight&&e++,f instanceof THREE.PointLight&&m++,f instanceof THREE.SpotLight&&m++);m+e<=M?k=e:(k=
-Math.ceil(M*e/(m+e)),m=M-k);f=k;e=m;var n=0;for(m=0,k=b.length;m<k;m++)l=b[m],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight)&&n++;var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;l=a.vertexShader;var m=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:f,maxPointLights:e,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):(d.push(k),d.push(l));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=X.length;q<d;q++)if(X[q].code===i){p=X[q].program;break a}q=j.createProgram();d=[0<ya?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":
-"",H.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.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":
-"",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");
+null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,f.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,f._normalMatrixArray);
+(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,f._objectMatrixArray);return e}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){fa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),fa=a);if(a&&(Ra!==b||na!==c))j.polygonOffset(b,
+c),Ra=b,na=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function u(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,B(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,B(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,B(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,B(b.minFilter))):
+(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)))}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
+j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
+case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
+case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",A=void 0!==a.alpha?a.alpha:!0,E=void 0!==a.premultipliedAlpha?
+a.premultipliedAlpha:!0,J=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,Y=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,K=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),O=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
+this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var H=this,j,X=[],y=null,F=null,P=-1,Q=null,ca=null,ga=0,ba=null,T=null,aa=null,S=null,$=null,fa=null,Ra=null,na=null,Ja=null,Ea=0,Aa=0,ja=0,ab=0,kb=0,db=0,Xa=new THREE.Frustum,
+Ya=new THREE.Matrix4,Qa=new THREE.Vector4,Fa=new THREE.Vector3,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{alpha:A,premultipliedAlpha:E,antialias:J,stencil:N,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(K.r,K.g,K.b,O);this.context=j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Oa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=
+function(){return 0<ya};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Ea=a;Aa=b;ja=c;ab=d;j.viewport(Ea,Aa,ja,ab)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){K.setHex(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.setClearColor=function(a,b){K.copy(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.getClearColor=
+function(){return K};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
+j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
+j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=
+function(a,b){y=null;P=Q=$=S=aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,e,g,h,i,m,k,l,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],f=c[n+1],e=c[n+2],g=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+g+h)/3,f=(f+i+m)/3,e=(e+k+l)/3,c[n]=d,c[n+1]=f,c[n+2]=e,c[n+3]=d,c[n+4]=f,c[n+5]=e,c[n+6]=d,c[n+7]=f,c[n+8]=e}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(0!==d.opacity&&(c=m(a,b,c,d,e),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?1:0),d!==Q&&(Q=d,b=!0),e instanceof THREE.Mesh)){e=f.offsets;d=0;for(c=e.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexPositionBuffer),j.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*e[d].index),0<=a.normal&&f.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexNormalBuffer),j.vertexAttribPointer(a.normal,
+f.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*e[d].index)),0<=a.uv&&f.vertexUvBuffer&&(f.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,f.vertexUvBuffer),j.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*e[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&f.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,f.vertexColorBuffer),j.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*e[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
+f.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,e[d].count,j.UNSIGNED_SHORT,2*e[d].start),H.info.render.calls++,H.info.render.vertices+=e[d].count,H.info.render.faces+=e[d].count/3}};this.renderBuffer=function(a,b,c,d,f,e){if(0!==d.opacity){var g,h,c=m(a,b,c,d,e),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==Q&&(Q=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(e.morphTargetBase){c=
+d.program.attributes;-1!==e.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(e.morphTargetForcedOrder.length){g=0;var i=e.morphTargetForcedOrder;for(h=e.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+
+g],3,j.FLOAT,!1,0,0),e.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=e.morphTargetInfluences;var n,o=h.length;g=0;for(-1!==e.morphTargetBase&&(i[e.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);e.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
+e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(g=0,h=f.__webglCustomAttributesList.length;g<h;g++)c=f.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglNormalBuffer),j.vertexAttribPointer(b.normal,
+3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(f.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));
+d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,
+4,j.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ja&&(j.lineWidth(d),Ja=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),j.drawElements(j.LINES,f.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),j.drawElements(j.TRIANGLES,f.__webglFaceCount,j.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=f.__webglFaceCount,H.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===
+THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==Ja&&(j.lineWidth(d),Ja=d),j.drawArrays(e,0,f.__webglLineCount),H.info.render.calls++):e instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,f.__webglParticleCount),H.info.render.calls++,H.info.render.points+=f.__webglParticleCount):e instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,f.__webglVertexCount),H.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,m,l,n=a.lights,o=a.fog;P=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);
+b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ya.multiply(b.projectionMatrix,b.matrixWorldInverse);Xa.setFromMatrix(Ya);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;for(d=0,f=l.length;d<f;d++)if(g=l[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||Xa.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=
+g,q=p.object,F=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=F.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(Qa.copy(m.position),Ya.multiplyVector3(Qa),g.z=Qa.z)}this.sortObjects&&l.sort(e);l=a.__webglObjectsImmediate;for(d=0,f=l.length;d<
+f;d++)if(g=l[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,
+!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,f){var e=m(a,b,c,d,f);Q=-1;H.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(e,j,Xa):f.render(function(a){H.renderBufferImmediate(a,e,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],h=a,i=void 0,m=void 0,k=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){if(m=e.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=
+m,s=void 0,t=void 0,F=void 0,x=void 0,P=void 0,u=void 0,v=void 0,y={},Q=r.morphTargets.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)F=r.faces[s],x=F.materialIndex,u=void 0!==x?x:-1,void 0===y[u]&&(y[u]={hash:u,counter:0}),v=y[u].hash+"_"+y[u].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:Q}),P=F instanceof THREE.Face3?3:4,65535<r.geometryGroups[v].vertices+P&&(y[u].counter+=1,v=y[u].hash+"_"+y[u].counter,void 0===
+r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:Q})),F instanceof THREE.Face3?r.geometryGroups[v].faces3.push(s):r.geometryGroups[v].faces4.push(s),r.geometryGroups[v].vertices+=P;r.geometryGroupsList=[];var C=void 0;for(C in r.geometryGroups)r.geometryGroups[C].id=ga++,r.geometryGroupsList.push(r.geometryGroups[C])}for(i in m.geometryGroups)if(k=m.geometryGroups[i],!k.__webglVertexBuffer){var A=k;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=
+j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var B=void 0,D=void 0;A.__webglMorphTargetsBuffers=[];for(B=0,D=
+A.numMorphTargets;B<D;B++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}H.info.memory.geometries++;var E=k,M=e,K=M.geometry,J=E.faces3,ca=E.faces4,T=3*J.length+4*ca.length,ba=1*J.length+2*ca.length,N=3*J.length+4*ca.length,S=c(M,E),aa=f(S),$=d(S),O=S.vertexColors?S.vertexColors:!1;E.__vertexArray=new Float32Array(3*T);if($)E.__normalArray=new Float32Array(3*T);if(K.hasTangents)E.__tangentArray=new Float32Array(4*T);if(O)E.__colorArray=new Float32Array(3*T);if(aa){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)E.__uvArray=
+new Float32Array(2*T);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)E.__uv2Array=new Float32Array(2*T)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length)E.__skinVertexAArray=new Float32Array(4*T),E.__skinVertexBArray=new Float32Array(4*T),E.__skinIndexArray=new Float32Array(4*T),E.__skinWeightArray=new Float32Array(4*T);E.__faceArray=new Uint16Array(3*ba);E.__lineArray=new Uint16Array(2*N);if(E.numMorphTargets){E.__morphTargetsArrays=[];for(var fa=0,Y=E.numMorphTargets;fa<Y;fa++)E.__morphTargetsArrays.push(new Float32Array(3*
+T))}E.__webglFaceCount=3*ba;E.__webglLineCount=2*N;if(S.attributes){if(void 0===E.__webglCustomAttributesList)E.__webglCustomAttributesList=[];var X=void 0;for(X in S.attributes){var Ra=S.attributes[X],na={},Ja;for(Ja in Ra)na[Ja]=Ra[Ja];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var ja=1;"v2"===na.type?ja=2:"v3"===na.type?ja=3:"v4"===na.type?ja=4:"c"===na.type&&(ja=3);na.size=ja;na.array=new Float32Array(T*ja);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=
+X;Ra.needsUpdate=!0;na.__original=Ra}E.__webglCustomAttributesList.push(na)}}E.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}}else if(e instanceof THREE.Ribbon){if(m=e.geometry,!m.__webglVertexBuffer){var Aa=m;Aa.__webglVertexBuffer=j.createBuffer();Aa.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Ea=m,xa=Ea.vertices.length;Ea.__vertexArray=new Float32Array(3*xa);
+Ea.__colorArray=new Float32Array(3*xa);Ea.__webglVertexCount=xa;m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(e instanceof THREE.Line){if(m=e.geometry,!m.__webglVertexBuffer){var ya=m;ya.__webglVertexBuffer=j.createBuffer();ya.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Fa=m,Oa=e,ab=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*ab);Fa.__colorArray=new Float32Array(3*ab);Fa.__webglLineCount=ab;b(Fa,Oa);m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(e instanceof
+THREE.ParticleSystem&&(m=e.geometry,!m.__webglVertexBuffer)){var Ya=m;Ya.__webglVertexBuffer=j.createBuffer();Ya.__webglColorBuffer=j.createBuffer();H.info.geometries++;var Qa=m,kb=e,db=Qa.vertices.length;Qa.__vertexArray=new Float32Array(3*db);Qa.__colorArray=new Float32Array(3*db);Qa.__sortArray=[];Qa.__webglParticleCount=db;b(Qa,kb);m.__dirtyVertices=!0;m.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)if(m=e.geometry,m instanceof THREE.BufferGeometry)l(h.__webglObjects,m,e);else for(i in m.geometryGroups)k=
+m.geometryGroups[i],l(h.__webglObjects,k,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(m=e.geometry,l(h.__webglObjects,m,e)):void 0!==THREE.MarchingCubes&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?h.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite?h.__webglSprites.push(e):e instanceof THREE.LensFlare&&h.__webglFlares.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fb=
+a.__objectsRemoved[0],Xa=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(Xa.__webglObjects,fb):fb instanceof THREE.Sprite?q(Xa.__webglSprites,fb):fb instanceof THREE.LensFlare?q(Xa.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(Xa.__webglObjectsImmediate,fb);fb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Mc=0,hd=a.__webglObjects.length;Mc<hd;Mc++){var mb=a.__webglObjects[Mc].object,
+ia=mb.geometry,jc=void 0,bc=void 0,Va=void 0;if(mb instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Nc=0,id=ia.geometryGroupsList.length;Nc<id;Nc++)if(jc=ia.geometryGroupsList[Nc],Va=c(mb,jc),bc=Va.attributes&&p(Va),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||bc){var da=jc,jd=mb,bb=
+j.DYNAMIC_DRAW,kd=!ia.dynamic,xc=Va;if(da.__inittedArrays){var Wc=d(xc),Oc=xc.vertexColors?xc.vertexColors:!1,Xc=f(xc),Yc=Wc===THREE.SmoothShading,G=void 0,R=void 0,jb=void 0,L=void 0,cc=void 0,Jb=void 0,nb=void 0,yc=void 0,Db=void 0,dc=void 0,ec=void 0,U=void 0,V=void 0,W=void 0,oa=void 0,ob=void 0,pb=void 0,qb=void 0,kc=void 0,rb=void 0,sb=void 0,tb=void 0,lc=void 0,ub=void 0,vb=void 0,wb=void 0,mc=void 0,xb=void 0,yb=void 0,zb=void 0,nc=void 0,Kb=void 0,Lb=void 0,Mb=void 0,zc=void 0,Nb=void 0,
+Ob=void 0,Pb=void 0,Ac=void 0,ka=void 0,Zc=void 0,Qb=void 0,fc=void 0,gc=void 0,cb=void 0,$c=void 0,Ia=void 0,za=0,Ga=0,Eb=0,Fb=0,gb=0,Pa=0,pa=0,Sa=0,Ba=0,I=0,Ca=0,z=0,Za=void 0,Ka=da.__vertexArray,oc=da.__uvArray,pc=da.__uv2Array,hb=da.__normalArray,ra=da.__tangentArray,La=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Pc=da.__morphTargetsArrays,Qc=da.__webglCustomAttributesList,w=void 0,Ab=da.__faceArray,$a=da.__lineArray,Ta=jd.geometry,
+ld=Ta.__dirtyElements,ad=Ta.__dirtyUvs,md=Ta.__dirtyNormals,nd=Ta.__dirtyTangents,od=Ta.__dirtyColors,pd=Ta.__dirtyMorphTargets,Wb=Ta.vertices,la=da.faces3,ma=da.faces4,Da=Ta.faces,Rc=Ta.faceVertexUvs[0],Sc=Ta.faceVertexUvs[1],Xb=Ta.skinVerticesA,Yb=Ta.skinVerticesB,Zb=Ta.skinIndices,Rb=Ta.skinWeights,Sb=Ta.morphTargets;if(Ta.__dirtyVertices){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=Wb[L.a].position,V=Wb[L.b].position,W=Wb[L.c].position,Ka[Ga]=U.x,Ka[Ga+1]=U.y,Ka[Ga+2]=U.z,Ka[Ga+3]=V.x,Ka[Ga+4]=
+V.y,Ka[Ga+5]=V.z,Ka[Ga+6]=W.x,Ka[Ga+7]=W.y,Ka[Ga+8]=W.z,Ga+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=Wb[L.a].position,V=Wb[L.b].position,W=Wb[L.c].position,oa=Wb[L.d].position,Ka[Ga]=U.x,Ka[Ga+1]=U.y,Ka[Ga+2]=U.z,Ka[Ga+3]=V.x,Ka[Ga+4]=V.y,Ka[Ga+5]=V.z,Ka[Ga+6]=W.x,Ka[Ga+7]=W.y,Ka[Ga+8]=W.z,Ka[Ga+9]=oa.x,Ka[Ga+10]=oa.y,Ka[Ga+11]=oa.z,Ga+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ka,bb)}if(pd)for(cb=0,$c=Sb.length;cb<$c;cb++){Ca=0;for(G=0,R=la.length;G<R;G++)L=
+Da[la[G]],U=Sb[cb].vertices[L.a].position,V=Sb[cb].vertices[L.b].position,W=Sb[cb].vertices[L.c].position,Ia=Pc[cb],Ia[Ca]=U.x,Ia[Ca+1]=U.y,Ia[Ca+2]=U.z,Ia[Ca+3]=V.x,Ia[Ca+4]=V.y,Ia[Ca+5]=V.z,Ia[Ca+6]=W.x,Ia[Ca+7]=W.y,Ia[Ca+8]=W.z,Ca+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=Sb[cb].vertices[L.a].position,V=Sb[cb].vertices[L.b].position,W=Sb[cb].vertices[L.c].position,oa=Sb[cb].vertices[L.d].position,Ia=Pc[cb],Ia[Ca]=U.x,Ia[Ca+1]=U.y,Ia[Ca+2]=U.z,Ia[Ca+3]=V.x,Ia[Ca+4]=V.y,Ia[Ca+5]=V.z,Ia[Ca+6]=
+W.x,Ia[Ca+7]=W.y,Ia[Ca+8]=W.z,Ia[Ca+9]=oa.x,Ia[Ca+10]=oa.y,Ia[Ca+11]=oa.z,Ca+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,Pc[cb],bb)}if(Rb.length){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],ub=Rb[L.a],vb=Rb[L.b],wb=Rb[L.c],va[I]=ub.x,va[I+1]=ub.y,va[I+2]=ub.z,va[I+3]=ub.w,va[I+4]=vb.x,va[I+5]=vb.y,va[I+6]=vb.z,va[I+7]=vb.w,va[I+8]=wb.x,va[I+9]=wb.y,va[I+10]=wb.z,va[I+11]=wb.w,xb=Zb[L.a],yb=Zb[L.b],zb=Zb[L.c],ua[I]=xb.x,ua[I+1]=xb.y,ua[I+2]=xb.z,ua[I+
+3]=xb.w,ua[I+4]=yb.x,ua[I+5]=yb.y,ua[I+6]=yb.z,ua[I+7]=yb.w,ua[I+8]=zb.x,ua[I+9]=zb.y,ua[I+10]=zb.z,ua[I+11]=zb.w,Kb=Xb[L.a],Lb=Xb[L.b],Mb=Xb[L.c],sa[I]=Kb.x,sa[I+1]=Kb.y,sa[I+2]=Kb.z,sa[I+3]=1,sa[I+4]=Lb.x,sa[I+5]=Lb.y,sa[I+6]=Lb.z,sa[I+7]=1,sa[I+8]=Mb.x,sa[I+9]=Mb.y,sa[I+10]=Mb.z,sa[I+11]=1,Nb=Yb[L.a],Ob=Yb[L.b],Pb=Yb[L.c],ta[I]=Nb.x,ta[I+1]=Nb.y,ta[I+2]=Nb.z,ta[I+3]=1,ta[I+4]=Ob.x,ta[I+5]=Ob.y,ta[I+6]=Ob.z,ta[I+7]=1,ta[I+8]=Pb.x,ta[I+9]=Pb.y,ta[I+10]=Pb.z,ta[I+11]=1,I+=12;for(G=0,R=ma.length;G<
+R;G++)L=Da[ma[G]],ub=Rb[L.a],vb=Rb[L.b],wb=Rb[L.c],mc=Rb[L.d],va[I]=ub.x,va[I+1]=ub.y,va[I+2]=ub.z,va[I+3]=ub.w,va[I+4]=vb.x,va[I+5]=vb.y,va[I+6]=vb.z,va[I+7]=vb.w,va[I+8]=wb.x,va[I+9]=wb.y,va[I+10]=wb.z,va[I+11]=wb.w,va[I+12]=mc.x,va[I+13]=mc.y,va[I+14]=mc.z,va[I+15]=mc.w,xb=Zb[L.a],yb=Zb[L.b],zb=Zb[L.c],nc=Zb[L.d],ua[I]=xb.x,ua[I+1]=xb.y,ua[I+2]=xb.z,ua[I+3]=xb.w,ua[I+4]=yb.x,ua[I+5]=yb.y,ua[I+6]=yb.z,ua[I+7]=yb.w,ua[I+8]=zb.x,ua[I+9]=zb.y,ua[I+10]=zb.z,ua[I+11]=zb.w,ua[I+12]=nc.x,ua[I+13]=nc.y,
+ua[I+14]=nc.z,ua[I+15]=nc.w,Kb=Xb[L.a],Lb=Xb[L.b],Mb=Xb[L.c],zc=Xb[L.d],sa[I]=Kb.x,sa[I+1]=Kb.y,sa[I+2]=Kb.z,sa[I+3]=1,sa[I+4]=Lb.x,sa[I+5]=Lb.y,sa[I+6]=Lb.z,sa[I+7]=1,sa[I+8]=Mb.x,sa[I+9]=Mb.y,sa[I+10]=Mb.z,sa[I+11]=1,sa[I+12]=zc.x,sa[I+13]=zc.y,sa[I+14]=zc.z,sa[I+15]=1,Nb=Yb[L.a],Ob=Yb[L.b],Pb=Yb[L.c],Ac=Yb[L.d],ta[I]=Nb.x,ta[I+1]=Nb.y,ta[I+2]=Nb.z,ta[I+3]=1,ta[I+4]=Ob.x,ta[I+5]=Ob.y,ta[I+6]=Ob.z,ta[I+7]=1,ta[I+8]=Pb.x,ta[I+9]=Pb.y,ta[I+10]=Pb.z,ta[I+11]=1,ta[I+12]=Ac.x,ta[I+13]=Ac.y,ta[I+14]=Ac.z,
+ta[I+15]=1,I+=16;0<I&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,bb),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ta,bb),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,bb),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,bb))}if(od&&Oc){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],nb=L.vertexColors,yc=L.color,3===nb.length&&Oc===THREE.VertexColors?
+(rb=nb[0],sb=nb[1],tb=nb[2]):tb=sb=rb=yc,La[Ba]=rb.r,La[Ba+1]=rb.g,La[Ba+2]=rb.b,La[Ba+3]=sb.r,La[Ba+4]=sb.g,La[Ba+5]=sb.b,La[Ba+6]=tb.r,La[Ba+7]=tb.g,La[Ba+8]=tb.b,Ba+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],nb=L.vertexColors,yc=L.color,4===nb.length&&Oc===THREE.VertexColors?(rb=nb[0],sb=nb[1],tb=nb[2],lc=nb[3]):lc=tb=sb=rb=yc,La[Ba]=rb.r,La[Ba+1]=rb.g,La[Ba+2]=rb.b,La[Ba+3]=sb.r,La[Ba+4]=sb.g,La[Ba+5]=sb.b,La[Ba+6]=tb.r,La[Ba+7]=tb.g,La[Ba+8]=tb.b,La[Ba+9]=lc.r,La[Ba+10]=lc.g,La[Ba+11]=lc.b,Ba+=
+12;0<Ba&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,La,bb))}if(nd&&Ta.hasTangents){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],Db=L.vertexTangents,ob=Db[0],pb=Db[1],qb=Db[2],ra[pa]=ob.x,ra[pa+1]=ob.y,ra[pa+2]=ob.z,ra[pa+3]=ob.w,ra[pa+4]=pb.x,ra[pa+5]=pb.y,ra[pa+6]=pb.z,ra[pa+7]=pb.w,ra[pa+8]=qb.x,ra[pa+9]=qb.y,ra[pa+10]=qb.z,ra[pa+11]=qb.w,pa+=12;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],Db=L.vertexTangents,ob=Db[0],pb=Db[1],qb=Db[2],kc=Db[3],ra[pa]=ob.x,ra[pa+1]=ob.y,
+ra[pa+2]=ob.z,ra[pa+3]=ob.w,ra[pa+4]=pb.x,ra[pa+5]=pb.y,ra[pa+6]=pb.z,ra[pa+7]=pb.w,ra[pa+8]=qb.x,ra[pa+9]=qb.y,ra[pa+10]=qb.z,ra[pa+11]=qb.w,ra[pa+12]=kc.x,ra[pa+13]=kc.y,ra[pa+14]=kc.z,ra[pa+15]=kc.w,pa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,bb)}if(md&&Wc){for(G=0,R=la.length;G<R;G++)if(L=Da[la[G]],cc=L.vertexNormals,Jb=L.normal,3===cc.length&&Yc)for(ka=0;3>ka;ka++)Qb=cc[ka],hb[Pa]=Qb.x,hb[Pa+1]=Qb.y,hb[Pa+2]=Qb.z,Pa+=3;else for(ka=0;3>ka;ka++)hb[Pa]=
+Jb.x,hb[Pa+1]=Jb.y,hb[Pa+2]=Jb.z,Pa+=3;for(G=0,R=ma.length;G<R;G++)if(L=Da[ma[G]],cc=L.vertexNormals,Jb=L.normal,4===cc.length&&Yc)for(ka=0;4>ka;ka++)Qb=cc[ka],hb[Pa]=Qb.x,hb[Pa+1]=Qb.y,hb[Pa+2]=Qb.z,Pa+=3;else for(ka=0;4>ka;ka++)hb[Pa]=Jb.x,hb[Pa+1]=Jb.y,hb[Pa+2]=Jb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,bb)}if(ad&&Rc&&Xc){for(G=0,R=la.length;G<R;G++)if(jb=la[G],L=Da[jb],dc=Rc[jb],void 0!==dc)for(ka=0;3>ka;ka++)fc=dc[ka],oc[Eb]=fc.u,oc[Eb+1]=fc.v,
+Eb+=2;for(G=0,R=ma.length;G<R;G++)if(jb=ma[G],L=Da[jb],dc=Rc[jb],void 0!==dc)for(ka=0;4>ka;ka++)fc=dc[ka],oc[Eb]=fc.u,oc[Eb+1]=fc.v,Eb+=2;0<Eb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,oc,bb))}if(ad&&Sc&&Xc){for(G=0,R=la.length;G<R;G++)if(jb=la[G],L=Da[jb],ec=Sc[jb],void 0!==ec)for(ka=0;3>ka;ka++)gc=ec[ka],pc[Fb]=gc.u,pc[Fb+1]=gc.v,Fb+=2;for(G=0,R=ma.length;G<R;G++)if(jb=ma[G],L=Da[jb],ec=Sc[jb],void 0!==ec)for(ka=0;4>ka;ka++)gc=ec[ka],pc[Fb]=gc.u,pc[Fb+1]=gc.v,
+Fb+=2;0<Fb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,pc,bb))}if(ld){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],Ab[gb]=za,Ab[gb+1]=za+1,Ab[gb+2]=za+2,gb+=3,$a[Sa]=za,$a[Sa+1]=za+1,$a[Sa+2]=za,$a[Sa+3]=za+2,$a[Sa+4]=za+1,$a[Sa+5]=za+2,Sa+=6,za+=3;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],Ab[gb]=za,Ab[gb+1]=za+1,Ab[gb+2]=za+3,Ab[gb+3]=za+1,Ab[gb+4]=za+2,Ab[gb+5]=za+3,gb+=6,$a[Sa]=za,$a[Sa+1]=za+1,$a[Sa+2]=za,$a[Sa+3]=za+3,$a[Sa+4]=za+1,$a[Sa+5]=za+2,$a[Sa+6]=za+2,$a[Sa+
+7]=za+3,Sa+=8,za+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ab,bb);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,$a,bb)}if(Qc)for(ka=0,Zc=Qc.length;ka<Zc;ka++)if(w=Qc[ka],w.__original.needsUpdate){z=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],w.array[z]=w.value[L.a],w.array[z+1]=w.value[L.b],w.array[z+2]=w.value[L.c],z+=3;for(G=0,R=ma.length;G<
+R;G++)L=Da[ma[G]],w.array[z]=w.value[L.a],w.array[z+1]=w.value[L.b],w.array[z+2]=w.value[L.c],w.array[z+3]=w.value[L.d],z+=4}else{if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)Za=w.value[la[G]],w.array[z]=Za,w.array[z+1]=Za,w.array[z+2]=Za,z+=3;for(G=0,R=ma.length;G<R;G++)Za=w.value[ma[G]],w.array[z]=Za,w.array[z+1]=Za,w.array[z+2]=Za,w.array[z+3]=Za,z+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],V=w.value[L.b],
+W=w.value[L.c],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,z+=6;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],oa=w.value[L.d],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,w.array[z+6]=oa.x,w.array[z+7]=oa.y,z+=8}else{if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+
+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,z+=6;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=V.x,w.array[z+3]=V.y,w.array[z+4]=W.x,w.array[z+5]=W.y,w.array[z+6]=oa.x,w.array[z+7]=oa.y,z+=8}}else if(3===w.size){var ea;ea="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=
+U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],z+=9;for(G=0,R=ma.length;G<R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],oa=w.value[L.d],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],w.array[z+9]=oa[ea[0]],w.array[z+10]=oa[ea[1]],w.array[z+11]=
+oa[ea[2]],z+=12}else if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],z+=9;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U[ea[0]],w.array[z+1]=U[ea[1]],w.array[z+2]=U[ea[2]],w.array[z+3]=V[ea[0]],w.array[z+4]=V[ea[1]],w.array[z+5]=V[ea[2]],w.array[z+6]=W[ea[0]],
+w.array[z+7]=W[ea[1]],w.array[z+8]=W[ea[2]],w.array[z+9]=oa[ea[0]],w.array[z+10]=oa[ea[1]],w.array[z+11]=oa[ea[2]],z+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,R=la.length;G<R;G++)L=Da[la[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,z+=12;for(G=0,R=ma.length;G<
+R;G++)L=Da[ma[G]],U=w.value[L.a],V=w.value[L.b],W=w.value[L.c],oa=w.value[L.d],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,w.array[z+12]=oa.x,w.array[z+13]=oa.y,w.array[z+14]=oa.z,w.array[z+15]=oa.w,z+=16}else if("faces"===w.boundTo){for(G=0,R=la.length;G<R;G++)W=V=U=Za=w.value[la[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+
+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,z+=12;for(G=0,R=ma.length;G<R;G++)oa=W=V=U=Za=w.value[ma[G]],w.array[z]=U.x,w.array[z+1]=U.y,w.array[z+2]=U.z,w.array[z+3]=U.w,w.array[z+4]=V.x,w.array[z+5]=V.y,w.array[z+6]=V.z,w.array[z+7]=V.w,w.array[z+8]=W.x,w.array[z+9]=W.y,w.array[z+10]=W.z,w.array[z+11]=W.w,w.array[z+12]=oa.x,w.array[z+13]=oa.y,w.array[z+14]=oa.z,w.array[z+15]=oa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,
+w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,bb)}kd&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,delete da.__tangentArray,delete da.__uvArray,delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=
+!1;ia.__dirtyTangents=!1;Va.attributes&&n(Va)}else if(mb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Tb=ia,bd=j.DYNAMIC_DRAW,qc=void 0,rc=void 0,Bc=void 0,Ub=void 0,Cc=void 0,cd=Tb.vertices,dd=Tb.colors,qd=cd.length,rd=dd.length,Dc=Tb.__vertexArray,Ec=Tb.__colorArray,sd=Tb.__dirtyColors;if(Tb.__dirtyVertices){for(qc=0;qc<qd;qc++)Bc=cd[qc].position,Ub=3*qc,Dc[Ub]=Bc.x,Dc[Ub+1]=Bc.y,Dc[Ub+2]=Bc.z;j.bindBuffer(j.ARRAY_BUFFER,Tb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
+Dc,bd)}if(sd){for(rc=0;rc<rd;rc++)Cc=dd[rc],Ub=3*rc,Ec[Ub]=Cc.r,Ec[Ub+1]=Cc.g,Ec[Ub+2]=Cc.b;j.bindBuffer(j.ARRAY_BUFFER,Tb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ec,bd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(mb instanceof THREE.Line){Va=c(mb,jc);bc=Va.attributes&&p(Va);if(ia.__dirtyVertices||ia.__dirtyColors||bc){var Gb=ia,Tc=j.DYNAMIC_DRAW,sc=void 0,tc=void 0,Fc=void 0,wa=void 0,Gc=void 0,ed=Gb.vertices,fd=Gb.colors,td=ed.length,ud=fd.length,Hc=Gb.__vertexArray,Ic=Gb.__colorArray,
+vd=Gb.__dirtyColors,Uc=Gb.__webglCustomAttributesList,Jc=void 0,gd=void 0,Na=void 0,hc=void 0,Wa=void 0,qa=void 0;if(Gb.__dirtyVertices){for(sc=0;sc<td;sc++)Fc=ed[sc].position,wa=3*sc,Hc[wa]=Fc.x,Hc[wa+1]=Fc.y,Hc[wa+2]=Fc.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Hc,Tc)}if(vd){for(tc=0;tc<ud;tc++)Gc=fd[tc],wa=3*tc,Ic[wa]=Gc.r,Ic[wa+1]=Gc.g,Ic[wa+2]=Gc.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ic,Tc)}if(Uc)for(Jc=0,gd=Uc.length;Jc<
+gd;Jc++)if(qa=Uc[Jc],qa.needsUpdate&&(void 0===qa.boundTo||"vertices"===qa.boundTo)){wa=0;hc=qa.value.length;if(1===qa.size)for(Na=0;Na<hc;Na++)qa.array[Na]=qa.value[Na];else if(2===qa.size)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,qa.array[wa+1]=Wa.y,wa+=2;else if(3===qa.size)if("c"===qa.type)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.r,qa.array[wa+1]=Wa.g,qa.array[wa+2]=Wa.b,wa+=3;else for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,qa.array[wa+1]=Wa.y,qa.array[wa+2]=
+Wa.z,wa+=3;else if(4===qa.size)for(Na=0;Na<hc;Na++)Wa=qa.value[Na],qa.array[wa]=Wa.x,qa.array[wa+1]=Wa.y,qa.array[wa+2]=Wa.z,qa.array[wa+3]=Wa.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,qa.buffer);j.bufferData(j.ARRAY_BUFFER,qa.array,Tc)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Va.attributes&&n(Va)}else if(mb instanceof THREE.ParticleSystem)Va=c(mb,jc),bc=Va.attributes&&p(Va),(ia.__dirtyVertices||ia.__dirtyColors||mb.sortParticles||bc)&&g(ia,j.DYNAMIC_DRAW,mb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,
+Va.attributes&&n(Va)}};this.initMaterial=function(a,b,c,d){var f,e,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var m=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);
+a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var k,l;e=m=0;for(k=0,l=b.length;k<l;k++)f=b[k],f.onlyShadow||(f instanceof THREE.DirectionalLight&&e++,f instanceof THREE.PointLight&&m++,f instanceof THREE.SpotLight&&m++);m+e<=M?k=e:(k=Math.ceil(M*e/(m+e)),m=M-k);f=k;e=m;var n=0;for(m=0,k=b.length;m<k;m++)l=b[m],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight)&&n++;var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;
+l=a.vertexShader;var m=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:f,maxPointLights:e,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];
+i?d.push(i):(d.push(k),d.push(l));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=X.length;q<d;q++)if(X[q].code===i){p=X[q].program;break a}q=j.createProgram();d=[0<ya?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",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;\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");
f=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",f+k));j.attachShader(q,t("vertex",d+l));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
-j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in m)d.push(r);r=d;for(d=0,m=r.length;d<m;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+
+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in m)d.push(r);r=d;for(d=0,m=r.length;d<m;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+
r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=X.length;X.push({program:q,code:i});H.info.memory.programs=X.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),
j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)r="morphTarget"+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++);a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||
"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ba!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ba=a.doubleSided;if(T!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),T=a.flipSided};this.setDepthTest=function(a){S!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),S=a)};this.setDepthWrite=
View
168 build/custom/ThreeWebGL.js
@@ -206,92 +206,92 @@ i._array[u+1]=n[k].y,i._array[u+2]=n[k].z;g.uniform3fv(m,i._array)}else if("v4v"
16*k);g.uniformMatrix4fv(m,!1,i._array)}else if("t"===k){if(g.uniform1i(m,n),m=i.texture)if(m.image instanceof Array&&6===m.image.length){if(i=m,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+n);g.bindTexture(g.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);n=[];for(m=0;6>m;m++){k=n;t=m;if(D.autoScaleCubemaps){if(u=i.image[m],y=uc,!(u.width<=y&&u.height<=y))A=Math.max(u.width,u.height),z=Math.floor(u.width*
y/A),y=Math.floor(u.height*y/A),A=document.createElement("canvas"),A.width=z,A.height=y,A.getContext("2d").drawImage(u,0,0,u.width,u.height,0,0,z,y),u=A}else u=i.image[m];k[t]=u}m=n[0];k=0===(m.width&m.width-1)&&0===(m.height&m.height-1);t=B(i.format);u=B(i.type);J(g.TEXTURE_CUBE_MAP,i,k);for(m=0;6>m;m++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,t,t,u,n[m]);i.generateMipmaps&&k&&g.generateMipmap(g.TEXTURE_CUBE_MAP);i.needsUpdate=!1;if(i.onUpdated)i.onUpdated()}else g.activeTexture(g.TEXTURE0+
n),g.bindTexture(g.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(i=m,g.activeTexture(g.TEXTURE0+n),g.bindTexture(g.TEXTURE_CUBE_MAP,i.__webglTexture)):D.setTexture(m,n)}else if("tv"===k){if(!i._array){i._array=[];for(k=0,t=i.texture.length;k<t;k++)i._array[k]=n+k}g.uniform1iv(m,i._array);for(k=0,t=i.texture.length;k<t;k++)(m=i.texture[k])&&D.setTexture(m,i._array[k])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
-null!==h.cameraPosition)b=a.matrixWorld.getPosition(),g.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&g.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(g.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),g.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices))}g.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrixArray);
-h.normalMatrix&&g.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==h.objectMatrix&&g.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return f}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){Pa!==a&&(a?g.enable(g.POLYGON_OFFSET_FILL):
-g.disable(g.POLYGON_OFFSET_FILL),Pa=a);if(a&&(Ta!==b||Ua!==c))g.polygonOffset(b,c),Ta=b,Ua=c}function y(a,b){var c;"fragment"===a?c=g.createShader(g.FRAGMENT_SHADER):"vertex"===a&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);return!g.getShaderParameter(c,g.COMPILE_STATUS)?(console.error(g.getShaderInfoLog(c)),console.error(b),null):c}function J(a,b,c){c?(g.texParameteri(a,g.TEXTURE_WRAP_S,B(b.wrapS)),g.texParameteri(a,g.TEXTURE_WRAP_T,B(b.wrapT)),g.texParameteri(a,g.TEXTURE_MAG_FILTER,
-B(b.magFilter)),g.texParameteri(a,g.TEXTURE_MIN_FILTER,B(b.minFilter))):(g.texParameteri(a,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_MAG_FILTER,u(b.magFilter)),g.texParameteri(a,g.TEXTURE_MIN_FILTER,u(b.minFilter)))}function K(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,
-g.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,a)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function u(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return g.REPEAT;
-case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return g.BYTE;
-case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedShortType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA}return 0}var a=a||{},H=void 0!==
-a.canvas?a.canvas:document.createElement("canvas"),A=void 0!==a.precision?a.precision:"mediump",M=void 0!==a.alpha?a.alpha:!0,N=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,I=void 0!==a.antialias?a.antialias:!1,S=void 0!==a.stencil?a.stencil:!0,ua=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),$=void 0!==a.clearAlpha?a.clearAlpha:0,Z=void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;
-this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};
-var D=this,g,Sa=[],ba=null,pa=null,Q=-1,L=null,W=null,ya=0,ca=null,Ea=null,Ba=null,Na=null,Oa=null,Pa=null,Ta=null,Ua=null,nb=null,Fb=0,Pb=0,Ab=0,Gb=0,cc=0,dc=0,Qb=new THREE.Frustum,Va=new THREE.Matrix4,Ia=new THREE.Vector4,ib=new THREE.Vector3,ec={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};g=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:N,antialias:I,stencil:S,preserveDrawingBuffer:ua})))throw"Error creating WebGL context.";
-console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(ka.r,ka.g,ka.b,$);
-this.context=g;var fc=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var uc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return g};this.supportsVertexTextures=function(){return 0<fc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){Fb=a;Pb=b;Ab=c;Gb=d;g.viewport(Fb,Pb,Ab,Gb)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?
-g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.setClearColor=function(a,b){ka.copy(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return $};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=g.COLOR_BUFFER_BIT;if(void 0===b||b)d|=g.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=g.STENCIL_BUFFER_BIT;g.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
-this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);
-g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=
-void 0,c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),
-g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,g.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){ba=null;Q=L=Oa=Na=Ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();a.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer),
-g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(b.attributes.position),g.vertexAttribPointer(b.attributes.position,3,g.FLOAT,!1,0,0));if(a.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,h,i,j,n,m,k,l,p=3*a.count;for(l=0;l<p;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],h=c[l+3],j=c[l+4],m=c[l+5],i=c[l+6],n=c[l+7],k=c[l+8],d=(d+h+i)/3,e=(e+j+n)/3,f=(f+m+k)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,
-c[l+6]=d,c[l+7]=e,c[l+8]=f}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,3,g.FLOAT,!1,0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=r(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==L&&(L=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexPositionBuffer),
-g.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexNormalBuffer),g.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.vertexUvBuffer),g.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,g.FLOAT,!1,0,8*f[d].index),g.enableVertexAttribArray(a.uv)):g.disableVertexAttribArray(a.uv)),
-0<=a.color&&e.vertexColorBuffer&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexColorBuffer),g.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,g.FLOAT,!1,0,16*f[d].index)),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,2*f[d].start),D.info.render.calls++,D.info.render.vertices+=f[d].count,D.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var h,i,c=r(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*
-e.id+2*c.id+(d.wireframe?1:0);c!==L&&(L=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer),g.vertexAttribPointer(b.position,3,g.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):0<=c.position&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,
-!1,0,0));if(f.morphTargetForcedOrder.length){h=0;var j=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[h]]),g.vertexAttribPointer(c["morphTarget"+h],3,g.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],n=-1,l=0;i=f.morphTargetInfluences;var m,k=i.length;h=0;for(-1!==f.morphTargetBase&&(j[f.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(m=0;m<k;m++)!j[m]&&i[m]>
-n&&(l=m,n=i[l]);g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+h],3,g.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[h]=n;j[l]=1;n=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(h=0,i=e.__webglCustomAttributesList.length;h<i;h++)c=e.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(g.bindBuffer(g.ARRAY_BUFFER,
-c.buffer),g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,!1,0,0));0<=b.color&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer),g.vertexAttribPointer(b.color,3,g.FLOAT,!1,0,0));0<=b.normal&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));0<=b.tangent&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer),
-g.vertexAttribPointer(b.uv,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer),g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,
-e.__webglSkinVertexBBuffer),g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==nb&&(g.lineWidth(d),nb=d),a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,
-0)):(a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=e.__webglFaceCount,D.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES,d=d.linewidth,d!==nb&&(g.lineWidth(d),nb=d),g.drawArrays(f,0,e.__webglLineCount),D.info.render.calls++):f instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,e.__webglParticleCount),D.info.render.calls++,
-D.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount),D.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,j,n,m=a.lights,p=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=
-0;D.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Va.multiply(b.projectionMatrix,b.matrixWorldInverse);Qb.setFromMatrix(Va);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-n=a.__webglObjects;for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,f.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Qb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var o=f,r=o.object,u=o.buffer,y=void 0,y=y=void 0,y=r.material;if(y instanceof THREE.MeshFaceMaterial){if(y=u.materialIndex,0<=y)y=r.geometry.materials[y],y.transparent?(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null)}else if(y)y.transparent?
-(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null);f.render=!0;if(this.sortObjects)j.renderDepth?f.z=j.renderDepth:(Ia.copy(j.position),Va.multiplyVector3(Ia),f.z=Ia.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),t(j,b),j=f.object.material,j.transparent?(f.transparent=j,f.opaque=null):(f.opaque=j,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),
-this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,m,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,m,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,m,p,!1),l(a.__webglObjectsImmediate,"opaque",b,m,p,!1),k(a.__webglObjects,!1,"transparent",b,m,p,!0),l(a.__webglObjectsImmediate,
-"transparent",b,m,p,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture),g.generateMipmap(g.TEXTURE_CUBE_MAP),g.bindTexture(g.TEXTURE_CUBE_MAP,null)):(g.bindTexture(g.TEXTURE_2D,c.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=
-function(a,b,c,d,e){var f=r(a,b,c,d,e);L=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Qb):e.render(function(a){D.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,l=void 0,k=void 0,r=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=
-new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var t=k,u=void 0,y=void 0,z=void 0,A=void 0,H=void 0,B=void 0,J=void 0,K={},M=t.morphTargets.length;t.geometryGroups={};for(u=0,y=t.faces.length;u<y;u++)z=t.faces[u],A=z.materialIndex,B=void 0!==A?A:-1,void 0===K[B]&&(K[B]={hash:B,counter:0}),
-J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M}),H=z instanceof THREE.Face3?3:4,65535<t.geometryGroups[J].vertices+H&&(K[B].counter+=1,J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M})),z instanceof THREE.Face3?t.geometryGroups[J].faces3.push(u):t.geometryGroups[J].faces4.push(u),t.geometryGroups[J].vertices+=
-H;t.geometryGroupsList=[];var N=void 0;for(N in t.geometryGroups)t.geometryGroups[N].id=ya++,t.geometryGroupsList.push(t.geometryGroups[N])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var I=r;I.__webglVertexBuffer=g.createBuffer();I.__webglNormalBuffer=g.createBuffer();I.__webglTangentBuffer=g.createBuffer();I.__webglColorBuffer=g.createBuffer();I.__webglUVBuffer=g.createBuffer();I.__webglUV2Buffer=g.createBuffer();I.__webglSkinVertexABuffer=g.createBuffer();I.__webglSkinVertexBBuffer=
-g.createBuffer();I.__webglSkinIndicesBuffer=g.createBuffer();I.__webglSkinWeightsBuffer=g.createBuffer();I.__webglFaceBuffer=g.createBuffer();I.__webglLineBuffer=g.createBuffer();if(I.numMorphTargets){var Q=void 0,$=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,$=I.numMorphTargets;Q<$;Q++)I.__webglMorphTargetsBuffers.push(g.createBuffer())}D.info.memory.geometries++;var L=r,Z=h,W=Z.geometry,ba=L.faces3,ca=L.faces4,S=3*ba.length+4*ca.length,ka=1*ba.length+2*ca.length,ua=3*ba.length+4*ca.length,pa=
-c(Z,L),Ba=e(pa),Ea=d(pa),Na=pa.vertexColors?pa.vertexColors:!1;L.__vertexArray=new Float32Array(3*S);if(Ea)L.__normalArray=new Float32Array(3*S);if(W.hasTangents)L.__tangentArray=new Float32Array(4*S);if(Na)L.__colorArray=new Float32Array(3*S);if(Ba){if(0<W.faceUvs.length||0<W.faceVertexUvs.length)L.__uvArray=new Float32Array(2*S);if(1<W.faceUvs.length||1<W.faceVertexUvs.length)L.__uv2Array=new Float32Array(2*S)}if(Z.geometry.skinWeights.length&&Z.geometry.skinIndices.length)L.__skinVertexAArray=
-new Float32Array(4*S),L.__skinVertexBArray=new Float32Array(4*S),L.__skinIndexArray=new Float32Array(4*S),L.__skinWeightArray=new Float32Array(4*S);L.__faceArray=new Uint16Array(3*ka);L.__lineArray=new Uint16Array(2*ua);if(L.numMorphTargets){L.__morphTargetsArrays=[];for(var Oa=0,Ua=L.numMorphTargets;Oa<Ua;Oa++)L.__morphTargetsArrays.push(new Float32Array(3*S))}L.__webglFaceCount=3*ka;L.__webglLineCount=2*ua;if(pa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=
-[];var Sa=void 0;for(Sa in pa.attributes){var Pa=pa.attributes[Sa],Fa={},Ta;for(Ta in Pa)Fa[Ta]=Pa[Ta];if(!Fa.__webglInitialized||Fa.createUniqueBuffers){Fa.__webglInitialized=!0;var Ia=1;"v2"===Fa.type?Ia=2:"v3"===Fa.type?Ia=3:"v4"===Fa.type?Ia=4:"c"===Fa.type&&(Ia=3);Fa.size=Ia;Fa.array=new Float32Array(S*Ia);Fa.buffer=g.createBuffer();Fa.buffer.belongsToAttribute=Sa;Pa.needsUpdate=!0;Fa.__original=Pa}L.__webglCustomAttributesList.push(Fa)}}L.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=
-!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var ib=k;ib.__webglVertexBuffer=g.createBuffer();ib.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Va=k,nb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*nb);Va.__colorArray=new Float32Array(3*nb);Va.__webglVertexCount=nb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=
-h.geometry,!k.__webglVertexBuffer){var Fb=k;Fb.__webglVertexBuffer=g.createBuffer();Fb.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Rb=k,Pb=h,Ab=Rb.vertices.length;Rb.__vertexArray=new Float32Array(3*Ab);Rb.__colorArray=new Float32Array(3*Ab);Rb.__webglLineCount=Ab;b(Rb,Pb);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Gb=k;Gb.__webglVertexBuffer=g.createBuffer();Gb.__webglColorBuffer=g.createBuffer();
-D.info.geometries++;var Hb=k,Qb=h,vc=Hb.vertices.length;Hb.__vertexArray=new Float32Array(3*vc);Hb.__colorArray=new Float32Array(3*vc);Hb.__sortArray=[];Hb.__webglParticleCount=vc;b(Hb,Qb);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)j(i.__webglObjects,k,h);else for(l in k.geometryGroups)r=k.geometryGroups[l],j(i.__webglObjects,r,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?
-(k=h.geometry,j(i.__webglObjects,k,h)):void 0!==THREE.MarchingCubes&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ja=a.__objectsRemoved[0],gc=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||
-Ja instanceof THREE.Line?o(gc.__webglObjects,Ja):Ja instanceof THREE.Sprite?m(gc.__webglSprites,Ja):Ja instanceof THREE.LensFlare?m(gc.__webglFlares,Ja):(Ja instanceof THREE.MarchingCubes||Ja.immediateRenderCallback)&&o(gc.__webglObjectsImmediate,Ja);Ja.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var wc=0,cc=a.__webglObjects.length;wc<cc;wc++){var Qa=a.__webglObjects[wc].object,R=Qa.geometry,Sb=void 0,Ib=void 0,za=void 0;if(Qa instanceof THREE.Mesh)if(R instanceof THREE.BufferGeometry)R.__dirtyVertices=
-!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var xc=0,dc=R.geometryGroupsList.length;xc<dc;xc++)if(Sb=R.geometryGroupsList[xc],za=c(Qa,Sb),Ib=za.attributes&&n(za),R.__dirtyVertices||R.__dirtyMorphTargets||R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Ib){var O=Sb,ec=Qa,Ga=g.DYNAMIC_DRAW,fc=!R.dynamic,hc=za;if(O.__inittedArrays){var Fc=d(hc),yc=hc.vertexColors?hc.vertexColors:!1,Gc=e(hc),Hc=Fc===THREE.SmoothShading,
-v=void 0,C=void 0,Ma=void 0,x=void 0,Jb=void 0,ob=void 0,Ra=void 0,ic=void 0,jb=void 0,Kb=void 0,Lb=void 0,E=void 0,F=void 0,G=void 0,X=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Tb=void 0,Za=void 0,$a=void 0,ab=void 0,Ub=void 0,bb=void 0,cb=void 0,db=void 0,Vb=void 0,eb=void 0,fb=void 0,gb=void 0,Wb=void 0,pb=void 0,qb=void 0,rb=void 0,jc=void 0,sb=void 0,tb=void 0,ub=void 0,kc=void 0,T=void 0,Ic=void 0,vb=void 0,Mb=void 0,Nb=void 0,Ha=void 0,Jc=void 0,qa=void 0,ja=0,oa=0,kb=0,lb=0,Ka=0,va=0,Y=0,wa=0,
-la=0,w=0,ma=0,s=0,Ca=void 0,ra=O.__vertexArray,Xb=O.__uvArray,Yb=O.__uv2Array,La=O.__normalArray,da=O.__tangentArray,sa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=O.__skinIndexArray,ha=O.__skinWeightArray,zc=O.__morphTargetsArrays,Ac=O.__webglCustomAttributesList,q=void 0,hb=O.__faceArray,Da=O.__lineArray,xa=ec.geometry,uc=xa.__dirtyElements,Kc=xa.__dirtyUvs,Rc=xa.__dirtyNormals,Sc=xa.__dirtyTangents,Tc=xa.__dirtyColors,Uc=xa.__dirtyMorphTargets,Bb=xa.vertices,U=O.faces3,V=
-O.faces4,na=xa.faces,Bc=xa.faceVertexUvs[0],Cc=xa.faceVertexUvs[1],Cb=xa.skinVerticesA,Db=xa.skinVerticesB,Eb=xa.skinIndices,wb=xa.skinWeights,xb=xa.morphTargets;if(xa.__dirtyVertices){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,oa+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,X=Bb[x.d].position,
-ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,ra[oa+9]=X.x,ra[oa+10]=X.y,ra[oa+11]=X.z,oa+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Ga)}if(Uc)for(Ha=0,Jc=xb.length;Ha<Jc;Ha++){ma=0;for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,
-qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,ma+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,X=xb[Ha].vertices[x.d].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,qa[ma+9]=X.x,qa[ma+10]=X.y,qa[ma+11]=X.z,ma+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Ha]);g.bufferData(g.ARRAY_BUFFER,zc[Ha],Ga)}if(wb.length){for(v=
-0,C=U.length;v<C;v++)x=na[U[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+11]=db.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+11]=gb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,
-ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,ea[w+11]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,fa[w+11]=1,w+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],Vb=wb[x.d],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+
-11]=db.w,ha[w+12]=Vb.x,ha[w+13]=Vb.y,ha[w+14]=Vb.z,ha[w+15]=Vb.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],Wb=Eb[x.d],ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+11]=gb.w,ga[w+12]=Wb.x,ga[w+13]=Wb.y,ga[w+14]=Wb.z,ga[w+15]=Wb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],jc=Cb[x.d],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,
-ea[w+11]=1,ea[w+12]=jc.x,ea[w+13]=jc.y,ea[w+14]=jc.z,ea[w+15]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],kc=Db[x.d],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,fa[w+11]=1,fa[w+12]=kc.x,fa[w+13]=kc.y,fa[w+14]=kc.z,fa[w+15]=1,w+=16;0<w&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,ea,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,fa,Ga),
-g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,ga,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,ha,Ga))}if(Tc&&yc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],Ra=x.vertexColors,ic=x.color,3===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2]):ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,la+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],
-Ra=x.vertexColors,ic=x.color,4===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2],Ub=Ra[3]):Ub=ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,sa[la+9]=Ub.r,sa[la+10]=Ub.g,sa[la+11]=Ub.b,la+=12;0<la&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,sa,Ga))}if(Sc&&xa.hasTangents){for(v=0,C=U.length;v<C;v++)x=na[U[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],da[Y]=
-Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,Y+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],Tb=jb[3],da[Y]=Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,da[Y+12]=Tb.x,da[Y+13]=Tb.y,da[Y+14]=Tb.z,da[Y+15]=Tb.w,Y+=16;g.bindBuffer(g.ARRAY_BUFFER,O.__webglTangentBuffer);
-g.bufferData(g.ARRAY_BUFFER,da,Ga)}if(Rc&&Fc){for(v=0,C=U.length;v<C;v++)if(x=na[U[v]],Jb=x.vertexNormals,ob=x.normal,3===Jb.length&&Hc)for(T=0;3>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;3>T;T++)La[va]=ob.x,La[va+1]=ob.y,La[va+2]=ob.z,va+=3;for(v=0,C=V.length;v<C;v++)if(x=na[V[v]],Jb=x.vertexNormals,ob=x.normal,4===Jb.length&&Hc)for(T=0;4>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;4>T;T++)La[va]=ob.x,La[va+1]=ob.y,La[va+2]=ob.z,va+=3;
-g.bindBuffer(g.ARRAY_BUFFER,O.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,La,Ga)}if(Kc&&Bc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;3>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;for(v=0,C=V.length;v<C;v++)if(Ma=V[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;4>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;0<kb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Xb,Ga))}if(Kc&&Cc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],
-Lb=Cc[Ma],void 0!==Lb)for(T=0;3>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;for(v=0,C=V.length;v<C;v++)if(Ma=V[v],x=na[Ma],Lb=Cc[Ma],void 0!==Lb)for(T=0;4>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;0<lb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER,Yb,Ga))}if(uc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+2,Ka+=3,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+2,Da[wa+4]=ja+1,Da[wa+5]=ja+2,wa+=6,ja+=3;for(v=0,C=V.length;v<C;v++)x=
-na[V[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+3,hb[Ka+3]=ja+1,hb[Ka+4]=ja+2,hb[Ka+5]=ja+3,Ka+=6,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+3,Da[wa+4]=ja+1,Da[wa+5]=ja+2,Da[wa+6]=ja+2,Da[wa+7]=ja+3,wa+=8,ja+=4;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,hb,Ga);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Da,Ga)}if(Ac)for(T=0,Ic=Ac.length;T<Ic;T++)if(q=Ac[T],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===
-q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],s+=3;for(v=0,C=V.length;v<C;v++)x=na[V[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],q.array[s+3]=q.value[x.d],s+=4}else{if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)Ca=q.value[U[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+2]=Ca,s+=3;for(v=0,C=V.length;v<C;v++)Ca=q.value[V[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+
-2]=Ca,q.array[s+3]=Ca,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+
-7]=X.y,s+=8}else{if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}}else if(3===q.size){var P;P="c"===q.type?["r","g","b"]:["x","y","z"];if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=
-0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+
-6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],
-q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+
-9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],
-q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,
-q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}g.bindBuffer(g.ARRAY_BUFFER,q.buffer);g.bufferData(g.ARRAY_BUFFER,q.array,Ga)}fc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=!1;R.__dirtyElements=!1;
-R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;za.attributes&&p(za)}else if(Qa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var yb=R,Lc=g.DYNAMIC_DRAW,Zb=void 0,$b=void 0,lc=void 0,zb=void 0,mc=void 0,Mc=yb.vertices,Nc=yb.colors,Vc=Mc.length,Wc=Nc.length,nc=yb.__vertexArray,oc=yb.__colorArray,Xc=yb.__dirtyColors;if(yb.__dirtyVertices){for(Zb=0;Zb<Vc;Zb++)lc=Mc[Zb].position,zb=3*Zb,nc[zb]=lc.x,nc[zb+1]=lc.y,nc[zb+2]=lc.z;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglVertexBuffer);
-g.bufferData(g.ARRAY_BUFFER,nc,Lc)}if(Xc){for($b=0;$b<Wc;$b++)mc=Nc[$b],zb=3*$b,oc[zb]=mc.r,oc[zb+1]=mc.g,oc[zb+2]=mc.b;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,oc,Lc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Qa instanceof THREE.Line){za=c(Qa,Sb);Ib=za.attributes&&n(za);if(R.__dirtyVertices||R.__dirtyColors||Ib){var mb=R,Dc=g.DYNAMIC_DRAW,ac=void 0,bc=void 0,pc=void 0,ia=void 0,qc=void 0,Oc=mb.vertices,Pc=mb.colors,Yc=Oc.length,Zc=Pc.length,rc=mb.__vertexArray,
-sc=mb.__colorArray,$c=mb.__dirtyColors,Ec=mb.__webglCustomAttributesList,tc=void 0,Qc=void 0,ta=void 0,Ob=void 0,Aa=void 0,aa=void 0;if(mb.__dirtyVertices){for(ac=0;ac<Yc;ac++)pc=Oc[ac].position,ia=3*ac,rc[ia]=pc.x,rc[ia+1]=pc.y,rc[ia+2]=pc.z;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Dc)}if($c){for(bc=0;bc<Zc;bc++)qc=Pc[bc],ia=3*bc,sc[ia]=qc.r,sc[ia+1]=qc.g,sc[ia+2]=qc.b;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,sc,Dc)}if(Ec)for(tc=
-0,Qc=Ec.length;tc<Qc;tc++)if(aa=Ec[tc],aa.needsUpdate&&(void 0===aa.boundTo||"vertices"===aa.boundTo)){ia=0;Ob=aa.value.length;if(1===aa.size)for(ta=0;ta<Ob;ta++)aa.array[ta]=aa.value[ta];else if(2===aa.size)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,ia+=2;else if(3===aa.size)if("c"===aa.type)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.r,aa.array[ia+1]=Aa.g,aa.array[ia+2]=Aa.b,ia+=3;else for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,
-aa.array[ia+2]=Aa.z,ia+=3;else if(4===aa.size)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,aa.array[ia+2]=Aa.z,aa.array[ia+3]=Aa.w,ia+=4;g.bindBuffer(g.ARRAY_BUFFER,aa.buffer);g.bufferData(g.ARRAY_BUFFER,aa.array,Dc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;za.attributes&&p(za)}else if(Qa instanceof THREE.ParticleSystem)za=c(Qa,Sb),Ib=za.attributes&&n(za),(R.__dirtyVertices||R.__dirtyColors||Qa.sortParticles||Ib)&&f(R,g.DYNAMIC_DRAW,Qa),R.__dirtyVertices=!1,R.__dirtyColors=
-!1,za.attributes&&p(za)}};this.initMaterial=function(a,b,c,d){var e,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 n,l;f=k=0;for(n=0,l=b.length;n<l;n++)e=b[n],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=Z?n=f:(n=Math.ceil(Z*f/(k+f)),k=Z-n);e=n;f=k;var m=0;for(k=0,n=b.length;k<n;k++)l=b[k],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight)&&m++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{n=a.fragmentShader;
-l=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:e,maxPointLights:f,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},r,d=[];
-j?d.push(j):(d.push(n),d.push(l));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=Sa.length;r<d;r++)if(Sa[r].code===j){o=Sa[r].program;break a}r=g.createProgram();d=[0<fc?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",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");
+null!==h.cameraPosition)b=a.matrixWorld.getPosition(),g.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&g.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&g.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices)}g.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrixArray);h.normalMatrix&&g.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);
+(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==h.objectMatrix&&g.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return f}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){Pa!==a&&(a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL),Pa=a);if(a&&(Ta!==b||Ua!==c))g.polygonOffset(b,
+c),Ta=b,Ua=c}function y(a,b){var c;"fragment"===a?c=g.createShader(g.FRAGMENT_SHADER):"vertex"===a&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);return!g.getShaderParameter(c,g.COMPILE_STATUS)?(console.error(g.getShaderInfoLog(c)),console.error(b),null):c}function J(a,b,c){c?(g.texParameteri(a,g.TEXTURE_WRAP_S,B(b.wrapS)),g.texParameteri(a,g.TEXTURE_WRAP_T,B(b.wrapT)),g.texParameteri(a,g.TEXTURE_MAG_FILTER,B(b.magFilter)),g.texParameteri(a,g.TEXTURE_MIN_FILTER,B(b.minFilter))):
+(g.texParameteri(a,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_MAG_FILTER,u(b.magFilter)),g.texParameteri(a,g.TEXTURE_MIN_FILTER,u(b.minFilter)))}function K(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,
+g.DEPTH_STENCIL,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,a)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function u(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;
+case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return g.BYTE;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;
+case THREE.IntType:return g.INT;case THREE.UnsignedShortType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA}return 0}var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=void 0!==a.precision?a.precision:"mediump",M=void 0!==a.alpha?a.alpha:!0,N=void 0!==a.premultipliedAlpha?
+a.premultipliedAlpha:!0,I=void 0!==a.antialias?a.antialias:!1,S=void 0!==a.stencil?a.stencil:!0,ua=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),$=void 0!==a.clearAlpha?a.clearAlpha:0,Z=void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
+this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,g,Sa=[],ba=null,pa=null,Q=-1,L=null,W=null,ya=0,ca=null,Ea=null,Ba=null,Na=null,Oa=null,Pa=null,Ta=null,Ua=null,nb=null,Fb=0,Pb=0,Ab=0,Gb=0,cc=0,dc=0,
+Qb=new THREE.Frustum,Va=new THREE.Matrix4,Ia=new THREE.Vector4,ib=new THREE.Vector3,ec={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};g=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:N,antialias:I,stencil:S,preserveDrawingBuffer:ua})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+
+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(ka.r,ka.g,ka.b,$);this.context=g;var fc=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var uc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);
+this.getContext=function(){return g};this.supportsVertexTextures=function(){return 0<fc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){Fb=a;Pb=b;Ab=c;Gb=d;g.viewport(Fb,Pb,Ab,Gb)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.setClearColor=
+function(a,b){ka.copy(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return $};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=g.COLOR_BUFFER_BIT;if(void 0===b||b)d|=g.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=g.STENCIL_BUFFER_BIT;g.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);
+this.renderPluginsPre.push(a)};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(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);
+g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer);D.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
+g.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){ba=null;Q=L=Oa=Na=Ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();a.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(b.attributes.position),g.vertexAttribPointer(b.attributes.position,
+3,g.FLOAT,!1,0,0));if(a.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,h,i,j,n,m,k,l,p=3*a.count;for(l=0;l<p;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],h=c[l+3],j=c[l+4],m=c[l+5],i=c[l+6],n=c[l+7],k=c[l+8],d=(d+h+i)/3,e=(e+j+n)/3,f=(f+m+k)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,c[l+6]=d,c[l+7]=e,c[l+8]=f}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,
+3,g.FLOAT,!1,0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=r(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==L&&(L=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexPositionBuffer),g.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(g.bindBuffer(g.ARRAY_BUFFER,
+e.vertexNormalBuffer),g.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.vertexUvBuffer),g.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,g.FLOAT,!1,0,8*f[d].index),g.enableVertexAttribArray(a.uv)):g.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexColorBuffer),g.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,g.FLOAT,
+!1,0,16*f[d].index)),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),g.drawElements(g.TRIANGLES,f[d].count,g.UNSIGNED_SHORT,2*f[d].start),D.info.render.calls++,D.info.render.vertices+=f[d].count,D.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var h,i,c=r(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==L&&(L=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer),g.vertexAttribPointer(b.position,
+3,g.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):0<=c.position&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){h=0;var j=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)g.bindBuffer(g.ARRAY_BUFFER,
+e.__webglMorphTargetsBuffers[j[h]]),g.vertexAttribPointer(c["morphTarget"+h],3,g.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],n=-1,l=0;i=f.morphTargetInfluences;var m,k=i.length;h=0;for(-1!==f.morphTargetBase&&(j[f.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(m=0;m<k;m++)!j[m]&&i[m]>n&&(l=m,n=i[l]);g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+h],3,g.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[h]=n;j[l]=
+1;n=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(h=0,i=e.__webglCustomAttributesList.length;h<i;h++)c=e.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(g.bindBuffer(g.ARRAY_BUFFER,c.buffer),g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,!1,0,0));0<=b.color&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer),g.vertexAttribPointer(b.color,
+3,g.FLOAT,!1,0,0));0<=b.normal&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));0<=b.tangent&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer),g.vertexAttribPointer(b.uv,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer),
+g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,
+4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==nb&&(g.lineWidth(d),nb=d),a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,0)):(a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=
+e.__webglFaceCount,D.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES,d=d.linewidth,d!==nb&&(g.lineWidth(d),nb=d),g.drawArrays(f,0,e.__webglLineCount),D.info.render.calls++):f instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,e.__webglParticleCount),D.info.render.calls++,D.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount),D.info.render.calls++)}};this.render=
+function(a,b,c,d){var e,f,j,n,m=a.lights,p=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
+if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Va.multiply(b.projectionMatrix,b.matrixWorldInverse);Qb.setFromMatrix(Va);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,f.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Qb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);
+t(j,b);var o=f,r=o.object,u=o.buffer,y=void 0,y=y=void 0,y=r.material;if(y instanceof THREE.MeshFaceMaterial){if(y=u.materialIndex,0<=y)y=r.geometry.materials[y],y.transparent?(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null)}else if(y)y.transparent?(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null);f.render=!0;if(this.sortObjects)j.renderDepth?f.z=j.renderDepth:(Ia.copy(j.position),Va.multiplyVector3(Ia),f.z=Ia.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;
+for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),t(j,b),j=f.object.material,j.transparent?(f.transparent=j,f.opaque=null):(f.opaque=j,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),
+k(a.__webglObjects,!1,"",b,m,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,m,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,m,p,!1),l(a.__webglObjectsImmediate,"opaque",b,m,p,!1),k(a.__webglObjects,!1,"transparent",b,m,p,!0),l(a.__webglObjectsImmediate,"transparent",b,m,p,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
+(g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture),g.generateMipmap(g.TEXTURE_CUBE_MAP),g.bindTexture(g.TEXTURE_CUBE_MAP,null)):(g.bindTexture(g.TEXTURE_2D,c.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=r(a,b,c,d,e);L=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Qb):e.render(function(a){D.renderBufferImmediate(a,f,d.shading)})};
+this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,l=void 0,k=void 0,r=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=
+h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var t=k,u=void 0,y=void 0,z=void 0,A=void 0,H=void 0,B=void 0,J=void 0,K={},M=t.morphTargets.length;t.geometryGroups={};for(u=0,y=t.faces.length;u<y;u++)z=t.faces[u],A=z.materialIndex,B=void 0!==A?A:-1,void 0===K[B]&&(K[B]={hash:B,counter:0}),J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M}),H=z instanceof THREE.Face3?3:4,65535<t.geometryGroups[J].vertices+
+H&&(K[B].counter+=1,J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M})),z instanceof THREE.Face3?t.geometryGroups[J].faces3.push(u):t.geometryGroups[J].faces4.push(u),t.geometryGroups[J].vertices+=H;t.geometryGroupsList=[];var N=void 0;for(N in t.geometryGroups)t.geometryGroups[N].id=ya++,t.geometryGroupsList.push(t.geometryGroups[N])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var I=
+r;I.__webglVertexBuffer=g.createBuffer();I.__webglNormalBuffer=g.createBuffer();I.__webglTangentBuffer=g.createBuffer();I.__webglColorBuffer=g.createBuffer();I.__webglUVBuffer=g.createBuffer();I.__webglUV2Buffer=g.createBuffer();I.__webglSkinVertexABuffer=g.createBuffer();I.__webglSkinVertexBBuffer=g.createBuffer();I.__webglSkinIndicesBuffer=g.createBuffer();I.__webglSkinWeightsBuffer=g.createBuffer();I.__webglFaceBuffer=g.createBuffer();I.__webglLineBuffer=g.createBuffer();if(I.numMorphTargets){var Q=
+void 0,$=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,$=I.numMorphTargets;Q<$;Q++)I.__webglMorphTargetsBuffers.push(g.createBuffer())}D.info.memory.geometries++;var L=r,Z=h,W=Z.geometry,ba=L.faces3,ca=L.faces4,S=3*ba.length+4*ca.length,ka=1*ba.length+2*ca.length,ua=3*ba.length+4*ca.length,pa=c(Z,L),Ba=e(pa),Ea=d(pa),Na=pa.vertexColors?pa.vertexColors:!1;L.__vertexArray=new Float32Array(3*S);if(Ea)L.__normalArray=new Float32Array(3*S);if(W.hasTangents)L.__tangentArray=new Float32Array(4*S);if(Na)L.__colorArray=
+new Float32Array(3*S);if(Ba){if(0<W.faceUvs.length||0<W.faceVertexUvs.length)L.__uvArray=new Float32Array(2*S);if(1<W.faceUvs.length||1<W.faceVertexUvs.length)L.__uv2Array=new Float32Array(2*S)}if(Z.geometry.skinWeights.length&&Z.geometry.skinIndices.length)L.__skinVertexAArray=new Float32Array(4*S),L.__skinVertexBArray=new Float32Array(4*S),L.__skinIndexArray=new Float32Array(4*S),L.__skinWeightArray=new Float32Array(4*S);L.__faceArray=new Uint16Array(3*ka);L.__lineArray=new Uint16Array(2*ua);if(L.numMorphTargets){L.__morphTargetsArrays=
+[];for(var Oa=0,Ua=L.numMorphTargets;Oa<Ua;Oa++)L.__morphTargetsArrays.push(new Float32Array(3*S))}L.__webglFaceCount=3*ka;L.__webglLineCount=2*ua;if(pa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=[];var Sa=void 0;for(Sa in pa.attributes){var Pa=pa.attributes[Sa],Fa={},Ta;for(Ta in Pa)Fa[Ta]=Pa[Ta];if(!Fa.__webglInitialized||Fa.createUniqueBuffers){Fa.__webglInitialized=!0;var Ia=1;"v2"===Fa.type?Ia=2:"v3"===Fa.type?Ia=3:"v4"===Fa.type?Ia=4:"c"===Fa.type&&(Ia=
+3);Fa.size=Ia;Fa.array=new Float32Array(S*Ia);Fa.buffer=g.createBuffer();Fa.buffer.belongsToAttribute=Sa;Pa.needsUpdate=!0;Fa.__original=Pa}L.__webglCustomAttributesList.push(Fa)}}L.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var ib=k;ib.__webglVertexBuffer=g.createBuffer();ib.__webglColorBuffer=g.createBuffer();
+D.info.memory.geometries++;var Va=k,nb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*nb);Va.__colorArray=new Float32Array(3*nb);Va.__webglVertexCount=nb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Fb=k;Fb.__webglVertexBuffer=g.createBuffer();Fb.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Rb=k,Pb=h,Ab=Rb.vertices.length;Rb.__vertexArray=new Float32Array(3*Ab);Rb.__colorArray=new Float32Array(3*
+Ab);Rb.__webglLineCount=Ab;b(Rb,Pb);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Gb=k;Gb.__webglVertexBuffer=g.createBuffer();Gb.__webglColorBuffer=g.createBuffer();D.info.geometries++;var Hb=k,Qb=h,vc=Hb.vertices.length;Hb.__vertexArray=new Float32Array(3*vc);Hb.__colorArray=new Float32Array(3*vc);Hb.__sortArray=[];Hb.__webglParticleCount=vc;b(Hb,Qb);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!h.__webglActive){if(h instanceof
+THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)j(i.__webglObjects,k,h);else for(l in k.geometryGroups)r=k.geometryGroups[l],j(i.__webglObjects,r,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,j(i.__webglObjects,k,h)):void 0!==THREE.MarchingCubes&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
+h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ja=a.__objectsRemoved[0],gc=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||Ja instanceof THREE.Line?o(gc.__webglObjects,Ja):Ja instanceof THREE.Sprite?m(gc.__webglSprites,Ja):Ja instanceof THREE.LensFlare?m(gc.__webglFlares,Ja):(Ja instanceof THREE.MarchingCubes||Ja.immediateRenderCallback)&&o(gc.__webglObjectsImmediate,
+Ja);Ja.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var wc=0,cc=a.__webglObjects.length;wc<cc;wc++){var Qa=a.__webglObjects[wc].object,R=Qa.geometry,Sb=void 0,Ib=void 0,za=void 0;if(Qa instanceof THREE.Mesh)if(R instanceof THREE.BufferGeometry)R.__dirtyVertices=!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var xc=0,dc=R.geometryGroupsList.length;xc<dc;xc++)if(Sb=R.geometryGroupsList[xc],za=c(Qa,Sb),Ib=za.attributes&&n(za),R.__dirtyVertices||R.__dirtyMorphTargets||
+R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Ib){var O=Sb,ec=Qa,Ga=g.DYNAMIC_DRAW,fc=!R.dynamic,hc=za;if(O.__inittedArrays){var Fc=d(hc),yc=hc.vertexColors?hc.vertexColors:!1,Gc=e(hc),Hc=Fc===THREE.SmoothShading,v=void 0,C=void 0,Ma=void 0,x=void 0,Jb=void 0,ob=void 0,Ra=void 0,ic=void 0,jb=void 0,Kb=void 0,Lb=void 0,E=void 0,F=void 0,G=void 0,X=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Tb=void 0,Za=void 0,$a=void 0,ab=void 0,Ub=void 0,bb=void 0,cb=void 0,db=void 0,
+Vb=void 0,eb=void 0,fb=void 0,gb=void 0,Wb=void 0,pb=void 0,qb=void 0,rb=void 0,jc=void 0,sb=void 0,tb=void 0,ub=void 0,kc=void 0,T=void 0,Ic=void 0,vb=void 0,Mb=void 0,Nb=void 0,Ha=void 0,Jc=void 0,qa=void 0,ja=0,oa=0,kb=0,lb=0,Ka=0,va=0,Y=0,wa=0,la=0,w=0,ma=0,s=0,Ca=void 0,ra=O.__vertexArray,Xb=O.__uvArray,Yb=O.__uv2Array,La=O.__normalArray,da=O.__tangentArray,sa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=O.__skinIndexArray,ha=O.__skinWeightArray,zc=O.__morphTargetsArrays,
+Ac=O.__webglCustomAttributesList,q=void 0,hb=O.__faceArray,Da=O.__lineArray,xa=ec.geometry,uc=xa.__dirtyElements,Kc=xa.__dirtyUvs,Rc=xa.__dirtyNormals,Sc=xa.__dirtyTangents,Tc=xa.__dirtyColors,Uc=xa.__dirtyMorphTargets,Bb=xa.vertices,U=O.faces3,V=O.faces4,na=xa.faces,Bc=xa.faceVertexUvs[0],Cc=xa.faceVertexUvs[1],Cb=xa.skinVerticesA,Db=xa.skinVerticesB,Eb=xa.skinIndices,wb=xa.skinWeights,xb=xa.morphTargets;if(xa.__dirtyVertices){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=Bb[x.a].position,F=Bb[x.b].position,
+G=Bb[x.c].position,ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,oa+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,X=Bb[x.d].position,ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,ra[oa+9]=X.x,ra[oa+10]=X.y,ra[oa+11]=X.z,oa+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Ga)}if(Uc)for(Ha=
+0,Jc=xb.length;Ha<Jc;Ha++){ma=0;for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,ma+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,X=xb[Ha].vertices[x.d].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+
+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,qa[ma+9]=X.x,qa[ma+10]=X.y,qa[ma+11]=X.z,ma+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Ha]);g.bufferData(g.ARRAY_BUFFER,zc[Ha],Ga)}if(wb.length){for(v=0,C=U.length;v<C;v++)x=na[U[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+11]=db.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],
+ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+11]=gb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,ea[w+11]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,
+fa[w+11]=1,w+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],Vb=wb[x.d],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+11]=db.w,ha[w+12]=Vb.x,ha[w+13]=Vb.y,ha[w+14]=Vb.z,ha[w+15]=Vb.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],Wb=Eb[x.d],ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+
+11]=gb.w,ga[w+12]=Wb.x,ga[w+13]=Wb.y,ga[w+14]=Wb.z,ga[w+15]=Wb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],jc=Cb[x.d],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,ea[w+11]=1,ea[w+12]=jc.x,ea[w+13]=jc.y,ea[w+14]=jc.z,ea[w+15]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],kc=Db[x.d],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,fa[w+11]=1,fa[w+
+12]=kc.x,fa[w+13]=kc.y,fa[w+14]=kc.z,fa[w+15]=1,w+=16;0<w&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,ea,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,fa,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,ga,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,ha,Ga))}if(Tc&&yc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],Ra=x.vertexColors,ic=x.color,
+3===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2]):ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,la+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],Ra=x.vertexColors,ic=x.color,4===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2],Ub=Ra[3]):Ub=ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,sa[la+9]=
+Ub.r,sa[la+10]=Ub.g,sa[la+11]=Ub.b,la+=12;0<la&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,sa,Ga))}if(Sc&&xa.hasTangents){for(v=0,C=U.length;v<C;v++)x=na[U[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],da[Y]=Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,Y+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],Tb=jb[3],da[Y]=
+Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,da[Y+12]=Tb.x,da[Y+13]=Tb.y,da[Y+14]=Tb.z,da[Y+15]=Tb.w,Y+=16;g.bindBuffer(g.ARRAY_BUFFER,O.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,da,Ga)}if(Rc&&Fc){for(v=0,C=U.length;v<C;v++)if(x=na[U[v]],Jb=x.vertexNormals,ob=x.normal,3===Jb.length&&Hc)for(T=0;3>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;3>T;T++)La[va]=ob.x,
+La[va+1]=ob.y,La[va+2]=ob.z,va+=3;for(v=0,C=V.length;v<C;v++)if(x=na[V[v]],Jb=x.vertexNormals,ob=x.normal,4===Jb.length&&Hc)for(T=0;4>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;4>T;T++)La[va]=ob.x,La[va+1]=ob.y,La[va+2]=ob.z,va+=3;g.bindBuffer(g.ARRAY_BUFFER,O.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,La,Ga)}if(Kc&&Bc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;3>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;for(v=0,C=V.length;v<
+C;v++)if(Ma=V[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;4>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;0<kb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Xb,Ga))}if(Kc&&Cc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],Lb=Cc[Ma],void 0!==Lb)for(T=0;3>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;for(v=0,C=V.length;v<C;v++)if(Ma=V[v],x=na[Ma],Lb=Cc[Ma],void 0!==Lb)for(T=0;4>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;0<lb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUV2Buffer),
+g.bufferData(g.ARRAY_BUFFER,Yb,Ga))}if(uc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+2,Ka+=3,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+2,Da[wa+4]=ja+1,Da[wa+5]=ja+2,wa+=6,ja+=3;for(v=0,C=V.length;v<C;v++)x=na[V[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+3,hb[Ka+3]=ja+1,hb[Ka+4]=ja+2,hb[Ka+5]=ja+3,Ka+=6,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+3,Da[wa+4]=ja+1,Da[wa+5]=ja+2,Da[wa+6]=ja+2,Da[wa+7]=ja+3,wa+=8,ja+=4;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);
+g.bufferData(g.ELEMENT_ARRAY_BUFFER,hb,Ga);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Da,Ga)}if(Ac)for(T=0,Ic=Ac.length;T<Ic;T++)if(q=Ac[T],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],s+=3;for(v=0,C=V.length;v<C;v++)x=na[V[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=
+q.value[x.c],q.array[s+3]=q.value[x.d],s+=4}else{if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)Ca=q.value[U[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+2]=Ca,s+=3;for(v=0,C=V.length;v<C;v++)Ca=q.value[V[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+2]=Ca,q.array[s+3]=Ca,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+
+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}else{if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[v]],
+q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}}else if(3===q.size){var P;P="c"===q.type?["r","g","b"]:["x","y","z"];if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],
+q.array[s+8]=G[P[2]],s+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],
+q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||
+"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+
+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Ca=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=V.length;v<C;v++)X=
+G=F=E=Ca=q.value[V[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}g.bindBuffer(g.ARRAY_BUFFER,q.buffer);g.bufferData(g.ARRAY_BUFFER,q.array,Ga)}fc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,
+delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=!1;R.__dirtyElements=!1;R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;za.attributes&&p(za)}else if(Qa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var yb=R,Lc=g.DYNAMIC_DRAW,Zb=void 0,$b=void 0,lc=void 0,zb=void 0,
+mc=void 0,Mc=yb.vertices,Nc=yb.colors,Vc=Mc.length,Wc=Nc.length,nc=yb.__vertexArray,oc=yb.__colorArray,Xc=yb.__dirtyColors;if(yb.__dirtyVertices){for(Zb=0;Zb<Vc;Zb++)lc=Mc[Zb].position,zb=3*Zb,nc[zb]=lc.x,nc[zb+1]=lc.y,nc[zb+2]=lc.z;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,nc,Lc)}if(Xc){for($b=0;$b<Wc;$b++)mc=Nc[$b],zb=3*$b,oc[zb]=mc.r,oc[zb+1]=mc.g,oc[zb+2]=mc.b;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,oc,Lc)}}R.__dirtyVertices=
+!1;R.__dirtyColors=!1}else if(Qa instanceof THREE.Line){za=c(Qa,Sb);Ib=za.attributes&&n(za);if(R.__dirtyVertices||R.__dirtyColors||Ib){var mb=R,Dc=g.DYNAMIC_DRAW,ac=void 0,bc=void 0,pc=void 0,ia=void 0,qc=void 0,Oc=mb.vertices,Pc=mb.colors,Yc=Oc.length,Zc=Pc.length,rc=mb.__vertexArray,sc=mb.__colorArray,$c=mb.__dirtyColors,Ec=mb.__webglCustomAttributesList,tc=void 0,Qc=void 0,ta=void 0,Ob=void 0,Aa=void 0,aa=void 0;if(mb.__dirtyVertices){for(ac=0;ac<Yc;ac++)pc=Oc[ac].position,ia=3*ac,rc[ia]=pc.x,
+rc[ia+1]=pc.y,rc[ia+2]=pc.z;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Dc)}if($c){for(bc=0;bc<Zc;bc++)qc=Pc[bc],ia=3*bc,sc[ia]=qc.r,sc[ia+1]=qc.g,sc[ia+2]=qc.b;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,sc,Dc)}if(Ec)for(tc=0,Qc=Ec.length;tc<Qc;tc++)if(aa=Ec[tc],aa.needsUpdate&&(void 0===aa.boundTo||"vertices"===aa.boundTo)){ia=0;Ob=aa.value.length;if(1===aa.size)for(ta=0;ta<Ob;ta++)aa.array[ta]=aa.value[ta];else if(2===aa.size)for(ta=
+0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,ia+=2;else if(3===aa.size)if("c"===aa.type)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.r,aa.array[ia+1]=Aa.g,aa.array[ia+2]=Aa.b,ia+=3;else for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,aa.array[ia+2]=Aa.z,ia+=3;else if(4===aa.size)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,aa.array[ia+2]=Aa.z,aa.array[ia+3]=Aa.w,ia+=4;g.bindBuffer(g.ARRAY_BUFFER,aa.buffer);g.bufferData(g.ARRAY_BUFFER,
+aa.array,Dc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;za.attributes&&p(za)}else if(Qa instanceof THREE.ParticleSystem)za=c(Qa,Sb),Ib=za.attributes&&n(za),(R.__dirtyVertices||R.__dirtyColors||Qa.sortParticles||Ib)&&f(R,g.DYNAMIC_DRAW,Qa),R.__dirtyVertices=!1,R.__dirtyColors=!1,za.attributes&&p(za)}};this.initMaterial=function(a,b,c,d){var e,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 n,l;f=k=0;for(n=0,l=b.length;n<l;n++)e=b[n],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&
+k++);k+f<=Z?n=f:(n=Math.ceil(Z*f/(k+f)),k=Z-n);e=n;f=k;var m=0;for(k=0,n=b.length;k<n;k++)l=b[k],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight)&&m++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{n=a.fragmentShader;l=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:e,maxPointLights:f,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},r,d=[];j?d.push(j):(d.push(n),d.push(l));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=Sa.length;r<d;r++)if(Sa[r].code===j){o=Sa[r].program;break a}r=g.createProgram();d=[0<fc?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":
+"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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.perPixel?"#define PHONG_PER_PIXEL":
+"",c.wrapAround?"#define WRAP_AROUND":"",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;\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=["precision "+A+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");g.attachShader(r,y("fragment",e+n));g.attachShader(r,y("vertex",d+l));g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
-g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");r.uniforms={};r.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)n=t[d],r.uniforms[n]=g.getUniformLocation(r,n);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+
+g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.getError()+"]");r.uniforms={};r.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)n=t[d],r.uniforms[n]=g.getUniformLocation(r,n);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+
t);for(o in b)d.push(o);o=d;for(t=0,b=o.length;t<b;t++)c=o[t],r.attributes[c]=g.getAttribLocation(r,c);r.id=Sa.length;Sa.push({program:r,code:j});D.info.memory.programs=Sa.length;o=r}a.program=o;o=a.program.attributes;0<=o.position&&g.enableVertexAttribArray(o.position);0<=o.color&&g.enableVertexAttribArray(o.color);0<=o.normal&&g.enableVertexAttribArray(o.normal);0<=o.tangent&&g.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(g.enableVertexAttribArray(o.skinVertexA),
g.enableVertexAttribArray(o.skinVertexB),g.enableVertexAttribArray(o.skinIndex),g.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==o[i]&&0<=o[i]&&g.enableVertexAttribArray(o[i]);if(a.morphTargets)for(i=a.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)t="morphTarget"+i,0<=o[t]&&(g.enableVertexAttribArray(o[t]),a.numSupportedMorphTargets++);a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a?(!b||
"ccw"===b?g.frontFace(g.CCW):g.frontFace(g.CW),"back"===a?g.cullFace(g.BACK):"front"===a?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(ca!==a.doubleSided)a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE),ca=a.doubleSided;if(Ea!==a.flipSided)a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW),Ea=a.flipSided};this.setDepthTest=function(a){Na!==a&&(a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),Na=a)};this.setDepthWrite=
View
14 src/renderers/WebGLRenderer.js
@@ -4278,7 +4278,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.skinning ) {
- loadUniformsSkinning( p_uniforms, object, camera );
+ _gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices );
}
@@ -4475,14 +4475,6 @@ THREE.WebGLRenderer = function ( parameters ) {
// Uniforms (load to GPU)
- function loadUniformsSkinning ( uniforms, object, camera ) {
-
- _gl.uniformMatrix4fv( uniforms.cameraInverseMatrix, false, camera._viewMatrixArray );
- _gl.uniformMatrix4fv( uniforms.boneGlobalMatrices, false, object.boneMatrices );
-
- };
-
-
function loadUniformsMatrices ( uniforms, object ) {
_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
@@ -5128,8 +5120,6 @@ THREE.WebGLRenderer = function ( parameters ) {
"uniform mat3 normalMatrix;",
"uniform vec3 cameraPosition;",
- "uniform mat4 cameraInverseMatrix;",
-
"attribute vec3 position;",
"attribute vec3 normal;",
"attribute vec2 uv;",
@@ -5227,7 +5217,7 @@ THREE.WebGLRenderer = function ( parameters ) {
identifiers = [
'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'objectMatrix', 'cameraPosition',
- 'cameraInverseMatrix', 'boneGlobalMatrices', 'morphTargetInfluences'
+ 'boneGlobalMatrices', 'morphTargetInfluences'
];
View
3  src/renderers/WebGLShaders.js
@@ -669,9 +669,6 @@ THREE.ShaderChunk = {
"gl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;",
"gl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;",
- // this doesn't work, no idea why
- //"gl_Position = projectionMatrix * cameraInverseMatrix * objectMatrix * gl_Position;",
-
"gl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;",
"#endif"
Please sign in to comment.
Something went wrong with that request. Please try again.