Browse Source

Made it possible to enforce use of uniforms instead of float texture for bones.

alteredq 13 years ago
parent
commit
230d39e4d0

+ 13 - 13
build/Three.js

@@ -215,9 +215,9 @@ THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materi
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.useVertexTexture=true;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,e,f,g,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];f=e.pos;g=e.rotq;h=e.scl;d=this.addBone();d.name=e.name;d.position.set(f[0],f[1],f[2]);d.quaternion.set(g[0],g[1],g[2],g[3]);d.useQuaternion=true;h!==void 0?d.scale.set(h[0],h[1],h[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=
-this.geometry.bones[c];d=this.bones[c];e.parent===-1?this.add(d):this.bones[e.parent].add(d)}c=this.bones.length;if(this.useVertexTexture){this.boneTextureHeight=this.boneTextureWidth=c=c>256?64:c>64?32:c>16?16:8;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType);this.boneTexture.minFilter=THREE.NearestFilter;this.boneTexture.magFilter=
-THREE.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else this.boneMatrices=new Float32Array(16*c);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.useVertexTexture=c!==void 0?c:true;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f;if(this.geometry.bones!==void 0){for(a=0;a<this.geometry.bones.length;a++){c=this.geometry.bones[a];d=c.pos;e=c.rotq;f=c.scl;b=this.addBone();b.name=c.name;b.position.set(d[0],d[1],d[2]);b.quaternion.set(e[0],e[1],e[2],e[3]);b.useQuaternion=true;f!==void 0?b.scale.set(f[0],f[1],f[2]):b.scale.set(1,1,1)}for(a=0;a<this.bones.length;a++){c=
+this.geometry.bones[a];b=this.bones[a];c.parent===-1?this.add(b):this.bones[c.parent].add(b)}a=this.bones.length;if(this.useVertexTexture){this.boneTextureHeight=this.boneTextureWidth=a=a>256?64:a>64?32:a>16?16:8;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType);this.boneTexture.minFilter=THREE.NearestFilter;this.boneTexture.magFilter=
+THREE.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else this.boneMatrices=new Float32Array(16*a);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16);if(this.useVertexTexture)this.boneTexture.needsUpdate=true};
 THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,
@@ -331,7 +331,7 @@ void 0)e._array=new Float32Array(3*j.length);m=0;for(o=j.length;m<o;m++){q=m*3;e
 false,e._array)}else if(m==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*j.length);m=0;for(o=j.length;m<o;m++)j[m].flattenToArrayOffset(e._array,m*16);k.uniformMatrix4fv(l,false,e._array)}else if(m==="t"){k.uniform1i(l,j);if(l=e.texture)if(l.image instanceof Array&&l.image.length===6){e=l;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
 k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,e.flipY);j=[];for(l=0;l<6;l++){m=j;o=l;if(D.autoScaleCubemaps){q=e.image[l];w=dc;if(!(q.width<=w&&q.height<=w)){t=Math.max(q.width,q.height);s=Math.floor(q.width*w/t);w=Math.floor(q.height*w/t);t=document.createElement("canvas");t.width=s;t.height=w;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,w);q=t}}else q=e.image[l];m[o]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;o=C(e.format);q=C(e.type);v(k.TEXTURE_CUBE_MAP,e,m);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+
 l,0,o,o,q,j[l]);e.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){e=l;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,e.__webglTexture)}else D.setTexture(l,j)}else if(m==="tv"){if(e._array===void 0){e._array=[];m=0;for(o=e.texture.length;m<o;m++)e._array[m]=j+m}k.uniform1iv(l,e._array);
-m=0;for(o=e.texture.length;m<o;m++)(l=e.texture[m])&&D.setTexture(l,e._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(Wa){if(h.boneTexture!==
+m=0;for(o=e.texture.length;m<o;m++)(l=e.texture[m])&&D.setTexture(l,e._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(Wa&&f.useVertexTexture){if(h.boneTexture!==
 null){k.uniform1i(h.boneTexture,12);D.setTexture(f.boneTexture,12)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,false,f.matrixWorld.elements);return g}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);
 a._normalMatrix.transpose()}function u(a,b,c){if(Pa!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);Pa=a}if(a&&(Qa!==b||Va!==c)){k.polygonOffset(b,c);Qa=b;Va=c}}function t(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(b);return null}return c}function v(a,b,c){if(c){k.texParameteri(a,
 k.TEXTURE_WRAP_S,C(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,C(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,C(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter))}}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,
@@ -422,17 +422,17 @@ k.bufferData(k.ARRAY_BUFFER,Qc,sd)}}da.verticesNeedUpdate=false;da.colorsNeedUpd
 qa.value[Oa];else if(qa.size===2)for(Oa=0;Oa<uc;Oa++){Ya=qa.value[Oa];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;xa=xa+2}else if(qa.size===3)if(qa.type==="c")for(Oa=0;Oa<uc;Oa++){Ya=qa.value[Oa];qa.array[xa]=Ya.r;qa.array[xa+1]=Ya.g;qa.array[xa+2]=Ya.b;xa=xa+3}else for(Oa=0;Oa<uc;Oa++){Ya=qa.value[Oa];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;qa.array[xa+2]=Ya.z;xa=xa+3}else if(qa.size===4)for(Oa=0;Oa<uc;Oa++){Ya=qa.value[Oa];qa.array[xa]=Ya.x;qa.array[xa+1]=Ya.y;qa.array[xa+2]=Ya.z;qa.array[xa+3]=Ya.w;xa=
 xa+4}k.bindBuffer(k.ARRAY_BUFFER,qa.buffer);k.bufferData(k.ARRAY_BUFFER,qa.array,id)}}}}da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}else if(lb instanceof THREE.ParticleSystem){Xa=c(lb,kb);mc=Xa.attributes&&n(Xa);(da.verticesNeedUpdate||da.colorsNeedUpdate||lb.sortParticles||mc)&&f(da,k.DYNAMIC_DRAW,lb);da.verticesNeedUpdate=false;da.colorsNeedUpdate=false;Xa.attributes&&p(Xa)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,m;a instanceof THREE.MeshDepthMaterial?
 m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var n,p;n=g=e=o=0;for(f=b.length;n<f;n++){p=
-b[n];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&g++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&o++}}if(e+o+g<=P){n=g;f=e}else{n=Math.ceil(P*g/(e+g));o=f=P-n}e=n;g=o;o=l=0;for(n=b.length;o<n;o++){p=b[o];if(p.castShadow){p instanceof THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(Wa)j=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,
-b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}j=b}var r;a:{p=a.fragmentShader;n=a.vertexShader;var o=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,maxBones:j,boneTextureWidth:d.boneTextureWidth,boneTextureHeight:d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,
-maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(m)d.push(m);else{d.push(p);d.push(n)}for(q in c){d.push(q);d.push(c[q])}m=d.join();
-q=0;for(d=W.length;q<d;q++){e=W[q];if(e.code===m){e.usedTimes++;r=e.program;break a}}q=k.createProgram();d=["precision "+w+" float;",Ha?"#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_SPOT_LIGHTS "+c.maxSpotLights,"#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":"",Wa?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?
-"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+b[n];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&g++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&o++}}if(e+o+g<=P){n=g;f=e}else{n=Math.ceil(P*g/(e+g));o=f=P-n}e=n;g=o;o=l=0;for(n=b.length;o<n;o++){p=b[o];if(p.castShadow){p instanceof THREE.SpotLight&&l++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&l++}}if(Wa&&d.useVertexTexture)j=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=
+Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}j=b}var r;a:{p=a.fragmentShader;n=a.vertexShader;var o=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,maxBones:j,useVertexTexture:Wa&&d.useVertexTexture,boneTextureWidth:d.boneTextureWidth,boneTextureHeight:d.boneTextureHeight,
+morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(m)d.push(m);else{d.push(p);
+d.push(n)}for(q in c){d.push(q);d.push(c[q])}m=d.join();q=0;for(d=W.length;q<d;q++){e=W[q];if(e.code===m){e.usedTimes++;r=e.program;break a}}q=k.createProgram();d=["precision "+w+" float;",Ha?"#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_SPOT_LIGHTS "+c.maxSpotLights,"#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.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":
+"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\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 "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-e=t("fragment",e+p);d=t("vertex",d+n);k.attachShader(q,d);k.attachShader(q,e);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(e);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];Wa?d.push("boneTexture"):d.push("boneGlobalMatrices");
-for(s in o)d.push(s);s=d;d=0;for(o=s.length;d<o;d++){e=s[d];q.uniforms[e]=k.getUniformLocation(q,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];q.attributes[d]=k.getAttribLocation(q,d)}q.id=R++;W.push({program:q,code:m,usedTimes:1});D.info.memory.programs=W.length;r=
-q}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(i in a.attributes)r[i]!==
+e=t("fragment",e+p);d=t("vertex",d+n);k.attachShader(q,d);k.attachShader(q,e);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(e);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
+d.push("boneGlobalMatrices");for(s in o)d.push(s);s=d;d=0;for(o=s.length;d<o;d++){e=s[d];q.uniforms[e]=k.getUniformLocation(q,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];q.attributes[d]=k.getAttribLocation(q,d)}q.id=R++;W.push({program:q,code:m,usedTimes:1});D.info.memory.programs=
+W.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(i in a.attributes)r[i]!==
 void 0&&r[i]>=0&&k.enableVertexAttribArray(r[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(i=0;i<this.maxMorphTargets;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++){s=q+i;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=
 function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);L=a.doubleSided}if(X!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);X=a.flipSided}};this.setDepthTest=function(a){if(za!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
 za=a}};this.setDepthWrite=function(a){if(Ga!==a){k.depthMask(a);Ga=a}};this.setBlending=function(a,b,c,d){if(a!==S){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===

+ 38 - 38
build/custom/ThreeWebGL.js

@@ -114,9 +114,9 @@ T.cross(e.vertexNormals[d],N);f=T.dot(H[f]);f=f<0?-1:1;e.vertexTangents[d]=new T
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,h,j,l;e=0;for(h=this.vertices.length;e<h;e++){d=this.vertices[e];d=
 [Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(h=this.faces.length;e<h;e++){a=this.faces[e];if(a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c]}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);
 d=0;for(j=this.faceVertexUvs.length;d<j;d++)(l=this.faceVertexUvs[d][e])&&l.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,h,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*h+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,h,j,l,k,i,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);h=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
-e+2;k=this.points[c[0]];i=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];j=h*h;l=h*j;d.x=b(k.x,i.x,n.x,m.x,h,j,l);d.y=b(k.y,i.y,n.y,m.y,h,j,l);d.z=b(k.z,i.z,n.z,m.z,h,j,l);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);f.copy(d);i=i+f.distanceTo(h);h.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){j[b]=i;e=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,h,f,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<f-1;c++){d=e+c*(1/f)*(h-e);d=this.getPoint(d);
+THREE.Spline=function(a){function b(a,b,c,d,e,f,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,h,j,l,k,i,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);h=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
+e+2;k=this.points[c[0]];i=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];j=h*h;l=h*j;d.x=b(k.x,i.x,n.x,m.x,h,j,l);d.y=b(k.y,i.y,n.y,m.y,h,j,l);d.z=b(k.z,i.z,n.z,m.z,h,j,l);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,j=[],i=0;j[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);h.copy(d);i=i+h.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){j[b]=i;e=b}}j[j.length]=i;return{chunks:j,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,h,j=[],i=new THREE.Vector3,k=this.getLength();j.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++){d=e+c*(1/h)*(f-e);d=this.getPoint(d);
 j.push(i.copy(d).clone())}j.push(i.copy(this.points[b]).clone())}this.points=j}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
@@ -213,9 +213,9 @@ THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materi
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.useVertexTexture=true;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,e,h,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];e=f.pos;h=f.rotq;j=f.scl;d=this.addBone();d.name=f.name;d.position.set(e[0],e[1],e[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=true;j!==void 0?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=
-this.geometry.bones[c];d=this.bones[c];f.parent===-1?this.add(d):this.bones[f.parent].add(d)}c=this.bones.length;if(this.useVertexTexture){this.boneTextureHeight=this.boneTextureWidth=c=c>256?64:c>64?32:c>16?16:8;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType);this.boneTexture.minFilter=THREE.NearestFilter;this.boneTexture.magFilter=
-THREE.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else this.boneMatrices=new Float32Array(16*c);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.useVertexTexture=c!==void 0?c:true;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,e;if(this.geometry.bones!==void 0){for(a=0;a<this.geometry.bones.length;a++){c=this.geometry.bones[a];d=c.pos;f=c.rotq;e=c.scl;b=this.addBone();b.name=c.name;b.position.set(d[0],d[1],d[2]);b.quaternion.set(f[0],f[1],f[2],f[3]);b.useQuaternion=true;e!==void 0?b.scale.set(e[0],e[1],e[2]):b.scale.set(1,1,1)}for(a=0;a<this.bones.length;a++){c=
+this.geometry.bones[a];b=this.bones[a];c.parent===-1?this.add(b):this.bones[c.parent].add(b)}a=this.bones.length;if(this.useVertexTexture){this.boneTextureHeight=this.boneTextureWidth=a=a>256?64:a>64?32:a>16?16:8;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType);this.boneTexture.minFilter=THREE.NearestFilter;this.boneTexture.magFilter=
+THREE.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else this.boneMatrices=new Float32Array(16*a);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16);if(this.useVertexTexture)this.boneTexture.needsUpdate=true};
 THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],f=this.geometry.skinIndices[a].x,e=this.geometry.skinIndices[a].y,
@@ -271,7 +271,7 @@ THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment
 THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=g.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function e(a,b,c){var d,e,f,h,i=a.vertices;h=i.length;
-var j=a.colors,k=j.length,n=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,q=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Vb.copy(Mb);Vb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){e=i[d];pb.copy(e);Vb.multiplyVector3(pb);m[d]=[pb.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){e=i[m[d][1]];f=d*3;n[f]=e.x;n[f+1]=e.y;n[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];
+var j=a.colors,k=j.length,n=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,q=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){Lb.copy(Mb);Lb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){e=i[d];pb.copy(e);Lb.multiplyVector3(pb);m[d]=[pb.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){e=i[m[d][1]];f=d*3;n[f]=e.x;n[f+1]=e.y;n[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];
 if(i.boundTo===void 0||i.boundTo==="vertices"){f=0;e=i.value.length;if(i.size===1)for(d=0;d<e;d++){h=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===3)if(i.type==="c")for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=m[d][1];h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=m[d][1];
 h=i.value[h];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}else{if(o)for(d=0;d<h;d++){e=i[d];f=d*3;n[f]=e.x;n[f+1]=e.y;n[f+2]=e.z}if(q)for(d=0;d<k;d++){e=j[d];f=d*3;l[f]=e.r;l[f+1]=e.g;l[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){i=r[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){e=i.value.length;f=0;if(i.size===1)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;f=f+2}else if(i.size===
 3)if(i.type==="c")for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.r;i.array[f+1]=h.g;i.array[f+2]=h.b;f=f+3}else for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;f=f+3}else if(i.size===4)for(d=0;d<e;d++){h=i.value[d];i.array[f]=h.x;i.array[f+1]=h.y;i.array[f+2]=h.z;i.array[f+3]=h.w;f=f+4}}}}}if(o||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,n,b)}if(q||c.sortParticles){g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,
@@ -293,7 +293,7 @@ void 0)e._array=new Float32Array(3*k.length);l=0;for(m=k.length;l<m;l++){p=l*3;e
 false,e._array)}else if(l==="m4v"){if(e._array===void 0)e._array=new Float32Array(16*k.length);l=0;for(m=k.length;l<m;l++)k[l].flattenToArrayOffset(e._array,l*16);g.uniformMatrix4fv(n,false,e._array)}else if(l==="t"){g.uniform1i(n,k);if(n=e.texture)if(n.image instanceof Array&&n.image.length===6){e=n;if(e.image.length===6)if(e.needsUpdate){if(!e.image.__webglTextureCube)e.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);
 g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY);k=[];for(n=0;n<6;n++){l=k;m=n;if(E.autoScaleCubemaps){p=e.image[n];s=Nc;if(!(p.width<=s&&p.height<=s)){v=Math.max(p.width,p.height);u=Math.floor(p.width*s/v);s=Math.floor(p.height*s/v);v=document.createElement("canvas");v.width=u;v.height=s;v.getContext("2d").drawImage(p,0,0,p.width,p.height,0,0,u,s);p=v}}else p=e.image[n];l[m]=p}n=k[0];l=(n.width&n.width-1)===0&&(n.height&n.height-1)===0;m=A(e.format);p=A(e.type);F(g.TEXTURE_CUBE_MAP,e,l);for(n=0;n<6;n++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+
 n,0,m,m,p,k[n]);e.generateMipmaps&&l&&g.generateMipmap(g.TEXTURE_CUBE_MAP);e.needsUpdate=false;if(e.onUpdate)e.onUpdate()}else{g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else if(n instanceof THREE.WebGLRenderTargetCube){e=n;g.activeTexture(g.TEXTURE0+k);g.bindTexture(g.TEXTURE_CUBE_MAP,e.__webglTexture)}else E.setTexture(n,k)}else if(l==="tv"){if(e._array===void 0){e._array=[];l=0;for(m=e.texture.length;l<m;l++)e._array[l]=k+l}g.uniform1iv(n,e._array);
-l=0;for(m=e.texture.length;l<m;l++)(n=e.texture[l])&&E.setTexture(n,e._array[l])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();g.uniform3f(i.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&i.viewMatrix!==null&&g.uniformMatrix4fv(i.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(Wb){if(i.boneTexture!==
+l=0;for(m=e.texture.length;l<m;l++)(n=e.texture[l])&&E.setTexture(n,e._array[l])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&i.cameraPosition!==null){b=a.matrixWorld.getPosition();g.uniform3f(i.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&i.viewMatrix!==null&&g.uniformMatrix4fv(i.viewMatrix,false,a._viewMatrixArray)}if(d.skinning)if(Vb&&f.useVertexTexture){if(i.boneTexture!==
 null){g.uniform1i(i.boneTexture,12);E.setTexture(f.boneTexture,12)}}else i.boneGlobalMatrices!==null&&g.uniformMatrix4fv(i.boneGlobalMatrices,false,f.boneMatrices);g.uniformMatrix4fv(i.modelViewMatrix,false,f._modelViewMatrix.elements);i.normalMatrix&&g.uniformMatrix3fv(i.normalMatrix,false,f._normalMatrix.elements);i.objectMatrix!==null&&g.uniformMatrix4fv(i.objectMatrix,false,f.matrixWorld.elements);return h}function p(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);
 a._normalMatrix.transpose()}function v(a,b,c){if(Va!==a){a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL);Va=a}if(a&&(ob!==b||Kb!==c)){g.polygonOffset(b,c);ob=b;Kb=c}}function x(a,b){var c;a==="fragment"?c=g.createShader(g.FRAGMENT_SHADER):a==="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS)){console.error(g.getShaderInfoLog(c));console.error(b);return null}return c}function F(a,b,c){if(c){g.texParameteri(a,
 g.TEXTURE_WRAP_S,A(b.wrapS));g.texParameteri(a,g.TEXTURE_WRAP_T,A(b.wrapT));g.texParameteri(a,g.TEXTURE_MAG_FILTER,A(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,A(b.minFilter))}else{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,I(b.magFilter));g.texParameteri(a,g.TEXTURE_MIN_FILTER,I(b.minFilter))}}function s(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){g.renderbufferStorage(g.RENDERBUFFER,
@@ -303,10 +303,10 @@ a===THREE.UnsignedShort4444Type?g.UNSIGNED_SHORT_4_4_4_4:a===THREE.UnsignedShort
 g.LUMINANCE_ALPHA:a===THREE.AddEquation?g.FUNC_ADD:a===THREE.SubtractEquation?g.FUNC_SUBTRACT:a===THREE.ReverseSubtractEquation?g.FUNC_REVERSE_SUBTRACT:a===THREE.ZeroFactor?g.ZERO:a===THREE.OneFactor?g.ONE:a===THREE.SrcColorFactor?g.SRC_COLOR:a===THREE.OneMinusSrcColorFactor?g.ONE_MINUS_SRC_COLOR:a===THREE.SrcAlphaFactor?g.SRC_ALPHA:a===THREE.OneMinusSrcAlphaFactor?g.ONE_MINUS_SRC_ALPHA:a===THREE.DstAlphaFactor?g.DST_ALPHA:a===THREE.OneMinusDstAlphaFactor?g.ONE_MINUS_DST_ALPHA:a===THREE.DstColorFactor?
 g.DST_COLOR:a===THREE.OneMinusDstColorFactor?g.ONE_MINUS_DST_COLOR:a===THREE.SrcAlphaSaturateFactor?g.SRC_ALPHA_SATURATE:0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},N=a.canvas!==void 0?a.canvas:document.createElement("canvas"),D=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,G=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,R=a.antialias!==void 0?a.antialias:false,U=a.stencil!==void 0?a.stencil:true,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:
 false,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=N;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;
-this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,$=[],fa=0,J=null,ra=null,S=-1,ba=null,aa=null,va=0,L=-1,qa=-1,xa=-1,Aa=-1,Pa=-1,ja=-1,Ba=-1,Qa=-1,Va=null,ob=null,Kb=null,wb=null,Ub=0,Lb=0,hc=0,Nb=0,wc=0,gc=0,Ob=new THREE.Frustum,Mb=new THREE.Matrix4,Vb=new THREE.Matrix4,
+this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,$=[],fa=0,J=null,ra=null,S=-1,ba=null,aa=null,va=0,L=-1,qa=-1,xa=-1,Aa=-1,Pa=-1,ja=-1,Ba=-1,Qa=-1,Va=null,ob=null,Kb=null,wb=null,Ub=0,fc=0,hc=0,Nb=0,wc=0,gc=0,Ob=new THREE.Frustum,Mb=new THREE.Matrix4,Lb=new THREE.Matrix4,
 pb=new THREE.Vector4,Ha=new THREE.Vector3,Wa=true,xc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}},g;try{if(!(g=N.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:G,antialias:R,stencil:U,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";}catch(Oc){console.error(Oc)}(a=g.getExtension("OES_texture_float"))||console.log("THREE.WebGLRenderer: Float textures not supported.");
-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(z.r,z.g,z.b,K);this.context=g;H=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Nc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),ic=H>0,Wb=ic&&a;this.getContext=function(){return g};this.supportsVertexTextures=
-function(){return ic};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(a,b,c,d){Ub=a;Lb=b;hc=c;Nb=d;g.viewport(Ub,Lb,hc,Nb)};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){z.setHex(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.setClearColor=function(a,b){z.copy(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.getClearColor=
+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(z.r,z.g,z.b,K);this.context=g;H=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);g.getParameter(g.MAX_TEXTURE_SIZE);var Nc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),ic=H>0,Vb=ic&&a;this.getContext=function(){return g};this.supportsVertexTextures=
+function(){return ic};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(a,b,c,d){Ub=a;fc=b;hc=c;Nb=d;g.viewport(Ub,fc,hc,Nb)};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){z.setHex(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.setClearColor=function(a,b){z.copy(a);K=b;g.clearColor(z.r,z.g,z.b,K)};this.getClearColor=
 function(){return z};this.getClearAlpha=function(){return K};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|g.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|g.DEPTH_BUFFER_BIT;if(c===void 0||c)d=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){a.__webglInit=
 false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(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);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)g.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}E.info.memory.geometries--}else if(a instanceof
@@ -343,15 +343,15 @@ new Float32Array(R*4);G.__skinVertexBArray=new Float32Array(R*4);G.__skinIndexAr
 3))}G.__webglFaceCount=aa*3;G.__webglLineCount=ba*2;if($.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Ba=void 0;for(Ba in $.attributes){var Aa=$.attributes[Ba],ja={},wb;for(wb in Aa)ja[wb]=Aa[wb];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=true;var Ha=1;ja.type==="v2"?Ha=2:ja.type==="v3"?Ha=3:ja.type==="v4"?Ha=4:ja.type==="c"&&(Ha=3);ja.size=Ha;ja.array=new Float32Array(R*Ha);ja.buffer=g.createBuffer();ja.buffer.belongsToAttribute=
 Ba;Aa.needsUpdate=true;ja.__original=Aa}G.__webglCustomAttributesList.push(ja)}}G.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangentsNeedUpdate=true;k.colorsNeedUpdate=true}}}else if(k instanceof THREE.BufferGeometry){var Ub=k,Pa=void 0,Qa=void 0,Va=void 0;for(Pa in Ub.attributes){Va=Pa==="index"?g.ELEMENT_ARRAY_BUFFER:g.ARRAY_BUFFER;Qa=Ub.attributes[Pa];Qa.buffer=g.createBuffer();g.bindBuffer(Va,
 Qa.buffer);g.bufferData(Va,Qa.array,g.STATIC_DRAW)}}}else if(h instanceof THREE.Ribbon){k=h.geometry;if(!k.__webglVertexBuffer){var pb=k;pb.__webglVertexBuffer=g.createBuffer();pb.__webglColorBuffer=g.createBuffer();E.info.memory.geometries++;var Wa=k,ob=Wa.vertices.length;Wa.__vertexArray=new Float32Array(ob*3);Wa.__colorArray=new Float32Array(ob*3);Wa.__webglVertexCount=ob;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.Line){k=h.geometry;if(!k.__webglVertexBuffer){var Mb=
-k;Mb.__webglVertexBuffer=g.createBuffer();Mb.__webglColorBuffer=g.createBuffer();E.info.memory.geometries++;var jc=k,Wb=h,Lb=jc.vertices.length;jc.__vertexArray=new Float32Array(Lb*3);jc.__colorArray=new Float32Array(Lb*3);jc.__webglLineCount=Lb;b(jc,Wb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Vb=k;Vb.__webglVertexBuffer=g.createBuffer();Vb.__webglColorBuffer=g.createBuffer();E.info.geometries++;var Xb=
-k,hc=h,Nb=Xb.vertices.length;Xb.__vertexArray=new Float32Array(Nb*3);Xb.__colorArray=new Float32Array(Nb*3);Xb.__sortArray=[];Xb.__webglParticleCount=Nb;b(Xb,hc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)n(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];n(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
+k;Mb.__webglVertexBuffer=g.createBuffer();Mb.__webglColorBuffer=g.createBuffer();E.info.memory.geometries++;var jc=k,fc=h,Lb=jc.vertices.length;jc.__vertexArray=new Float32Array(Lb*3);jc.__colorArray=new Float32Array(Lb*3);jc.__webglLineCount=Lb;b(jc,fc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(h instanceof THREE.ParticleSystem){k=h.geometry;if(!k.__webglVertexBuffer){var Vb=k;Vb.__webglVertexBuffer=g.createBuffer();Vb.__webglColorBuffer=g.createBuffer();E.info.geometries++;var Wb=
+k,hc=h,Nb=Wb.vertices.length;Wb.__vertexArray=new Float32Array(Nb*3);Wb.__colorArray=new Float32Array(Nb*3);Wb.__sortArray=[];Wb.__webglParticleCount=Nb;b(Wb,hc);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!h.__webglActive){if(h instanceof THREE.Mesh){k=h.geometry;if(k instanceof THREE.BufferGeometry)n(i.__webglObjects,k,h);else for(j in k.geometryGroups){l=k.geometryGroups[j];n(i.__webglObjects,l,h)}}else if(h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem){k=
 h.geometry;n(i.__webglObjects,k,h)}else h instanceof THREE.ImmediateRenderObject||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=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ra=a.__objectsRemoved[0],yc=a;Ra instanceof THREE.Mesh||Ra instanceof THREE.ParticleSystem||Ra instanceof THREE.Ribbon||Ra instanceof
-THREE.Line?u(yc.__webglObjects,Ra):Ra instanceof THREE.Sprite?o(yc.__webglSprites,Ra):Ra instanceof THREE.LensFlare?o(yc.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(yc.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Ob=0,ic=a.__webglObjects.length;Ob<ic;Ob++){var Xa=a.__webglObjects[Ob].object,W=Xa.geometry,kc=void 0,Yb=void 0,Ka=void 0;if(Xa instanceof THREE.Mesh)if(W instanceof THREE.BufferGeometry){if(W.verticesNeedUpdate||
-W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate){var qb=W,Zb=g.DYNAMIC_DRAW,wc=!W.dynamic,$b=qb.attributes,Pc=$b.index,Qc=$b.position,Rc=$b.normal,Sc=$b.uv,Tc=$b.color,Uc=$b.tangent;if(qb.elementsNeedUpdate&&Pc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pc.array,Zb)}if(qb.verticesNeedUpdate&&Qc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Qc.buffer);g.bufferData(g.ARRAY_BUFFER,Qc.array,Zb)}if(qb.normalsNeedUpdate&&
-Rc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ARRAY_BUFFER,Rc.array,Zb)}if(qb.uvsNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Zb)}if(qb.colorsNeedUpdate&&Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Zb)}if(qb.tangentsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Zb)}if(wc){var gc=void 0;for(gc in qb.attributes)delete qb.attributes[gc].array}}W.verticesNeedUpdate=
-false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false}else{for(var Vc=0,xc=W.geometryGroupsList.length;Vc<xc;Vc++){kc=W.geometryGroupsList[Vc];Ka=c(Xa,kc);Yb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||W.morphTargetsNeedUpdate||W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate||Yb){var Y=kc,Nc=Xa,Ma=g.DYNAMIC_DRAW,Oc=!W.dynamic,Pb=Ka;if(Y.__inittedArrays){var dd=d(Pb),
-Wc=Pb.vertexColors?Pb.vertexColors:false,ed=f(Pb),zc=dd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,C=void 0,ac=void 0,xb=void 0,Ya=void 0,Ac=void 0,rb=void 0,bc=void 0,cc=void 0,O=void 0,P=void 0,Q=void 0,ga=void 0,Za=void 0,$a=void 0,ab=void 0,lc=void 0,bb=void 0,cb=void 0,db=void 0,mc=void 0,eb=void 0,fb=void 0,gb=void 0,nc=void 0,hb=void 0,ib=void 0,jb=void 0,oc=void 0,kb=void 0,lb=void 0,mb=void 0,pc=void 0,yb=void 0,zb=void 0,Ab=void 0,Bc=void 0,Bb=void 0,Cb=void 0,Db=void 0,Cc=void 0,
-ca=void 0,fd=void 0,Eb=void 0,dc=void 0,ec=void 0,Ca=void 0,gd=void 0,ya=void 0,za=void 0,Fb=void 0,sb=void 0,sa=0,wa=0,tb=0,ub=0,Sa=0,Ga=0,ha=0,Ia=0,ta=0,B=0,X=0,w=0,Na=void 0,Da=Y.__vertexArray,qc=Y.__uvArray,rc=Y.__uv2Array,Ta=Y.__normalArray,ka=Y.__tangentArray,Ea=Y.__colorArray,la=Y.__skinVertexAArray,ma=Y.__skinVertexBArray,na=Y.__skinIndexArray,oa=Y.__skinWeightArray,Xc=Y.__morphTargetsArrays,Yc=Y.__morphNormalsArrays,Zc=Y.__webglCustomAttributesList,t=void 0,nb=Y.__faceArray,Oa=Y.__lineArray,
+THREE.Line?u(yc.__webglObjects,Ra):Ra instanceof THREE.Sprite?o(yc.__webglSprites,Ra):Ra instanceof THREE.LensFlare?o(yc.__webglFlares,Ra):(Ra instanceof THREE.ImmediateRenderObject||Ra.immediateRenderCallback)&&u(yc.__webglObjectsImmediate,Ra);Ra.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var Ob=0,ic=a.__webglObjects.length;Ob<ic;Ob++){var Xa=a.__webglObjects[Ob].object,W=Xa.geometry,kc=void 0,Xb=void 0,Ka=void 0;if(Xa instanceof THREE.Mesh)if(W instanceof THREE.BufferGeometry){if(W.verticesNeedUpdate||
+W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate){var qb=W,Yb=g.DYNAMIC_DRAW,wc=!W.dynamic,Zb=qb.attributes,Pc=Zb.index,Qc=Zb.position,Rc=Zb.normal,Sc=Zb.uv,Tc=Zb.color,Uc=Zb.tangent;if(qb.elementsNeedUpdate&&Pc!==void 0){g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Pc.buffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Pc.array,Yb)}if(qb.verticesNeedUpdate&&Qc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Qc.buffer);g.bufferData(g.ARRAY_BUFFER,Qc.array,Yb)}if(qb.normalsNeedUpdate&&
+Rc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Rc.buffer);g.bufferData(g.ARRAY_BUFFER,Rc.array,Yb)}if(qb.uvsNeedUpdate&&Sc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Sc.buffer);g.bufferData(g.ARRAY_BUFFER,Sc.array,Yb)}if(qb.colorsNeedUpdate&&Tc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Tc.buffer);g.bufferData(g.ARRAY_BUFFER,Tc.array,Yb)}if(qb.tangentsNeedUpdate&&Uc!==void 0){g.bindBuffer(g.ARRAY_BUFFER,Uc.buffer);g.bufferData(g.ARRAY_BUFFER,Uc.array,Yb)}if(wc){var gc=void 0;for(gc in qb.attributes)delete qb.attributes[gc].array}}W.verticesNeedUpdate=
+false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false}else{for(var Vc=0,xc=W.geometryGroupsList.length;Vc<xc;Vc++){kc=W.geometryGroupsList[Vc];Ka=c(Xa,kc);Xb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||W.morphTargetsNeedUpdate||W.elementsNeedUpdate||W.uvsNeedUpdate||W.normalsNeedUpdate||W.colorsNeedUpdate||W.tangentsNeedUpdate||Xb){var Y=kc,Nc=Xa,Ma=g.DYNAMIC_DRAW,Oc=!W.dynamic,Pb=Ka;if(Y.__inittedArrays){var dd=d(Pb),
+Wc=Pb.vertexColors?Pb.vertexColors:false,ed=f(Pb),zc=dd===THREE.SmoothShading,y=void 0,M=void 0,Ua=void 0,C=void 0,$b=void 0,xb=void 0,Ya=void 0,Ac=void 0,rb=void 0,ac=void 0,bc=void 0,O=void 0,P=void 0,Q=void 0,ga=void 0,Za=void 0,$a=void 0,ab=void 0,lc=void 0,bb=void 0,cb=void 0,db=void 0,mc=void 0,eb=void 0,fb=void 0,gb=void 0,nc=void 0,hb=void 0,ib=void 0,jb=void 0,oc=void 0,kb=void 0,lb=void 0,mb=void 0,pc=void 0,yb=void 0,zb=void 0,Ab=void 0,Bc=void 0,Bb=void 0,Cb=void 0,Db=void 0,Cc=void 0,
+ca=void 0,fd=void 0,Eb=void 0,cc=void 0,dc=void 0,Ca=void 0,gd=void 0,ya=void 0,za=void 0,Fb=void 0,sb=void 0,sa=0,wa=0,tb=0,ub=0,Sa=0,Ga=0,ha=0,Ia=0,ta=0,B=0,X=0,w=0,Na=void 0,Da=Y.__vertexArray,qc=Y.__uvArray,rc=Y.__uv2Array,Ta=Y.__normalArray,ka=Y.__tangentArray,Ea=Y.__colorArray,la=Y.__skinVertexAArray,ma=Y.__skinVertexBArray,na=Y.__skinIndexArray,oa=Y.__skinWeightArray,Xc=Y.__morphTargetsArrays,Yc=Y.__morphNormalsArrays,Zc=Y.__webglCustomAttributesList,t=void 0,nb=Y.__faceArray,Oa=Y.__lineArray,
 Ja=Nc.geometry,od=Ja.elementsNeedUpdate,hd=Ja.uvsNeedUpdate,pd=Ja.normalsNeedUpdate,qd=Ja.tangentsNeedUpdate,rd=Ja.colorsNeedUpdate,sd=Ja.morphTargetsNeedUpdate,Qb=Ja.vertices,da=Y.faces3,ea=Y.faces4,ua=Ja.faces,$c=Ja.faceVertexUvs[0],ad=Ja.faceVertexUvs[1],Rb=Ja.skinVerticesA,Sb=Ja.skinVerticesB,Tb=Ja.skinIndices,Gb=Ja.skinWeights,Hb=Ja.morphTargets,Dc=Ja.morphNormals;if(Ja.verticesNeedUpdate){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=Qb[C.a];P=Qb[C.b];Q=Qb[C.c];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=
 O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;wa=wa+9}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=Qb[C.a];P=Qb[C.b];Q=Qb[C.c];ga=Qb[C.d];Da[wa]=O.x;Da[wa+1]=O.y;Da[wa+2]=O.z;Da[wa+3]=P.x;Da[wa+4]=P.y;Da[wa+5]=P.z;Da[wa+6]=Q.x;Da[wa+7]=Q.y;Da[wa+8]=Q.z;Da[wa+9]=ga.x;Da[wa+10]=ga.y;Da[wa+11]=ga.z;wa=wa+12}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Da,Ma)}if(sd){Ca=0;for(gd=Hb.length;Ca<gd;Ca++){y=X=0;for(M=da.length;y<M;y++){Fb=
 da[y];C=ua[Fb];O=Hb[Ca].vertices[C.a];P=Hb[Ca].vertices[C.b];Q=Hb[Ca].vertices[C.c];ya=Xc[Ca];ya[X]=O.x;ya[X+1]=O.y;ya[X+2]=O.z;ya[X+3]=P.x;ya[X+4]=P.y;ya[X+5]=P.z;ya[X+6]=Q.x;ya[X+7]=Q.y;ya[X+8]=Q.z;if(Pb.morphNormals){if(zc){sb=Dc[Ca].vertexNormals[Fb];bb=sb.a;cb=sb.b;db=sb.c}else db=cb=bb=Dc[Ca].faceNormals[Fb];za=Yc[Ca];za[X]=bb.x;za[X+1]=bb.y;za[X+2]=bb.z;za[X+3]=cb.x;za[X+4]=cb.y;za[X+5]=cb.z;za[X+6]=db.x;za[X+7]=db.y;za[X+8]=db.z}X=X+9}y=0;for(M=ea.length;y<M;y++){Fb=ea[y];C=ua[Fb];O=Hb[Ca].vertices[C.a];
@@ -363,10 +363,10 @@ lb=Tb[C.b];mb=Tb[C.c];na[B]=kb.x;na[B+1]=kb.y;na[B+2]=kb.z;na[B+3]=kb.w;na[B+4]=
 ma[B+10]=Db.z;ma[B+11]=1;ma[B+12]=Cc.x;ma[B+13]=Cc.y;ma[B+14]=Cc.z;ma[B+15]=1;B=B+16}if(B>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexABuffer);g.bufferData(g.ARRAY_BUFFER,la,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinVertexBBuffer);g.bufferData(g.ARRAY_BUFFER,ma,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinIndicesBuffer);g.bufferData(g.ARRAY_BUFFER,na,Ma);g.bindBuffer(g.ARRAY_BUFFER,Y.__webglSkinWeightsBuffer);g.bufferData(g.ARRAY_BUFFER,oa,Ma)}}if(rd&&Wc){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];
 Ya=C.vertexColors;Ac=C.color;if(Ya.length===3&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2]}else gb=fb=eb=Ac;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;ta=ta+9}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];Ya=C.vertexColors;Ac=C.color;if(Ya.length===4&&Wc===THREE.VertexColors){eb=Ya[0];fb=Ya[1];gb=Ya[2];nc=Ya[3]}else nc=gb=fb=eb=Ac;Ea[ta]=eb.r;Ea[ta+1]=eb.g;Ea[ta+2]=eb.b;Ea[ta+3]=fb.r;Ea[ta+4]=fb.g;Ea[ta+5]=fb.b;Ea[ta+
 6]=gb.r;Ea[ta+7]=gb.g;Ea[ta+8]=gb.b;Ea[ta+9]=nc.r;Ea[ta+10]=nc.g;Ea[ta+11]=nc.b;ta=ta+12}if(ta>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Ea,Ma)}}if(qd&&Ja.hasTangents){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];rb=C.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ha=ha+12}y=0;for(M=ea.length;y<M;y++){C=
-ua[ea[y]];rb=C.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];lc=rb[3];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ka[ha+12]=lc.x;ka[ha+13]=lc.y;ka[ha+14]=lc.z;ka[ha+15]=lc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ka,Ma)}if(pd&&dd){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];ac=C.vertexNormals;xb=C.normal;if(ac.length===3&&zc)for(ca=
-0;ca<3;ca++){Eb=ac[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<3;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];ac=C.vertexNormals;xb=C.normal;if(ac.length===4&&zc)for(ca=0;ca<4;ca++){Eb=ac[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<4;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Ma)}if(hd&&$c&&ed){y=0;for(M=
-da.length;y<M;y++){Ua=da[y];C=ua[Ua];bc=$c[Ua];if(bc!==void 0)for(ca=0;ca<3;ca++){dc=bc[ca];qc[tb]=dc.u;qc[tb+1]=dc.v;tb=tb+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];bc=$c[Ua];if(bc!==void 0)for(ca=0;ca<4;ca++){dc=bc[ca];qc[tb]=dc.u;qc[tb+1]=dc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,qc,Ma)}}if(hd&&ad&&ed){y=0;for(M=da.length;y<M;y++){Ua=da[y];C=ua[Ua];cc=ad[Ua];if(cc!==void 0)for(ca=0;ca<3;ca++){ec=cc[ca];rc[ub]=ec.u;rc[ub+1]=ec.v;ub=
-ub+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];cc=ad[Ua];if(cc!==void 0)for(ca=0;ca<4;ca++){ec=cc[ca];rc[ub]=ec.u;rc[ub+1]=ec.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,rc,Ma)}}if(od){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+2;Sa=Sa+3;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+2;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Ia=Ia+6;sa=sa+3}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+
+ua[ea[y]];rb=C.vertexTangents;Za=rb[0];$a=rb[1];ab=rb[2];lc=rb[3];ka[ha]=Za.x;ka[ha+1]=Za.y;ka[ha+2]=Za.z;ka[ha+3]=Za.w;ka[ha+4]=$a.x;ka[ha+5]=$a.y;ka[ha+6]=$a.z;ka[ha+7]=$a.w;ka[ha+8]=ab.x;ka[ha+9]=ab.y;ka[ha+10]=ab.z;ka[ha+11]=ab.w;ka[ha+12]=lc.x;ka[ha+13]=lc.y;ka[ha+14]=lc.z;ka[ha+15]=lc.w;ha=ha+16}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglTangentBuffer);g.bufferData(g.ARRAY_BUFFER,ka,Ma)}if(pd&&dd){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];$b=C.vertexNormals;xb=C.normal;if($b.length===3&&zc)for(ca=
+0;ca<3;ca++){Eb=$b[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<3;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];$b=C.vertexNormals;xb=C.normal;if($b.length===4&&zc)for(ca=0;ca<4;ca++){Eb=$b[ca];Ta[Ga]=Eb.x;Ta[Ga+1]=Eb.y;Ta[Ga+2]=Eb.z;Ga=Ga+3}else for(ca=0;ca<4;ca++){Ta[Ga]=xb.x;Ta[Ga+1]=xb.y;Ta[Ga+2]=xb.z;Ga=Ga+3}}g.bindBuffer(g.ARRAY_BUFFER,Y.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,Ta,Ma)}if(hd&&$c&&ed){y=0;for(M=
+da.length;y<M;y++){Ua=da[y];C=ua[Ua];ac=$c[Ua];if(ac!==void 0)for(ca=0;ca<3;ca++){cc=ac[ca];qc[tb]=cc.u;qc[tb+1]=cc.v;tb=tb+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];ac=$c[Ua];if(ac!==void 0)for(ca=0;ca<4;ca++){cc=ac[ca];qc[tb]=cc.u;qc[tb+1]=cc.v;tb=tb+2}}if(tb>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUVBuffer);g.bufferData(g.ARRAY_BUFFER,qc,Ma)}}if(hd&&ad&&ed){y=0;for(M=da.length;y<M;y++){Ua=da[y];C=ua[Ua];bc=ad[Ua];if(bc!==void 0)for(ca=0;ca<3;ca++){dc=bc[ca];rc[ub]=dc.u;rc[ub+1]=dc.v;ub=
+ub+2}}y=0;for(M=ea.length;y<M;y++){Ua=ea[y];C=ua[Ua];bc=ad[Ua];if(bc!==void 0)for(ca=0;ca<4;ca++){dc=bc[ca];rc[ub]=dc.u;rc[ub+1]=dc.v;ub=ub+2}}if(ub>0){g.bindBuffer(g.ARRAY_BUFFER,Y.__webglUV2Buffer);g.bufferData(g.ARRAY_BUFFER,rc,Ma)}}if(od){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+2;Sa=Sa+3;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+2;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Ia=Ia+6;sa=sa+3}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];nb[Sa]=sa;nb[Sa+1]=sa+1;nb[Sa+2]=sa+
 3;nb[Sa+3]=sa+1;nb[Sa+4]=sa+2;nb[Sa+5]=sa+3;Sa=Sa+6;Oa[Ia]=sa;Oa[Ia+1]=sa+1;Oa[Ia+2]=sa;Oa[Ia+3]=sa+3;Oa[Ia+4]=sa+1;Oa[Ia+5]=sa+2;Oa[Ia+6]=sa+2;Oa[Ia+7]=sa+3;Ia=Ia+8;sa=sa+4}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,nb,Ma);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Y.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Oa,Ma)}if(Zc){ca=0;for(fd=Zc.length;ca<fd;ca++){t=Zc[ca];if(t.__original.needsUpdate){w=0;if(t.size===1)if(t.boundTo===void 0||t.boundTo===
 "vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];t.array[w]=t.value[C.a];t.array[w+1]=t.value[C.b];t.array[w+2]=t.value[C.c];w=w+3}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];t.array[w]=t.value[C.a];t.array[w+1]=t.value[C.b];t.array[w+2]=t.value[C.c];t.array[w+3]=t.value[C.d];w=w+4}}else{if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Na=t.value[da[y]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=Na;w=w+3}y=0;for(M=ea.length;y<M;y++){Na=t.value[ea[y]];t.array[w]=Na;t.array[w+1]=Na;t.array[w+2]=
 Na;t.array[w+3]=Na;w=w+4}}}else if(t.size===2)if(t.boundTo===void 0||t.boundTo==="vertices"){y=0;for(M=da.length;y<M;y++){C=ua[da[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;w=w+6}y=0;for(M=ea.length;y<M;y++){C=ua[ea[y]];O=t.value[C.a];P=t.value[C.b];Q=t.value[C.c];ga=t.value[C.d];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=P.x;t.array[w+3]=P.y;t.array[w+4]=Q.x;t.array[w+5]=Q.y;t.array[w+6]=ga.x;
@@ -378,23 +378,23 @@ P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[
 16}}else if(t.boundTo==="faces"){y=0;for(M=da.length;y<M;y++){Q=P=O=Na=t.value[da[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;w=w+12}y=0;for(M=ea.length;y<M;y++){ga=Q=P=O=Na=t.value[ea[y]];t.array[w]=O.x;t.array[w+1]=O.y;t.array[w+2]=O.z;t.array[w+3]=O.w;t.array[w+4]=P.x;t.array[w+5]=P.y;t.array[w+6]=P.z;t.array[w+7]=P.w;t.array[w+8]=Q.x;
 t.array[w+9]=Q.y;t.array[w+10]=Q.z;t.array[w+11]=Q.w;t.array[w+12]=ga.x;t.array[w+13]=ga.y;t.array[w+14]=ga.z;t.array[w+15]=ga.w;w=w+16}}g.bindBuffer(g.ARRAY_BUFFER,t.buffer);g.bufferData(g.ARRAY_BUFFER,t.array,Ma)}}}if(Oc){delete Y.__inittedArrays;delete Y.__colorArray;delete Y.__normalArray;delete Y.__tangentArray;delete Y.__uvArray;delete Y.__uv2Array;delete Y.__faceArray;delete Y.__vertexArray;delete Y.__lineArray;delete Y.__skinVertexAArray;delete Y.__skinVertexBArray;delete Y.__skinIndexArray;
 delete Y.__skinWeightArray}}}}W.verticesNeedUpdate=false;W.morphTargetsNeedUpdate=false;W.elementsNeedUpdate=false;W.uvsNeedUpdate=false;W.normalsNeedUpdate=false;W.colorsNeedUpdate=false;W.tangentsNeedUpdate=false;Ka.attributes&&q(Ka)}else if(Xa instanceof THREE.Ribbon){if(W.verticesNeedUpdate||W.colorsNeedUpdate){var Ib=W,id=g.DYNAMIC_DRAW,sc=void 0,tc=void 0,Ec=void 0,Jb=void 0,Fc=void 0,jd=Ib.vertices,kd=Ib.colors,td=jd.length,ud=kd.length,Gc=Ib.__vertexArray,Hc=Ib.__colorArray,vd=Ib.colorsNeedUpdate;
-if(Ib.verticesNeedUpdate){for(sc=0;sc<td;sc++){Ec=jd[sc];Jb=sc*3;Gc[Jb]=Ec.x;Gc[Jb+1]=Ec.y;Gc[Jb+2]=Ec.z}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Gc,id)}if(vd){for(tc=0;tc<ud;tc++){Fc=kd[tc];Jb=tc*3;Hc[Jb]=Fc.r;Hc[Jb+1]=Fc.g;Hc[Jb+2]=Fc.b}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Hc,id)}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Ka=c(Xa,kc);Yb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||
-W.colorsNeedUpdate||Yb){var vb=W,bd=g.DYNAMIC_DRAW,uc=void 0,vc=void 0,Ic=void 0,pa=void 0,Jc=void 0,ld=vb.vertices,md=vb.colors,wd=ld.length,xd=md.length,Kc=vb.__vertexArray,Lc=vb.__colorArray,yd=vb.colorsNeedUpdate,cd=vb.__webglCustomAttributesList,Mc=void 0,nd=void 0,Fa=void 0,fc=void 0,La=void 0,ia=void 0;if(vb.verticesNeedUpdate){for(uc=0;uc<wd;uc++){Ic=ld[uc];pa=uc*3;Kc[pa]=Ic.x;Kc[pa+1]=Ic.y;Kc[pa+2]=Ic.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,bd)}if(yd){for(vc=
-0;vc<xd;vc++){Jc=md[vc];pa=vc*3;Lc[pa]=Jc.r;Lc[pa+1]=Jc.g;Lc[pa+2]=Jc.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Lc,bd)}if(cd){Mc=0;for(nd=cd.length;Mc<nd;Mc++){ia=cd[Mc];if(ia.needsUpdate&&(ia.boundTo===void 0||ia.boundTo==="vertices")){pa=0;fc=ia.value.length;if(ia.size===1)for(Fa=0;Fa<fc;Fa++)ia.array[Fa]=ia.value[Fa];else if(ia.size===2)for(Fa=0;Fa<fc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;pa=pa+2}else if(ia.size===3)if(ia.type==="c")for(Fa=
-0;Fa<fc;Fa++){La=ia.value[Fa];ia.array[pa]=La.r;ia.array[pa+1]=La.g;ia.array[pa+2]=La.b;pa=pa+3}else for(Fa=0;Fa<fc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;pa=pa+3}else if(ia.size===4)for(Fa=0;Fa<fc;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;ia.array[pa+3]=La.w;pa=pa+4}g.bindBuffer(g.ARRAY_BUFFER,ia.buffer);g.bufferData(g.ARRAY_BUFFER,ia.array,bd)}}}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}else if(Xa instanceof
-THREE.ParticleSystem){Ka=c(Xa,kc);Yb=Ka.attributes&&m(Ka);(W.verticesNeedUpdate||W.colorsNeedUpdate||Xa.sortParticles||Yb)&&e(W,g.DYNAMIC_DRAW,Xa);W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?
+if(Ib.verticesNeedUpdate){for(sc=0;sc<td;sc++){Ec=jd[sc];Jb=sc*3;Gc[Jb]=Ec.x;Gc[Jb+1]=Ec.y;Gc[Jb+2]=Ec.z}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Gc,id)}if(vd){for(tc=0;tc<ud;tc++){Fc=kd[tc];Jb=tc*3;Hc[Jb]=Fc.r;Hc[Jb+1]=Fc.g;Hc[Jb+2]=Fc.b}g.bindBuffer(g.ARRAY_BUFFER,Ib.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Hc,id)}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false}else if(Xa instanceof THREE.Line){Ka=c(Xa,kc);Xb=Ka.attributes&&m(Ka);if(W.verticesNeedUpdate||
+W.colorsNeedUpdate||Xb){var vb=W,bd=g.DYNAMIC_DRAW,uc=void 0,vc=void 0,Ic=void 0,pa=void 0,Jc=void 0,ld=vb.vertices,md=vb.colors,wd=ld.length,xd=md.length,Kc=vb.__vertexArray,Lc=vb.__colorArray,yd=vb.colorsNeedUpdate,cd=vb.__webglCustomAttributesList,Mc=void 0,nd=void 0,Fa=void 0,ec=void 0,La=void 0,ia=void 0;if(vb.verticesNeedUpdate){for(uc=0;uc<wd;uc++){Ic=ld[uc];pa=uc*3;Kc[pa]=Ic.x;Kc[pa+1]=Ic.y;Kc[pa+2]=Ic.z}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,Kc,bd)}if(yd){for(vc=
+0;vc<xd;vc++){Jc=md[vc];pa=vc*3;Lc[pa]=Jc.r;Lc[pa+1]=Jc.g;Lc[pa+2]=Jc.b}g.bindBuffer(g.ARRAY_BUFFER,vb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,Lc,bd)}if(cd){Mc=0;for(nd=cd.length;Mc<nd;Mc++){ia=cd[Mc];if(ia.needsUpdate&&(ia.boundTo===void 0||ia.boundTo==="vertices")){pa=0;ec=ia.value.length;if(ia.size===1)for(Fa=0;Fa<ec;Fa++)ia.array[Fa]=ia.value[Fa];else if(ia.size===2)for(Fa=0;Fa<ec;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;pa=pa+2}else if(ia.size===3)if(ia.type==="c")for(Fa=
+0;Fa<ec;Fa++){La=ia.value[Fa];ia.array[pa]=La.r;ia.array[pa+1]=La.g;ia.array[pa+2]=La.b;pa=pa+3}else for(Fa=0;Fa<ec;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;pa=pa+3}else if(ia.size===4)for(Fa=0;Fa<ec;Fa++){La=ia.value[Fa];ia.array[pa]=La.x;ia.array[pa+1]=La.y;ia.array[pa+2]=La.z;ia.array[pa+3]=La.w;pa=pa+4}g.bindBuffer(g.ARRAY_BUFFER,ia.buffer);g.bufferData(g.ARRAY_BUFFER,ia.array,bd)}}}}W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}else if(Xa instanceof
+THREE.ParticleSystem){Ka=c(Xa,kc);Xb=Ka.attributes&&m(Ka);(W.verticesNeedUpdate||W.colorsNeedUpdate||Xa.sortParticles||Xb)&&e(W,g.DYNAMIC_DRAW,Xa);W.verticesNeedUpdate=false;W.colorsNeedUpdate=false;Ka.attributes&&q(Ka)}}};this.initMaterial=function(a,b,c,d){var e,f,h,i,j,k,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?
 n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var m=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var o,q;o=h=e=m=0;for(f=b.length;o<f;o++){q=b[o];if(!q.onlyShadow){q instanceof THREE.DirectionalLight&&h++;q instanceof THREE.PointLight&&e++;q instanceof THREE.SpotLight&&m++}}if(e+m+h<=V){o=h;f=e}else{o=Math.ceil(V*h/(e+h));m=f=V-o}e=
-o;h=m;m=l=0;for(o=b.length;m<o;m++){q=b[m];if(q.castShadow){q instanceof THREE.SpotLight&&l++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&l++}}if(Wb)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var p;a:{q=a.fragmentShader;o=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,maxBones:k,boneTextureWidth:d.boneTextureWidth,boneTextureHeight:d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&
-d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(n)d.push(n);else{d.push(q);d.push(o)}for(r in c){d.push(r);d.push(c[r])}n=d.join();r=0;for(d=$.length;r<d;r++){e=$[r];if(e.code===n){e.usedTimes++;p=e.program;break a}}r=g.createProgram();d=["precision "+D+" float;",ic?"#define VERTEX_TEXTURES":"",E.gammaInput?
-"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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":"",Wb?"#define BONE_TEXTURE":
-"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
-"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+o;h=m;m=l=0;for(o=b.length;m<o;m++){q=b[m];if(q.castShadow){q instanceof THREE.SpotLight&&l++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&l++}}if(Vb&&d.useVertexTexture)k=1024;else{b=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}k=b}var p;a:{q=a.fragmentShader;
+o=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,maxBones:k,useVertexTexture:Vb&&d.useVertexTexture,boneTextureWidth:d.boneTextureWidth,boneTextureHeight:d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,
+maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(n)d.push(n);else{d.push(q);d.push(o)}for(r in c){d.push(r);d.push(c[r])}n=d.join();r=0;for(d=$.length;r<d;r++){e=$[r];if(e.code===n){e.usedTimes++;p=e.program;break a}}r=g.createProgram();d=["precision "+D+
+" float;",ic?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?
+"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\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 "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-e=x("fragment",e+q);d=x("vertex",d+o);g.attachShader(r,d);g.attachShader(r,e);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()+"]");g.deleteShader(e);g.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];Wb?d.push("boneTexture"):d.push("boneGlobalMatrices");
-for(s in m)d.push(s);s=d;d=0;for(m=s.length;d<m;d++){e=s[d];r.uniforms[e]=g.getUniformLocation(r,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(c=p.length;s<c;s++){d=p[s];r.attributes[d]=g.getAttribLocation(r,d)}r.id=fa++;$.push({program:r,code:n,usedTimes:1});E.info.memory.programs=$.length;p=
-r}a.program=p;p=a.program.attributes;p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(j in a.attributes)p[j]!==
+e=x("fragment",e+q);d=x("vertex",d+o);g.attachShader(r,d);g.attachShader(r,e);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()+"]");g.deleteShader(e);g.deleteShader(d);r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):
+d.push("boneGlobalMatrices");for(s in m)d.push(s);s=d;d=0;for(m=s.length;d<m;d++){e=s[d];r.uniforms[e]=g.getUniformLocation(r,e)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(p in b)d.push(p);p=d;s=0;for(c=p.length;s<c;s++){d=p[s];r.attributes[d]=g.getAttribLocation(r,d)}r.id=fa++;$.push({program:r,code:n,usedTimes:1});E.info.memory.programs=
+$.length;p=r}a.program=p;p=a.program.attributes;p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);if(a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0){g.enableVertexAttribArray(p.skinVertexA);g.enableVertexAttribArray(p.skinVertexB);g.enableVertexAttribArray(p.skinIndex);g.enableVertexAttribArray(p.skinWeight)}if(a.attributes)for(j in a.attributes)p[j]!==
 void 0&&p[j]>=0&&g.enableVertexAttribArray(p[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){s=r+j;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){s=r+j;if(p[s]>=0){g.enableVertexAttribArray(p[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=
 function(a,b){if(a){!b||b==="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW);a==="back"?g.cullFace(g.BACK):a==="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK);g.enable(g.CULL_FACE)}else g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(L!==a.doubleSided){a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE);L=a.doubleSided}if(qa!==a.flipSided){a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW);qa=a.flipSided}};this.setDepthTest=function(a){if(Ba!==a){a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST);
 Ba=a}};this.setDepthWrite=function(a){if(Qa!==a){g.depthMask(a);Qa=a}};this.setBlending=function(a,b,c,d){if(a!==xa){if(a===THREE.NoBlending)g.disable(g.BLEND);else if(a===THREE.AdditiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE)}else if(a===THREE.SubtractiveBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
@@ -403,7 +403,7 @@ b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);g.pixelStorei(g.UNPACK_FLIP_Y_WE
 b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=g.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);F(g.TEXTURE_CUBE_MAP,a,c);
 for(var f=0;f<6;f++){a.__webglFramebuffer[f]=g.createFramebuffer();a.__webglRenderbuffer[f]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,i=g.TEXTURE_CUBE_MAP_POSITIVE_X+f;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[f]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,i,h.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&g.generateMipmap(g.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=g.createFramebuffer();a.__webglRenderbuffer=
 g.createRenderbuffer();g.bindTexture(g.TEXTURE_2D,a.__webglTexture);F(g.TEXTURE_2D,a,c);g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=g.TEXTURE_2D;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&g.generateMipmap(g.TEXTURE_2D)}b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,
-null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=hc;a=Nb;d=Ub;e=Lb}if(b!==ra){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);ra=b}wc=c;gc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=hc;a=Nb;d=Ub;e=fc}if(b!==ra){g.bindFramebuffer(g.FRAMEBUFFER,b);g.viewport(d,e,c,a);ra=b}wc=c;gc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 1 - 1
examples/webgl_animation_skinning.html

@@ -165,7 +165,7 @@
 
 					for( z = 0; z < gridz; z ++ ) {
 
-						buffalo = new THREE.SkinnedMesh( geometry, material );
+						buffalo = new THREE.SkinnedMesh( geometry, material, false );
 
 						//buffalo.doubleSided = true;
 

+ 2 - 2
src/objects/SkinnedMesh.js

@@ -3,13 +3,13 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.SkinnedMesh = function ( geometry, material ) {
+THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {
 
 	THREE.Mesh.call( this, geometry, material );
 
 	//
 
-	this.useVertexTexture = true;
+	this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true;
 
 	// init bones
 

+ 5 - 4
src/renderers/WebGLRenderer.js

@@ -4526,6 +4526,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			skinning: material.skinning,
 			maxBones: maxBones,
+			useVertexTexture: _supportsBoneTextures && object.useVertexTexture,
 			boneTextureWidth: object.boneTextureWidth,
 			boneTextureHeight: object.boneTextureHeight,
 
@@ -4799,7 +4800,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( material.skinning ) {
 
-			if ( _supportsBoneTextures ) {
+			if ( _supportsBoneTextures && object.useVertexTexture ) {
 
 				if ( p_uniforms.boneTexture !== null ) {
 
@@ -5698,7 +5699,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			parameters.vertexColors ? "#define USE_COLOR" : "",
 
 			parameters.skinning ? "#define USE_SKINNING" : "",
-			_supportsBoneTextures ? "#define BONE_TEXTURE" : "",
+			parameters.useVertexTexture ? "#define BONE_TEXTURE" : "",
 			parameters.boneTextureWidth ? "#define N_BONE_PIXEL_X " + parameters.boneTextureWidth.toFixed( 1 ) : "",
 			parameters.boneTextureHeight ? "#define N_BONE_PIXEL_Y " + parameters.boneTextureHeight.toFixed( 1 ) : "",
 
@@ -5847,7 +5848,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		];
 
-		if ( _supportsBoneTextures ) {
+		if ( parameters.useVertexTexture ) {
 
 			identifiers.push( 'boneTexture' );
 
@@ -6390,7 +6391,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function allocateBones ( object ) {
 
-		if ( _supportsBoneTextures ) {
+		if ( _supportsBoneTextures && object.useVertexTexture ) {
 
 			return 1024;