Browse Source

Commented out "gl.finish", it was eating a lot of performance.

alteredq 14 years ago
parent
commit
993483763b
3 changed files with 27 additions and 27 deletions
  1. 13 13
      build/Three.js
  2. 13 13
      build/custom/ThreeWebGL.js
  3. 1 1
      src/renderers/WebGLRenderer.js

+ 13 - 13
build/Three.js

@@ -317,19 +317,19 @@ b.numSupportedMorphTargets++);p.morphTarget6>=0&&(g.enableVertexAttribArray(p.mo
 c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(W);c.projectionMatrix.flattenToArray(P);R.multiply(c.projectionMatrix,c.matrixWorldInverse);k(R);this.initWebGLObjects(b);S(n);(this.autoClear||y)&&this.clear();F=b.__webglObjects.length;for(y=0;y<F;y++)if(x=b.__webglObjects[y],G=x.object,G.visible)if(!(G instanceof THREE.Mesh)||m(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),E(G,c),p(x),x.render=!0,this.sortObjects)X.copy(G.position),R.multiplyVector3(X),x.z=
 X.z}else x.render=!1;else x.render=!1;this.sortObjects&&b.__webglObjects.sort(t);ha=b.__webglObjectsImmediate.length;for(y=0;y<ha;y++)x=b.__webglObjectsImmediate[y],G=x.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),E(G,c),o(x));I(THREE.NormalBlending);for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;A=x.opaque;h(G);for(x=0;x<A.count;x++)D=A.list[x],j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ha;y++)if(x=b.__webglObjectsImmediate[y],
 G=x.object,G.visible){A=x.opaque;h(G);for(x=0;x<A.count;x++)D=A.list[x],j(D.depthTest),z=d(c,K,M,D,G),G.render(function(b){f(b,z,D.shading)})}for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;A=x.transparent;h(G);for(x=0;x<A.count;x++)D=A.list[x],I(D.blending),j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ha;y++)if(x=b.__webglObjectsImmediate[y],G=x.object,G.visible){A=x.transparent;h(G);for(x=0;x<A.count;x++)D=A.list[x],I(D.blending),j(D.depthTest),z=d(c,K,M,D,G),G.render(function(b){f(b,
-z,D.shading)})}b.__webglSprites.length&&v(b,c);J&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&C(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(g.bindTexture(g.TEXTURE_2D,n.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null));g.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=
-[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],c=b,e=void 0,f=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(e in f=d.geometry,f.geometryGroups==void 0&&D(f),f.geometryGroups){h=f.geometryGroups[e];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=
-g.createBuffer();j.__webglNormalBuffer=g.createBuffer();j.__webglTangentBuffer=g.createBuffer();j.__webglColorBuffer=g.createBuffer();j.__webglUVBuffer=g.createBuffer();j.__webglUV2Buffer=g.createBuffer();j.__webglSkinVertexABuffer=g.createBuffer();j.__webglSkinVertexBBuffer=g.createBuffer();j.__webglSkinIndicesBuffer=g.createBuffer();j.__webglSkinWeightsBuffer=g.createBuffer();j.__webglFaceBuffer=g.createBuffer();j.__webglLineBuffer=g.createBuffer();if(j.numMorphTargets){var k=void 0,m=void 0;j.__webglMorphTargetsBuffers=
-[];k=0;for(m=j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(g.createBuffer())}for(var j=h,k=d,o=void 0,p=void 0,n=void 0,t=n=void 0,u=void 0,v=void 0,J=v=m=0,A=n=p=void 0,p=o=void 0,t=k.geometry,A=t.faces,u=j.faces,o=0,p=u.length;o<p;o++)n=u[o],n=A[n],n instanceof THREE.Face3?(m+=3,v+=1,J+=3):n instanceof THREE.Face4&&(m+=4,v+=2,J+=4);for(var o=j,p=k,z=u=A=void 0,E=void 0,z=void 0,n=[],A=0,u=p.materials.length;A<u;A++)if(z=p.materials[A],z instanceof THREE.MeshFaceMaterial){z=0;for(l=
-o.materials.length;z<l;z++)(E=o.materials[z])&&n.push(E)}else(E=z)&&n.push(E);o=n;a:{A=p=void 0;u=o.length;for(p=0;p<u;p++)if(A=o[p],A.map||A.lightMap||A instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{A=o;n=u=void 0;z=A.length;for(u=0;u<z;u++)if(n=A[u],!(n instanceof THREE.MeshBasicMaterial&&!n.envMap||n instanceof THREE.MeshDepthMaterial)){A=n&&n.shading!=void 0&&n.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{n=u=void 0;z=o.length;for(u=0;u<z;u++)if(n=
-o[u],n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(m*3);if(A)j.__normalArray=new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(n)j.__colorArray=new Float32Array(m*3);if(p){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*
-4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(J*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=A==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=A;j.__webglFaceCount=
-v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=J*2;t=0;for(u=o.length;t<u;t++)if(o[t].attributes)for(a in j.__webglCustomAttributes={},o[t].attributes){p={};for(prop in o[t].attributes[a])p[prop]=o[t].attributes[a][prop];if(!p.__webglInitialized||p.createUniqueBuffers)p.__webglInitialized=!0,v=1,p.type==="v2"?v=2:p.type==="v3"?v=3:p.type==="v4"?v=4:p.type==="c"&&(v=3),p.size=v,p.needsUpdate=!0,p.array=new Float32Array(m*v),p.buffer=g.createBuffer(),p.buffer.belongsToAttribute=
-a;j.__webglCustomAttributes[a]=p}j.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=!0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}d instanceof THREE.ShadowVolume?x(c.__webglShadowVolumes,h,d):x(c.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)x(c.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),
-e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglVertexCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else if(d instanceof THREE.Line){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglLineCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,
-f,d)}else if(d instanceof THREE.ParticleSystem){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__sortArray=[],e.__webglParticleCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},
-transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&c.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];c=b;e=f=void 0;if(d instanceof THREE.Mesh)for(f=c.__webglObjects.length-1;f>=0;f--){if(e=c.__webglObjects[f].object,d==e){c.__webglObjects.splice(f,1);break}}else if(d instanceof THREE.Sprite)for(f=c.__webglSprites.length-1;f>=0;f--)if(e=c.__webglSprites[f],d==e){c.__webglSprites.splice(f,1);break}b.__objectsRemoved.splice(0,1)}d=
-0;for(c=b.__webglObjects.length;d<c;d++)y(b.__webglObjects[d].object,b);d=0;for(c=b.__webglShadowVolumes.length;d<c;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(c=b.__webglLensFlares.length;d<c;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW),b=="back"?g.cullFace(g.BACK):b=="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.supportsVertexTextures=function(){return va}};
+z,D.shading)})}b.__webglSprites.length&&v(b,c);J&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&C(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(g.bindTexture(g.TEXTURE_2D,n.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
+b.__objectsAdded[0],c=b,e=void 0,f=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(e in f=d.geometry,f.geometryGroups==void 0&&D(f),f.geometryGroups){h=f.geometryGroups[e];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=g.createBuffer();j.__webglNormalBuffer=
+g.createBuffer();j.__webglTangentBuffer=g.createBuffer();j.__webglColorBuffer=g.createBuffer();j.__webglUVBuffer=g.createBuffer();j.__webglUV2Buffer=g.createBuffer();j.__webglSkinVertexABuffer=g.createBuffer();j.__webglSkinVertexBBuffer=g.createBuffer();j.__webglSkinIndicesBuffer=g.createBuffer();j.__webglSkinWeightsBuffer=g.createBuffer();j.__webglFaceBuffer=g.createBuffer();j.__webglLineBuffer=g.createBuffer();if(j.numMorphTargets){var k=void 0,m=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(m=
+j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(g.createBuffer())}for(var j=h,k=d,o=void 0,p=void 0,n=void 0,t=n=void 0,u=void 0,v=void 0,J=v=m=0,A=n=p=void 0,p=o=void 0,t=k.geometry,A=t.faces,u=j.faces,o=0,p=u.length;o<p;o++)n=u[o],n=A[n],n instanceof THREE.Face3?(m+=3,v+=1,J+=3):n instanceof THREE.Face4&&(m+=4,v+=2,J+=4);for(var o=j,p=k,z=u=A=void 0,E=void 0,z=void 0,n=[],A=0,u=p.materials.length;A<u;A++)if(z=p.materials[A],z instanceof THREE.MeshFaceMaterial){z=0;for(l=o.materials.length;z<
+l;z++)(E=o.materials[z])&&n.push(E)}else(E=z)&&n.push(E);o=n;a:{A=p=void 0;u=o.length;for(p=0;p<u;p++)if(A=o[p],A.map||A.lightMap||A instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{A=o;n=u=void 0;z=A.length;for(u=0;u<z;u++)if(n=A[u],!(n instanceof THREE.MeshBasicMaterial&&!n.envMap||n instanceof THREE.MeshDepthMaterial)){A=n&&n.shading!=void 0&&n.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{n=u=void 0;z=o.length;for(u=0;u<z;u++)if(n=o[u],n.vertexColors){n=
+n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(m*3);if(A)j.__normalArray=new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(n)j.__colorArray=new Float32Array(m*3);if(p){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=
+new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(J*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=A==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=A;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?
+k.geometry.edgeFaces.length*6:0);j.__webglLineCount=J*2;t=0;for(u=o.length;t<u;t++)if(o[t].attributes)for(a in j.__webglCustomAttributes={},o[t].attributes){p={};for(prop in o[t].attributes[a])p[prop]=o[t].attributes[a][prop];if(!p.__webglInitialized||p.createUniqueBuffers)p.__webglInitialized=!0,v=1,p.type==="v2"?v=2:p.type==="v3"?v=3:p.type==="v4"?v=4:p.type==="c"&&(v=3),p.size=v,p.needsUpdate=!0,p.array=new Float32Array(m*v),p.buffer=g.createBuffer(),p.buffer.belongsToAttribute=a;j.__webglCustomAttributes[a]=
+p}j.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=!0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}d instanceof THREE.ShadowVolume?x(c.__webglShadowVolumes,h,d):x(c.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)x(c.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=
+new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglVertexCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else if(d instanceof THREE.Line){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglLineCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else if(d instanceof
+THREE.ParticleSystem){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__sortArray=[],e.__webglParticleCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],
+count:0}}):d instanceof THREE.Sprite&&c.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];c=b;e=f=void 0;if(d instanceof THREE.Mesh)for(f=c.__webglObjects.length-1;f>=0;f--){if(e=c.__webglObjects[f].object,d==e){c.__webglObjects.splice(f,1);break}}else if(d instanceof THREE.Sprite)for(f=c.__webglSprites.length-1;f>=0;f--)if(e=c.__webglSprites[f],d==e){c.__webglSprites.splice(f,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(c=b.__webglObjects.length;d<
+c;d++)y(b.__webglObjects[d].object,b);d=0;for(c=b.__webglShadowVolumes.length;d<c;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(c=b.__webglLensFlares.length;d<c;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW),b=="back"?g.cullFace(g.BACK):b=="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.supportsVertexTextures=function(){return va}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(void 0,!1,c);var d=b.sounds,e,f=d.length;for(e=0;e<f;e++)b=d[e],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};

+ 13 - 13
build/custom/ThreeWebGL.js

@@ -278,18 +278,18 @@ b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.mo
 d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(k);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],o=t.object,o.visible)if(!(o instanceof THREE.Mesh)||p(o)){if(o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),v(t),t.render=!0,this.sortObjects)qa.copy(o.position),P.multiplyVector3(qa),
 t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(r);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],o=t.object,o.visible&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],
 o=t.object,o.visible){x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),y=e(d,H,J,B,o),o.render(function(b){h(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),y=e(d,H,J,B,o),o.render(function(b){h(b,
-y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,k.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null));c.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=
-[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=
-c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=
-[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,z=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=
-n.materials.length;x<l;x++)(z=n.materials[x])&&p.push(z)}else(z=x)&&p.push(z);n=p;a:{u=o=void 0;r=n.length;for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=
-n[r],p.vertexColors){p=p.vertexColors;break a}p=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*
-4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=
-t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=
-a;i.__webglCustomAttributes[a]=o}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?Q(e.__webglShadowVolumes,h,d):Q(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)Q(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),
-f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,
-g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},
-transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;f=g=void 0;if(d instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,d==f){e.__webglObjects.splice(g,1);break}}else if(d instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],d==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}d=
-0;for(e=b.__webglObjects.length;d<e;d++)y(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
+y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,k.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
+b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=
+c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=
+i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,z=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<
+l;x++)(z=n.materials[x])&&p.push(z)}else(z=x)&&p.push(z);n=p;a:{u=o=void 0;r=n.length;for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=n[r],p.vertexColors){p=
+p.vertexColors;break a}p=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=
+new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?
+j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=a;i.__webglCustomAttributes[a]=
+o}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?Q(e.__webglShadowVolumes,h,d):Q(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)Q(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=
+new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof
+THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],
+count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;f=g=void 0;if(d instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,d==f){e.__webglObjects.splice(g,1);break}}else if(d instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],d==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<
+e;d++)y(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -3331,7 +3331,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		_gl.finish();
+		//_gl.finish();
 
 	};