diff --git a/build/Three.js b/build/Three.js index e0ba5980..71745d3b 100644 --- a/build/Three.js +++ b/build/Three.js @@ -255,7 +255,7 @@ h.length;b65535&&(t[m].counter+=1,n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function J(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[], count:0}})}function C(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}fa=b}}function B(b,c,e){(e.width& e.width-1)==0&&(e.height&e.height-1)==0?(m.texParameteri(b,m.TEXTURE_WRAP_S,K(c.wrapS)),m.texParameteri(b,m.TEXTURE_WRAP_T,K(c.wrapT)),m.texParameteri(b,m.TEXTURE_MAG_FILTER,K(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,K(c.minFilter)),m.generateMipmap(b)):(m.texParameteri(b,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_MAG_FILTER,S(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,S(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture= -m.createTexture(),b.__webglInit=!0;m.bindTexture(m.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),m.UNSIGNED_BYTE,b.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,b.image);B(m.TEXTURE_2D,b,b.image);m.bindTexture(m.TEXTURE_2D,null);b.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,b.__webglTexture)}function E(b){var c=b instanceof THREE.WebGLRenderTargetCube; +m.createTexture(),b.__webglInit=!0;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),m.UNSIGNED_BYTE,b.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,b.image);B(m.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,b.__webglTexture)}function E(b){var c=b instanceof THREE.WebGLRenderTargetCube; if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=m.createRenderbuffer();b.__webglTexture=m.createTexture();if(c){m.bindTexture(m.TEXTURE_CUBE_MAP,b.__webglTexture);B(m.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=m.createFramebuffer(),m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null)}else b.__webglFramebuffer= m.createFramebuffer(),m.bindTexture(m.TEXTURE_2D,b.__webglTexture),B(m.TEXTURE_2D,b,b),m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);m.bindRenderbuffer(m.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)m.bindFramebuffer(m.FRAMEBUFFER,b.__webglFramebuffer[e]),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else m.bindFramebuffer(m.FRAMEBUFFER,b.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0,m.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,b.__webglRenderbuffer)):m.renderbufferStorage(m.RENDERBUFFER, diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 416bcb0c..d0d76696 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -212,8 +212,8 @@ return!1}function ya(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b65535&&(r[k].counter+=1,m=r[k].hash+"_"+r[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:D})),b.geometryGroups[m].faces.push(e),b.geometryGroups[m].vertices+=h}function U(b,c,d){b.push({buffer:c, object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function t(b){if(b!=V){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA, f.ONE,f.ONE_MINUS_SRC_ALPHA)}V=b}}function Y(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,S(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,S(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,qa(c.magFilter)),f.texParameteri(b, -f.TEXTURE_MIN_FILTER,qa(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=f.createTexture(),b.__webglInit=!0;f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);Y(f.TEXTURE_2D,b,b.image);f.bindTexture(f.TEXTURE_2D,null);b.needsUpdate=!1}f.activeTexture(f.TEXTURE0+ -c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function P(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);Y(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+ +f.TEXTURE_MIN_FILTER,qa(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=f.createTexture(),b.__webglInit=!0;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);Y(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+ +c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function P(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);Y(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+ d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),Y(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture, 0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER, f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height):(c=null,d=Fa,b=xa);c!=va&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(Aa,Ia,d,b),va=c)}function Q(b){b instanceof THREE.WebGLRenderTargetCube? diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 1aa9d219..5f62abf2 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -4893,6 +4893,7 @@ THREE.WebGLRenderer = function ( parameters ) { } + _gl.activeTexture( _gl.TEXTURE0 + slot ); _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); if ( texture instanceof THREE.DataTexture) { @@ -4907,42 +4908,14 @@ THREE.WebGLRenderer = function ( parameters ) { setTextureParameters( _gl.TEXTURE_2D, texture, texture.image ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); - texture.needsUpdate = false; - } + } else { - /* - if ( texture.needsUpdate ) { - - if ( !texture.__webglInit ) { - - texture.__webglTexture = _gl.createTexture(); - - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - _gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image ); - - texture.__webglInit = true; - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - _gl.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image ); - - } - - setTextureParameters( _gl.TEXTURE_2D, texture, texture.image ); - - _gl.bindTexture( _gl.TEXTURE_2D, null ); - - texture.needsUpdate = false; + _gl.activeTexture( _gl.TEXTURE0 + slot ); + _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); } - */ - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); };