瀏覽代碼

Updated builds.

Mr.doob 5 年之前
父節點
當前提交
2288ef1757
共有 3 個文件被更改,包括 24 次插入8 次删除
  1. 11 3
      build/three.js
  2. 2 2
      build/three.min.js
  3. 11 3
      build/three.module.js

+ 11 - 3
build/three.js

@@ -21929,6 +21929,10 @@
 
 						glInternalFormat = 33190;
 
+					} else if ( texture.type === UnsignedInt248Type ) {
+
+						glInternalFormat = 35056;
+
 					} else {
 
 						glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D
@@ -21945,6 +21949,8 @@
 
 				}
 
+				// validation checks for WebGL 1
+
 				if ( texture.format === DepthFormat && glInternalFormat === 6402 ) {
 
 					// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
@@ -21961,10 +21967,10 @@
 
 				}
 
-				// Depth stencil textures need the DEPTH_STENCIL internal format
-				// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
-				if ( texture.format === DepthStencilFormat ) {
+				if ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) {
 
+					// Depth stencil textures need the DEPTH_STENCIL internal format
+					// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
 					glInternalFormat = 34041;
 
 					// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
@@ -21981,6 +21987,8 @@
 
 				}
 
+				//
+
 				state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
 
 			} else if ( texture.isDataTexture ) {

+ 2 - 2
build/three.min.js

@@ -140,8 +140,8 @@ z.height,0,n,w,z.data)}}g.__maxMipLevel=Z.length-1}else{Z=b.mipmaps;for(q=0;6>q;
 e),c.bindTexture(34067,g.__webglTexture)}}function z(a,b){c.activeTexture(33984+b);c.bindTexture(34067,d.get(a).__webglTexture)}function t(c,f,g){g?(a.texParameteri(c,10242,N[f.wrapS]),a.texParameteri(c,10243,N[f.wrapT]),32879!==c&&35866!==c||a.texParameteri(c,32882,N[f.wrapR]),a.texParameteri(c,10240,fa[f.magFilter]),a.texParameteri(c,10241,fa[f.minFilter])):(a.texParameteri(c,10242,33071),a.texParameteri(c,10243,33071),32879!==c&&35866!==c||a.texParameteri(c,32882,33071),1001===f.wrapS&&1001===
 f.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),a.texParameteri(c,10240,r(f.magFilter)),a.texParameteri(c,10241,r(f.minFilter)),1003!==f.minFilter&&1006!==f.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));!(g=b.get("EXT_texture_filter_anisotropic"))||1015===f.type&&null===b.get("OES_texture_float_linear")||
 1016===f.type&&null===(Ca||b.get("OES_texture_half_float_linear"))||!(1<f.anisotropy||d.get(f).__currentAnisotropy)||(a.texParameterf(c,g.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,e.getMaxAnisotropy())),d.get(f).__currentAnisotropy=f.anisotropy)}function U(b,c){void 0===b.__webglInit&&(b.__webglInit=!0,c.addEventListener("dispose",q),b.__webglTexture=a.createTexture(),g.memory.textures++)}function ca(b,d,e){var g=3553;d.isDataTexture2DArray&&(g=35866);d.isDataTexture3D&&(g=32879);U(b,d);c.activeTexture(33984+
-e);c.bindTexture(g,b.__webglTexture);a.pixelStorei(37440,d.flipY);a.pixelStorei(37441,d.premultiplyAlpha);a.pixelStorei(3317,d.unpackAlignment);e=Ca?!1:1001!==d.wrapS||1001!==d.wrapT||1003!==d.minFilter&&1006!==d.minFilter;e=e&&!1===m(d.image);e=l(d.image,e,!1,F);var h=m(e)||Ca,u=f.convert(d.format),q=f.convert(d.type),r=x(d.internalFormat,u,q);t(g,d,h);var v=d.mipmaps;if(d.isDepthTexture)r=6402,Ca?r=1015===d.type?36012:1014===d.type?33190:33189:1015===d.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),
-1026===d.format&&6402===r&&1012!==d.type&&1014!==d.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),d.type=1012,q=f.convert(d.type)),1027===d.format&&(r=34041,1020!==d.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),d.type=1020,q=f.convert(d.type))),c.texImage2D(3553,0,r,e.width,e.height,0,u,q,null);else if(d.isDataTexture)if(0<v.length&&h){for(var n=0,w=v.length;n<w;n++){var E=
+e);c.bindTexture(g,b.__webglTexture);a.pixelStorei(37440,d.flipY);a.pixelStorei(37441,d.premultiplyAlpha);a.pixelStorei(3317,d.unpackAlignment);e=Ca?!1:1001!==d.wrapS||1001!==d.wrapT||1003!==d.minFilter&&1006!==d.minFilter;e=e&&!1===m(d.image);e=l(d.image,e,!1,F);var h=m(e)||Ca,u=f.convert(d.format),q=f.convert(d.type),r=x(d.internalFormat,u,q);t(g,d,h);var v=d.mipmaps;if(d.isDepthTexture)r=6402,Ca?r=1015===d.type?36012:1014===d.type?33190:1020===d.type?35056:33189:1015===d.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),
+1026===d.format&&6402===r&&1012!==d.type&&1014!==d.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),d.type=1012,q=f.convert(d.type)),1027===d.format&&6402===r&&(r=34041,1020!==d.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),d.type=1020,q=f.convert(d.type))),c.texImage2D(3553,0,r,e.width,e.height,0,u,q,null);else if(d.isDataTexture)if(0<v.length&&h){for(var n=0,w=v.length;n<w;n++){var E=
 v[n];c.texImage2D(3553,n,r,E.width,E.height,0,u,q,E.data)}d.generateMipmaps=!1;b.__maxMipLevel=v.length-1}else c.texImage2D(3553,0,r,e.width,e.height,0,u,q,e.data),b.__maxMipLevel=0;else if(d.isCompressedTexture){n=0;for(w=v.length;n<w;n++)E=v[n],1023!==d.format&&1022!==d.format?null!==u?c.compressedTexImage2D(3553,n,r,E.width,E.height,0,E.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):c.texImage2D(3553,n,r,E.width,E.height,0,u,
 q,E.data);b.__maxMipLevel=v.length-1}else if(d.isDataTexture2DArray)c.texImage3D(35866,0,r,e.width,e.height,e.depth,0,u,q,e.data),b.__maxMipLevel=0;else if(d.isDataTexture3D)c.texImage3D(32879,0,r,e.width,e.height,e.depth,0,u,q,e.data),b.__maxMipLevel=0;else if(0<v.length&&h){n=0;for(w=v.length;n<w;n++)E=v[n],c.texImage2D(3553,n,r,u,q,E);d.generateMipmaps=!1;b.__maxMipLevel=v.length-1}else c.texImage2D(3553,0,r,u,q,e),b.__maxMipLevel=0;k(d,h)&&p(g,d,e.width,e.height);b.__version=d.version;if(d.onUpdate)d.onUpdate(d)}
 function B(b,e,g,h){var l=f.convert(e.texture.format),m=f.convert(e.texture.type),p=x(e.texture.internalFormat,l,m);c.texImage2D(h,0,p,e.width,e.height,0,l,m,null);a.bindFramebuffer(36160,b);a.framebufferTexture2D(36160,g,h,d.get(e.texture).__webglTexture,0);a.bindFramebuffer(36160,null)}function y(b,c,d){a.bindRenderbuffer(36161,b);if(c.depthBuffer&&!c.stencilBuffer){var e=33189;d?((d=c.depthTexture)&&d.isDepthTexture&&(1015===d.type?e=36012:1014===d.type&&(e=33190)),d=ia(c),a.renderbufferStorageMultisample(36161,

+ 11 - 3
build/three.module.js

@@ -21921,6 +21921,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 					glInternalFormat = 33190;
 
+				} else if ( texture.type === UnsignedInt248Type ) {
+
+					glInternalFormat = 35056;
+
 				} else {
 
 					glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D
@@ -21937,6 +21941,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			}
 
+			// validation checks for WebGL 1
+
 			if ( texture.format === DepthFormat && glInternalFormat === 6402 ) {
 
 				// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
@@ -21953,10 +21959,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			}
 
-			// Depth stencil textures need the DEPTH_STENCIL internal format
-			// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
-			if ( texture.format === DepthStencilFormat ) {
+			if ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) {
 
+				// Depth stencil textures need the DEPTH_STENCIL internal format
+				// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
 				glInternalFormat = 34041;
 
 				// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
@@ -21973,6 +21979,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			}
 
+			//
+
 			state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
 
 		} else if ( texture.isDataTexture ) {