Mr.doob 7 лет назад
Родитель
Сommit
53adbf47b1
3 измененных файлов с 109 добавлено и 383 удалено
  1. 8 9
      build/three.js
  2. 93 365
      build/three.min.js
  3. 8 9
      build/three.module.js

+ 8 - 9
build/three.js

@@ -19665,14 +19665,12 @@
 
 		}
 
-		function generateMipmap( texture, target ) {
+		function generateMipmap( target, texture, width, height ) {
 
 			_gl.generateMipmap( target );
 
-			// We assume images for cube map have the same size.
-			var image = Array.isArray( texture.image ) ? texture.image[ 0 ] : texture.image;
 			var textureProperties = properties.get( texture );
-			textureProperties.__maxMipLevel = Math.log2( Math.max( image.width, image.height ) );
+			textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) );
 
 		}
 
@@ -19932,7 +19930,8 @@
 
 					if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
 
-						generateMipmap( texture, _gl.TEXTURE_CUBE_MAP );
+						// We assume images for cube map have the same size.
+						generateMipmap( _gl.TEXTURE_CUBE_MAP, texture, image.width, image.height );
 
 					}
 
@@ -20187,7 +20186,7 @@
 
 			if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
 
-				generateMipmap( texture, _gl.TEXTURE_2D );
+				generateMipmap( _gl.TEXTURE_2D, texture, image.width, image.height );
 
 			}
 
@@ -20371,7 +20370,7 @@
 
 				if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
 
-					generateMipmap( renderTarget.texture,  _gl.TEXTURE_CUBE_MAP );
+					generateMipmap( _gl.TEXTURE_CUBE_MAP, renderTarget.texture, renderTarget.width, renderTarget.height );
 
 				}
 
@@ -20385,7 +20384,7 @@
 
 				if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
 
-					generateMipmap( renderTarget.texture, _gl.TEXTURE_2D );
+					generateMipmap( _gl.TEXTURE_2D, renderTarget.texture, renderTarget.width, renderTarget.height );
 
 				}
 
@@ -20414,7 +20413,7 @@
 				var webglTexture = properties.get( texture ).__webglTexture;
 
 				state.bindTexture( target, webglTexture );
-				generateMipmap( texture, target );
+				generateMipmap( target, texture, renderTarget.width, renderTarget.height );
 				state.bindTexture( target, null );
 
 			}

Разница между файлами не показана из-за своего большого размера
+ 93 - 365
build/three.min.js


+ 8 - 9
build/three.module.js

@@ -19659,14 +19659,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 	}
 
-	function generateMipmap( texture, target ) {
+	function generateMipmap( target, texture, width, height ) {
 
 		_gl.generateMipmap( target );
 
-		// We assume images for cube map have the same size.
-		var image = Array.isArray( texture.image ) ? texture.image[ 0 ] : texture.image;
 		var textureProperties = properties.get( texture );
-		textureProperties.__maxMipLevel = Math.log2( Math.max( image.width, image.height ) );
+		textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) );
 
 	}
 
@@ -19926,7 +19924,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 				if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
 
-					generateMipmap( texture, _gl.TEXTURE_CUBE_MAP );
+					// We assume images for cube map have the same size.
+					generateMipmap( _gl.TEXTURE_CUBE_MAP, texture, image.width, image.height );
 
 				}
 
@@ -20181,7 +20180,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
 
-			generateMipmap( texture, _gl.TEXTURE_2D );
+			generateMipmap( _gl.TEXTURE_2D, texture, image.width, image.height );
 
 		}
 
@@ -20365,7 +20364,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
 
-				generateMipmap( renderTarget.texture,  _gl.TEXTURE_CUBE_MAP );
+				generateMipmap( _gl.TEXTURE_CUBE_MAP, renderTarget.texture, renderTarget.width, renderTarget.height );
 
 			}
 
@@ -20379,7 +20378,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
 
-				generateMipmap( renderTarget.texture, _gl.TEXTURE_2D );
+				generateMipmap( _gl.TEXTURE_2D, renderTarget.texture, renderTarget.width, renderTarget.height );
 
 			}
 
@@ -20408,7 +20407,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 			var webglTexture = properties.get( texture ).__webglTexture;
 
 			state.bindTexture( target, webglTexture );
-			generateMipmap( texture, target );
+			generateMipmap( target, texture, renderTarget.width, renderTarget.height );
 			state.bindTexture( target, null );
 
 		}

Некоторые файлы не были показаны из-за большого количества измененных файлов