提交 d6949ea2 编写于 作者: M Mr.doob

NormalBlending is now 1:1 with Blender :_)

No wonder there were premultiplied-alpha-looking issues. We were doing it ourselves :P
上级 6c1b9c58
...@@ -230,62 +230,62 @@ T[G+1]=color.g;T[G+2]=color.b}}else{if(pa)for(o=0;o<E;o++){C=J[o].position;G=o*3 ...@@ -230,62 +230,62 @@ T[G+1]=color.g;T[G+2]=color.b}}else{if(pa)for(o=0;o<E;o++){C=J[o].position;G=o*3
t.fragmentShader}function e(j,t,w,o,C){o.__webglProgram||Y.initMaterial(o,t,w,C);var G=o.program,J=G.uniforms,E=o.uniforms;if(G!=X){d.useProgram(G);X=G}d.uniformMatrix4fv(J.projectionMatrix,!1,ra);if(w&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value= t.fragmentShader}function e(j,t,w,o,C){o.__webglProgram||Y.initMaterial(o,t,w,C);var G=o.program,J=G.uniforms,E=o.uniforms;if(G!=X){d.useProgram(G);X=G}d.uniformMatrix4fv(J.projectionMatrix,!1,ra);if(w&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value=
w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var A,V,K=0,T=0,ja=0,pa,sa,Ba,ya=xa,Fa=ya.directional.colors,fa=ya.directional.positions,U=ya.point.colors,la=ya.point.positions,Ma=0,Ha=0;w=V=V=0;for(A=t.length;w<A;w++){V=t[w];pa=V.color;sa=V.position;Ba=V.intensity;if(V instanceof THREE.AmbientLight){K+=pa.r;T+=pa.g;ja+=pa.b}else if(V instanceof THREE.DirectionalLight){V=Ma*3;Fa[V]=pa.r* w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var A,V,K=0,T=0,ja=0,pa,sa,Ba,ya=xa,Fa=ya.directional.colors,fa=ya.directional.positions,U=ya.point.colors,la=ya.point.positions,Ma=0,Ha=0;w=V=V=0;for(A=t.length;w<A;w++){V=t[w];pa=V.color;sa=V.position;Ba=V.intensity;if(V instanceof THREE.AmbientLight){K+=pa.r;T+=pa.g;ja+=pa.b}else if(V instanceof THREE.DirectionalLight){V=Ma*3;Fa[V]=pa.r*
Ba;Fa[V+1]=pa.g*Ba;Fa[V+2]=pa.b*Ba;fa[V]=sa.x;fa[V+1]=sa.y;fa[V+2]=sa.z;Ma+=1}else if(V instanceof THREE.PointLight){V=Ha*3;U[V]=pa.r*Ba;U[V+1]=pa.g*Ba;U[V+2]=pa.b*Ba;la[V]=sa.x;la[V+1]=sa.y;la[V+2]=sa.z;Ha+=1}}for(w=Ma*3;w<Fa.length;w++)Fa[w]=0;for(w=Ha*3;w<U.length;w++)U[w]=0;ya.point.length=Ha;ya.directional.length=Ma;ya.ambient[0]=K;ya.ambient[1]=T;ya.ambient[2]=ja;w=xa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value= Ba;Fa[V+1]=pa.g*Ba;Fa[V+2]=pa.b*Ba;fa[V]=sa.x;fa[V+1]=sa.y;fa[V+2]=sa.z;Ma+=1}else if(V instanceof THREE.PointLight){V=Ha*3;U[V]=pa.r*Ba;U[V+1]=pa.g*Ba;U[V+2]=pa.b*Ba;la[V]=sa.x;la[V+1]=sa.y;la[V+2]=sa.z;Ha+=1}}for(w=Ma*3;w<Fa.length;w++)Fa[w]=0;for(w=Ha*3;w<U.length;w++)U[w]=0;ya.point.length=Ha;ya.directional.length=Ma;ya.ambient[0]=K;ya.ambient[1]=T;ya.ambient[2]=ja;w=xa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value=
w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.map.texture=o.map;E.lightMap.texture=o.lightMap;E.envMap.texture=o.envMap;E.reflectivity.value=o.reflectivity; w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(o.color.r,o.color.g,o.color.b);E.opacity.value=o.opacity;E.map.texture=o.map;E.lightMap.texture=o.lightMap;E.envMap.texture=o.envMap;E.reflectivity.value=o.reflectivity;E.refractionRatio.value=o.refractionRatio;
E.refractionRatio.value=o.refractionRatio;E.combine.value=o.combine;E.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.size.value=o.size;E.scale.value=$.height/ E.combine.value=o.combine;E.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.size.value=o.size;E.scale.value=$.height/2;E.map.texture=o.map}else if(o instanceof
2;E.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);E.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);E.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)E.opacity.value=o.opacity;for(var fb in E)if(T=G.uniforms[fb]){A=E[fb];K=A.type;w=A.value;if(K=="i")d.uniform1i(T,w);else if(K== THREE.MeshPhongMaterial){E.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);E.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);E.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)E.opacity.value=o.opacity;for(var fb in E)if(T=G.uniforms[fb]){A=E[fb];K=A.type;w=A.value;if(K=="i")d.uniform1i(T,w);else if(K=="f")d.uniform1f(T,w);else if(K=="fv1")d.uniform1fv(T,
"f")d.uniform1f(T,w);else if(K=="fv1")d.uniform1fv(T,w);else if(K=="fv")d.uniform3fv(T,w);else if(K=="v2")d.uniform2f(T,w.x,w.y);else if(K=="v3")d.uniform3f(T,w.x,w.y,w.z);else if(K=="c")d.uniform3f(T,w.r,w.g,w.b);else if(K=="t"){d.uniform1i(T,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,d.RGBA, w);else if(K=="fv")d.uniform3fv(T,w);else if(K=="v2")d.uniform2f(T,w.x,w.y);else if(K=="v3")d.uniform3f(T,w.x,w.y,w.z);else if(K=="c")d.uniform3f(T,w.r,w.g,w.b);else if(K=="t"){d.uniform1i(T,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image[K])}else{A.image.__webGLTextureCube=
d.UNSIGNED_BYTE,A.image[K])}else{A.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image[K]);A.__wasSetOnce=!0}D(d.TEXTURE_CUBE_MAP,A,A.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube)}}else{if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_2D, d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image[K]);A.__wasSetOnce=!0}D(d.TEXTURE_CUBE_MAP,A,A.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube)}}else{if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,
A.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}D(d.TEXTURE_2D,A,A.image);d.bindTexture(d.TEXTURE_2D,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,A.__webGLTexture)}}}d.uniformMatrix4fv(J.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(J.normalMatrix, 0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}D(d.TEXTURE_2D,A,A.image);d.bindTexture(d.TEXTURE_2D,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,A.__webGLTexture)}}}d.uniformMatrix4fv(J.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(J.normalMatrix,!1,C._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
!1,C._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.envMap)&&d.uniform3f(J.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&d.uniformMatrix4fv(J.viewMatrix,!1,na);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j= o instanceof THREE.MeshPhongMaterial||o.envMap)&&d.uniform3f(J.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&d.uniformMatrix4fv(J.viewMatrix,!1,na);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j=E.directionalLightDirection.value;j[0]=
E.directionalLightDirection.value;j[0]=-t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;d.uniform3fv(J.directionalLightDirection,j);d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(J.viewMatrix,!1,na)}if(o.skinning){d.uniformMatrix4fv(J.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(J.boneGlobalMatrices,!1,C.boneMatrices)}return G}function f(j,t,w,o,C,G){if(o.opacity!=0){j=e(j,t,w,o,G).attributes;if(o.morphTargets){t=o.program.attributes;G.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER, -t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;d.uniform3fv(J.directionalLightDirection,j);d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(J.viewMatrix,!1,na)}if(o.skinning){d.uniformMatrix4fv(J.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(J.boneGlobalMatrices,!1,C.boneMatrices)}return G}function f(j,t,w,o,C,G){if(o.opacity!=0){j=e(j,t,w,o,G).attributes;if(o.morphTargets){t=o.program.attributes;G.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[G.morphTargetBase]):
C.__webGLMorphTargetsBuffers[G.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){w=0;for(var J=G.morphTargetForcedOrder,E=G.morphTargetInfluences;w<o.numSupportedMorphTargets&&w<J.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[J[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=E[J[w]];w++}}else{J=[];var A=-1,V=0;E=G.morphTargetInfluences; d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){w=0;for(var J=G.morphTargetForcedOrder,E=G.morphTargetInfluences;w<o.numSupportedMorphTargets&&w<J.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[J[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=E[J[w]];w++}}else{J=[];var A=-1,V=0;E=G.morphTargetInfluences;var K,T=E.length;w=0;for(G.morphTargetBase!==
var K,T=E.length;w=0;for(G.morphTargetBase!==-1&&(J[G.morphTargetBase]=!0);w<o.numSupportedMorphTargets;){for(K=0;K<T;K++)if(!J[K]&&E[K]>A){V=K;A=E[V]}d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[V]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=A;J[V]=1;A=-1;w++}}d.uniform1fv(o.program.uniforms.morphTargetInfluences,G.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(j.position,3, -1&&(J[G.morphTargetBase]=!0);w<o.numSupportedMorphTargets;){for(K=0;K<T;K++)if(!J[K]&&E[K]>A){V=K;A=E[V]}d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[V]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=A;J[V]=1;A=-1;w++}}d.uniform1fv(o.program.uniforms.morphTargetInfluences,G.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(j.position,3,d.FLOAT,!1,0,0)}if(j.color>=0){d.bindBuffer(d.ARRAY_BUFFER,
d.FLOAT,!1,0,0)}if(j.color>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLColorBuffer);d.vertexAttribPointer(j.color,3,d.FLOAT,!1,0,0)}if(j.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(j.normal,3,d.FLOAT,!1,0,0)}if(j.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLTangentBuffer);d.vertexAttribPointer(j.tangent,4,d.FLOAT,!1,0,0)}if(j.uv>=0)if(C.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUVBuffer);d.vertexAttribPointer(j.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv)}else d.disableVertexAttribArray(j.uv); C.__webGLColorBuffer);d.vertexAttribPointer(j.color,3,d.FLOAT,!1,0,0)}if(j.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(j.normal,3,d.FLOAT,!1,0,0)}if(j.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLTangentBuffer);d.vertexAttribPointer(j.tangent,4,d.FLOAT,!1,0,0)}if(j.uv>=0)if(C.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUVBuffer);d.vertexAttribPointer(j.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv)}else d.disableVertexAttribArray(j.uv);if(j.uv2>=
if(j.uv2>=0)if(C.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUV2Buffer);d.vertexAttribPointer(j.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv2)}else d.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);d.vertexAttribPointer(j.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);d.vertexAttribPointer(j.skinVertexB,4,d.FLOAT,!1,0, 0)if(C.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUV2Buffer);d.vertexAttribPointer(j.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv2)}else d.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);d.vertexAttribPointer(j.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);d.vertexAttribPointer(j.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,
0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);d.vertexAttribPointer(j.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);d.vertexAttribPointer(j.skinWeight,4,d.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(o.wireframe){d.lineWidth(o.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);d.drawElements(d.LINES,C.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);d.drawElements(d.TRIANGLES, C.__webGLSkinIndicesBuffer);d.vertexAttribPointer(j.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);d.vertexAttribPointer(j.skinWeight,4,d.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(o.wireframe){d.lineWidth(o.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);d.drawElements(d.LINES,C.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,
C.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(o.linewidth);d.drawArrays(G,0,C.__webGLLineCount)}else if(G instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webGLParticleCount);else G instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=d.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=d.createBuffer(); 0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(o.linewidth);d.drawArrays(G,0,C.__webGLLineCount)}else if(G instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webGLParticleCount);else G instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=d.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=d.createBuffer();if(j.hasPos){d.bindBuffer(d.ARRAY_BUFFER,
if(j.hasPos){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,j.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(j.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,j.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,j.count); j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,j.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(j.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,j.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,j.count);j.count=0}function h(j){if(ua!=j.doubleSided){j.doubleSided?
j.count=0}function h(j){if(ua!=j.doubleSided){j.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ua=j.doubleSided}if(va!=j.flipSided){j.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);va=j.flipSided}}function k(j){if(ma!=j){j?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ma=j}}function m(j){N[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);N[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);N[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);N[3].set(j.n41-j.n21,j.n42- d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ua=j.doubleSided}if(va!=j.flipSided){j.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);va=j.flipSided}}function k(j){if(ma!=j){j?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ma=j}}function m(j){N[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);N[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);N[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);N[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);N[4].set(j.n41-j.n31,j.n42-j.n32,
j.n22,j.n43-j.n23,j.n44-j.n24);N[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);N[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=N[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=N[o].x*t.n14+N[o].y*t.n24+N[o].z*t.n34+N[o].w;if(j<=w)return!1}return!0}function p(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t, j.n43-j.n33,j.n44-j.n34);N[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=N[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=N[o].x*t.n14+N[o].y*t.n24+N[o].z*t.n34+N[o].w;if(j<=w)return!1}return!0}function p(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t,w,o=j.object,C=j.opaque,G=j.transparent;G.count=0;j=C.count=
w,o=j.object,C=j.opaque,G=j.transparent;G.count=0;j=C.count=0;for(t=o.materials.length;j<t;j++){w=o.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(G,w):p(C,w)}}function z(j){var t,w,o,C,G=j.object,J=j.buffer,E=j.opaque,A=j.transparent;A.count=0;j=E.count=0;for(o=G.materials.length;j<o;j++){t=G.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=J.materials.length;t<w;t++)(C=J.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C))}else{C= 0;for(t=o.materials.length;j<t;j++){w=o.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(G,w):p(C,w)}}function z(j){var t,w,o,C,G=j.object,J=j.buffer,E=j.opaque,A=j.transparent;A.count=0;j=E.count=0;for(o=G.materials.length;j<o;j++){t=G.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=J.materials.length;t<w;t++)(C=J.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C))}else{C=t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?
t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C)}}}function y(j,t){return t.z-j.z}function B(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function H(j){var t,w,o;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){o=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals|| p(A,C):p(E,C)}}}function y(j,t){return t.z-j.z}function B(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function H(j){var t,w,o;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){o=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){var C=d.DYNAMIC_DRAW,
w.__dirtyColors||w.__dirtyTangents){var C=d.DYNAMIC_DRAW,G=void 0,J=void 0,E=void 0,A=void 0;E=void 0;var V=void 0,K=void 0,T=void 0,ja=void 0,pa=void 0,sa=void 0,Ba=void 0,ya=void 0,Fa=void 0,fa=void 0,U=void 0,la=void 0,Ma=void 0;K=void 0;T=void 0;A=void 0;ja=void 0;A=void 0;fa=void 0;U=void 0;K=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;A=void 0;ja=void 0;V=void 0;E=void 0;E=void 0;var Ha= G=void 0,J=void 0,E=void 0,A=void 0;E=void 0;var V=void 0,K=void 0,T=void 0,ja=void 0,pa=void 0,sa=void 0,Ba=void 0,ya=void 0,Fa=void 0,fa=void 0,U=void 0,la=void 0,Ma=void 0;K=void 0;T=void 0;A=void 0;ja=void 0;A=void 0;fa=void 0;U=void 0;K=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;A=void 0;ja=void 0;V=void 0;E=void 0;E=void 0;var Ha=void 0,fb=void 0,Ua=void 0,Ja=0,Sa=0,cb=0,eb=0,Qa=0,Va=
void 0,fb=void 0,Ua=void 0,Ja=0,Sa=0,cb=0,eb=0,Qa=0,Va=0,Ea=0,Wa=0,Na=0,O=0,Oa=0,Ra=o.__vertexArray,jb=o.__uvArray,Ca=o.__uv2Array,Ta=o.__normalArray,Ga=o.__tangentArray,Pa=o.__colorArray,Ka=o.__skinVertexAArray,wa=o.__skinVertexBArray,L=o.__skinIndexArray,aa=o.__skinWeightArray,oa=o.__morphTargetsArrays,ea=o.__faceArray,ta=o.__lineArray,Aa=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;Ba=o.__normalType;var ga=j.geometry,ca=ga.__dirtyVertices,La=ga.__dirtyElements,Ya=ga.__dirtyUvs,Za= 0,Ea=0,Wa=0,Na=0,O=0,Oa=0,Ra=o.__vertexArray,jb=o.__uvArray,Ca=o.__uv2Array,Ta=o.__normalArray,Ga=o.__tangentArray,Pa=o.__colorArray,Ka=o.__skinVertexAArray,wa=o.__skinVertexBArray,L=o.__skinIndexArray,aa=o.__skinWeightArray,oa=o.__morphTargetsArrays,ea=o.__faceArray,ta=o.__lineArray,Aa=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;Ba=o.__normalType;var ga=j.geometry,ca=ga.__dirtyVertices,La=ga.__dirtyElements,Ya=ga.__dirtyUvs,Za=ga.__dirtyNormals,db=ga.__dirtyTangents,hb=ga.__dirtyColors,
ga.__dirtyNormals,db=ga.__dirtyTangents,hb=ga.__dirtyColors,bb=ga.__dirtyMorphTargets,Xa=ga.vertices,ob=o.faces,rb=ga.faces,pb=ga.faceVertexUvs[0],qb=ga.faceVertexUvs[1],lb=ga.skinVerticesA,mb=ga.skinVerticesB,nb=ga.skinIndices,ib=ga.skinWeights,kb=ga.edgeFaces,gb=ga.morphTargets;G=0;for(J=ob.length;G<J;G++){E=ob[G];A=rb[E];pb&&(ya=pb[E]);qb&&(Fa=qb[E]);E=A.vertexNormals;V=A.normal;K=A.vertexColors;T=A.color;ja=A.vertexTangents;if(A instanceof THREE.Face3){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position; bb=ga.__dirtyMorphTargets,Xa=ga.vertices,ob=o.faces,rb=ga.faces,pb=ga.faceVertexUvs[0],qb=ga.faceVertexUvs[1],lb=ga.skinVerticesA,mb=ga.skinVerticesB,nb=ga.skinIndices,ib=ga.skinWeights,kb=ga.edgeFaces,gb=ga.morphTargets;G=0;for(J=ob.length;G<J;G++){E=ob[G];A=rb[E];pb&&(ya=pb[E]);qb&&(Fa=qb[E]);E=A.vertexNormals;V=A.normal;K=A.vertexColors;T=A.color;ja=A.vertexTangents;if(A instanceof THREE.Face3){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=
la=Xa[A.c].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Sa+=9}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ua=oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[Oa+5]=U.z;Ua[Oa+6]=la.x;Ua[Oa+7]=la.y;Ua[Oa+8]=la.z}Oa+=9}if(ib.length){fa=ib[A.a];U=ib[A.b];la=ib[A.c];aa[O]=fa.x;aa[O+1]=fa.y;aa[O+2]= fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Sa+=9}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ua=oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[O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1;ta[Wa+5]=Ja+2;Wa+=6;Ja+=3}}else if(A instanceof
4]=Ja+1;ta[Wa+5]=Ja+2;Wa+=6;Ja+=3}}else if(A instanceof THREE.Face4){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ma=Xa[A.d].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Ra[Sa+9]=Ma.x;Ra[Sa+10]=Ma.y;Ra[Sa+11]=Ma.z;Sa+=12}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ma=gb[Ha].vertices[A.d].position;Ua= THREE.Face4){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ma=Xa[A.d].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Ra[Sa+9]=Ma.x;Ra[Sa+10]=Ma.y;Ra[Sa+11]=Ma.z;Sa+=12}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ma=gb[Ha].vertices[A.d].position;Ua=oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+
oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[Oa+5]=U.z;Ua[Oa+6]=la.x;Ua[Oa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ea[Qa]=kb[G].a;ea[Qa+1]=kb[G].b;ea[Qa+2]=kb[G].c;ea[Qa+3]=kb[G].a;ea[Qa+4]=kb[G].c;ea[Qa+5]=kb[G].d;Qa+=6}}if(ca){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,C)}if(bb){Ha=0;for(fb=gb.length;Ha< 1]=Ja+1;ea[Qa+2]=Ja+3;ea[Qa+3]=Ja+1;ea[Qa+4]=Ja+2;ea[Qa+5]=Ja+3;Qa+=6;ta[Wa]=Ja;ta[Wa+1]=Ja+1;ta[Wa+2]=Ja;ta[Wa+3]=Ja+3;ta[Wa+4]=Ja+1;ta[Wa+5]=Ja+2;ta[Wa+6]=Ja+2;ta[Wa+7]=Ja+3;Wa+=8;Ja+=4}}}if(kb){G=0;for(J=kb.length;G<J;G++){ea[Qa]=kb[G].a;ea[Qa+1]=kb[G].b;ea[Qa+2]=kb[G].c;ea[Qa+3]=kb[G].a;ea[Qa+4]=kb[G].c;ea[Qa+5]=kb[G].d;Qa+=6}}if(ca){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,C)}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLMorphTargetsBuffers[Ha]);
fb;Ha++){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLMorphTargetsBuffers[Ha]);d.bufferData(d.ARRAY_BUFFER,oa[Ha],C)}}if(hb&&Na>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,C)}if(Za){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ta,C)}if(db&&ga.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ga,C)}if(Ya&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,jb,C)}if(Ya&& d.bufferData(d.ARRAY_BUFFER,oa[Ha],C)}}if(hb&&Na>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,C)}if(Za){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ta,C)}if(db&&ga.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ga,C)}if(Ya&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,jb,C)}if(Ya&&eb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,
eb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ca,C)}if(La){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,C)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ka,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,wa,C);d.bindBuffer(d.ARRAY_BUFFER, Ca,C)}if(La){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,C)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ka,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,wa,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,L,C);d.bindBuffer(d.ARRAY_BUFFER,
o.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,L,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,aa,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors; o.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,aa,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+
if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW; 1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;
Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors= Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||
!1}else if(j instanceof THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||j.sortParticles)&&c(w,d.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(j){function t(ja){var pa=[];w=0;for(o=ja.length;w<o;w++)ja[w]==undefined?pa.push("undefined"):pa.push(ja[w].id);return pa.join("_")}var w,o,C,G,J,E,A,V,K={},T=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};C=0;for(G=j.faces.length;C<G;C++){J=j.faces[C];E=J.materials;A=t(E);K[A]==undefined&& j.sortParticles)&&c(w,d.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(j){function t(ja){var pa=[];w=0;for(o=ja.length;w<o;w++)ja[w]==undefined?pa.push("undefined"):pa.push(ja[w].id);return pa.join("_")}var w,o,C,G,J,E,A,V,K={},T=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};C=0;for(G=j.faces.length;C<G;C++){J=j.faces[C];E=J.materials;A=t(E);K[A]==undefined&&(K[A]={hash:A,counter:0});V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]=
(K[A]={hash:A,counter:0});V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T});J=J instanceof THREE.Face3?3:4;if(j.geometryGroups[V].vertices+J>65535){K[A].counter+=1;V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T})}j.geometryGroups[V].faces.push(C);j.geometryGroups[V].vertices+=J}}function F(j,t,w){j.push({buffer:t,object:w,opaque:{list:[], {faces:[],materials:E,vertices:0,numMorphTargets:T});J=J instanceof THREE.Face3?3:4;if(j.geometryGroups[V].vertices+J>65535){K[A].counter+=1;V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T})}j.geometryGroups[V].faces.push(C);j.geometryGroups[V].vertices+=J}}function F(j,t,w){j.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(j){if(j!=za){switch(j){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);
count:0},transparent:{list:[],count:0}})}function M(j){if(j!=za){switch(j){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE)}za=j}}function D(j, d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=j}}function D(j,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(j,d.TEXTURE_WRAP_S,ka(t.wrapS));
t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(j,d.TEXTURE_WRAP_S,ka(t.wrapS));d.texParameteri(j,d.TEXTURE_WRAP_T,ka(t.wrapT));d.texParameteri(j,d.TEXTURE_MAG_FILTER,ka(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,ka(t.minFilter));d.generateMipmap(j)}else{d.texParameteri(j,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_MAG_FILTER,P(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,P(t.minFilter))}} d.texParameteri(j,d.TEXTURE_WRAP_T,ka(t.wrapT));d.texParameteri(j,d.TEXTURE_MAG_FILTER,ka(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,ka(t.minFilter));d.generateMipmap(j)}else{d.texParameteri(j,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_MAG_FILTER,P(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,P(t.minFilter))}}function Q(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=d.createFramebuffer();j.__webGLRenderbuffer=
function Q(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=d.createFramebuffer();j.__webGLRenderbuffer=d.createRenderbuffer();j.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,j.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,j.width,j.height);d.bindTexture(d.TEXTURE_2D,j.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ka(j.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ka(j.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER, d.createRenderbuffer();j.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,j.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,j.width,j.height);d.bindTexture(d.TEXTURE_2D,j.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ka(j.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ka(j.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,ka(j.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ka(j.minFilter));d.texImage2D(d.TEXTURE_2D,
ka(j.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ka(j.minFilter));d.texImage2D(d.TEXTURE_2D,0,ka(j.format),j.width,j.height,0,ka(j.format),ka(j.type),null);d.bindFramebuffer(d.FRAMEBUFFER,j.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,j.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,j.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER, 0,ka(j.format),j.width,j.height,0,ka(j.format),ka(j.type),null);d.bindFramebuffer(d.FRAMEBUFFER,j.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,j.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,j.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=Z;j=S}if(t!=da){d.bindFramebuffer(d.FRAMEBUFFER,
null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=Z;j=S}if(t!=da){d.bindFramebuffer(d.FRAMEBUFFER,t);d.viewport(W,ia,w,j);da=t}}function R(j,t){var w;if(j=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else j=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function P(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST; t);d.viewport(W,ia,w,j);da=t}}function R(j,t){var w;if(j=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else j=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function P(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ka(j){switch(j){case THREE.RepeatWrapping:return d.REPEAT;
default:return d.LINEAR}}function ka(j){switch(j){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR; case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;
case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0} case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var $=document.createElement("canvas"),
var $=document.createElement("canvas"),d,X=null,da=null,Y=this,ua=null,va=null,za=null,ma=null,W=0,ia=0,Z=0,S=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,ra=new Float32Array(16),na=new Float32Array(16),qa=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Da=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Da=a.antialias; d,X=null,da=null,Y=this,ua=null,va=null,za=null,ma=null,W=0,ia=0,Z=0,S=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,ra=new Float32Array(16),na=new Float32Array(16),qa=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Da=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Da=a.antialias;a.clearColor!==undefined&&$a.setHex(a.clearColor);
a.clearColor!==undefined&&$a.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(d=$.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD); if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(d=$.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(t.r,t.g,t.b,w)})(Da,$a,ab);this.context=d;var Ia={};a=[];Da=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Da[0]=0;Da[1]=1;Da[2]=2;Da[3]=0;Da[4]=2;Da[5]=3;Ia.vertexBuffer=d.createBuffer();Ia.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER, d.clearColor(t.r,t.g,t.b,w)})(Da,$a,ab);this.context=d;var Ia={};a=[];Da=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Da[0]=0;Da[1]=1;Da[2]=2;Da[3]=0;Da[4]=2;Da[5]=3;Ia.vertexBuffer=d.createBuffer();Ia.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,new Uint16Array(Da),
new Uint16Array(Da),d.STATIC_DRAW);Ia.program=d.createProgram();d.attachShader(Ia.program,R("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ia.program,R("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ia.program);Ia.vertexLocation=d.getAttribLocation(Ia.program,"position");Ia.projectionLocation=d.getUniformLocation(Ia.program,"projectionMatrix");this.setSize=function(j,t){$.width=j;$.height=t;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(j, d.STATIC_DRAW);Ia.program=d.createProgram();d.attachShader(Ia.program,R("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ia.program,R("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ia.program);Ia.vertexLocation=d.getAttribLocation(Ia.program,"position");Ia.projectionLocation=d.getUniformLocation(Ia.program,"projectionMatrix");this.setSize=function(j,t){$.width=j;$.height=t;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(j,t,w,o){W=j;ia=t;Z=
t,w,o){W=j;ia=t;Z=w;S=o;d.viewport(W,ia,Z,S)};this.setScissor=function(j,t,w,o){d.scissor(j,t,w,o)};this.enableScissorTest=function(j){j?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){d.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){d.clearColor(j.r,j.g,j.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial= w;S=o;d.viewport(W,ia,Z,S)};this.setScissor=function(j,t,w,o){d.scissor(j,t,w,o)};this.enableScissorTest=function(j){j?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){d.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){d.clearColor(j.r,j.g,j.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial=function(j,t,
function(j,t,w,o){var C,G,J,E;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof w,o){var C,G,J,E;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof THREE.LineBasicMaterial)b(j,
THREE.LineBasicMaterial)b(j,THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var A,V,K;A=K=E=0;for(J=t.length;A<J;A++){V=t[A];V instanceof THREE.DirectionalLight&&K++;V instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)t=o.bones.length;J={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors, THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var A,V,K;A=K=E=0;for(J=t.length;A<J;A++){V=t[A];V instanceof THREE.DirectionalLight&&K++;V instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)t=o.bones.length;J={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,sizeAttenuation:j.sizeAttenuation,
sizeAttenuation:j.sizeAttenuation,skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=d.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,J.fog?"#define USE_FOG":"",J.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP": skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=d.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,J.fog?"#define USE_FOG":"",J.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":
"",J.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");J=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,"#define MAX_BONES "+J.maxBones,J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":"",J.skinning?"#define USE_SKINNING":"",J.morphTargets?"#define USE_MORPHTARGETS": "","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");J=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,"#define MAX_BONES "+J.maxBones,J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":"",J.skinning?"#define USE_SKINNING":"",J.morphTargets?"#define USE_MORPHTARGETS":"",J.sizeAttenuation?
"",J.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); "#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
d.attachShader(t,R("fragment",A+w));d.attachShader(t,R("vertex",J+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in j.uniforms)w.push(C); d.attachShader(t,R("fragment",A+w));d.attachShader(t,R("vertex",J+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in j.uniforms)w.push(C);
C=j.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=d.getUniformLocation(C,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)w.push("morphTarget"+C);for(G in j.attributes)w.push(G);G=j.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];G.attributes[t]=d.getAttribLocation(G,t)}G=j.program.attributes;d.enableVertexAttribArray(G.position);G.color>=0&&d.enableVertexAttribArray(G.color);G.normal>=0&&d.enableVertexAttribArray(G.normal); C=j.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=d.getUniformLocation(C,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)w.push("morphTarget"+C);for(G in j.attributes)w.push(G);G=j.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];G.attributes[t]=d.getAttribLocation(G,t)}G=j.program.attributes;d.enableVertexAttribArray(G.position);G.color>=0&&d.enableVertexAttribArray(G.color);G.normal>=0&&d.enableVertexAttribArray(G.normal);
G.tangent>=0&&d.enableVertexAttribArray(G.tangent);if(j.skinning&&G.skinVertexA>=0&&G.skinVertexB>=0&&G.skinIndex>=0&&G.skinWeight>=0){d.enableVertexAttribArray(G.skinVertexA);d.enableVertexAttribArray(G.skinVertexB);d.enableVertexAttribArray(G.skinIndex);d.enableVertexAttribArray(G.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(G.morphTarget0>=0){d.enableVertexAttribArray(G.morphTarget0);j.numSupportedMorphTargets++}if(G.morphTarget1>=0){d.enableVertexAttribArray(G.morphTarget1); G.tangent>=0&&d.enableVertexAttribArray(G.tangent);if(j.skinning&&G.skinVertexA>=0&&G.skinVertexB>=0&&G.skinIndex>=0&&G.skinWeight>=0){d.enableVertexAttribArray(G.skinVertexA);d.enableVertexAttribArray(G.skinVertexB);d.enableVertexAttribArray(G.skinIndex);d.enableVertexAttribArray(G.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(G.morphTarget0>=0){d.enableVertexAttribArray(G.morphTarget0);j.numSupportedMorphTargets++}if(G.morphTarget1>=0){d.enableVertexAttribArray(G.morphTarget1);
......
...@@ -187,20 +187,20 @@ color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q. ...@@ -187,20 +187,20 @@ color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q.
p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value= p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=
n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]= n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]=
L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions; L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions;
r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value= r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r,j.color.g,j.color.b);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=j.envMap&&j.envMap.mapping instanceof
j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r, THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);
j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u== r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u=="v2")b.uniform2f(G,n.x,
"v2")b.uniform2f(G,n.x,n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP, n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);
k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture= for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=b.createTexture();
b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial|| b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.envMap)&&b.uniform3f(v.cameraPosition,
j.envMap)&&b.uniform3f(v.cameraPosition,e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]= e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]=-p.position.z;b.uniform3fv(v.directionalLightDirection,
-p.position.z;b.uniform3fv(v.directionalLightDirection,e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER, e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,
q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]= 3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&
!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer); r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=
b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER, 0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,
q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex, 2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);
4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip? b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?b.LINE_STRIP:
b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray, b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa= b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa=
e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31, e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31,
e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e]; e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e];
...@@ -226,9 +226,9 @@ THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_ ...@@ -226,9 +226,9 @@ THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_
v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r= v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r=
v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p, v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p,
n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA, n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,
b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,E(p.magFilter)); b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,
b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T, E(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,
fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D, b.TEXTURE_WRAP_T,fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p); null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p);
return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR; return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA; case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
......
...@@ -1528,12 +1528,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -1528,12 +1528,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsCommon( uniforms, material ) { function refreshUniformsCommon( uniforms, material ) {
// premultiply alpha uniforms.diffuse.value.setRGB( material.color.r, material.color.g, material.color.b );
uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
// pure color
//uniforms.color.value.setHex( material.color.hex );
uniforms.opacity.value = material.opacity; uniforms.opacity.value = material.opacity;
uniforms.map.texture = material.map; uniforms.map.texture = material.map;
...@@ -3343,7 +3338,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -3343,7 +3338,7 @@ THREE.WebGLRenderer = function ( parameters ) {
default: default:
_gl.blendEquationSeparate( _gl.FUNC_ADD, _gl.FUNC_ADD ); _gl.blendEquationSeparate( _gl.FUNC_ADD, _gl.FUNC_ADD );
_gl.blendFuncSeparate( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE ); _gl.blendFuncSeparate( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册