浏览代码

Merge pull request #16686 from donmccurdy/bug-basistextureloader-ios

BasisTextureLoader: Fix example on iOS
Mr.doob 6 年之前
父节点
当前提交
aab613b3fb

+ 3 - 0
docs/examples/loaders/BasisTextureLoader.html

@@ -60,6 +60,9 @@
 			desktop, Android, and iOS devices, and transcoded into DXT, ETC1, or
 			desktop, Android, and iOS devices, and transcoded into DXT, ETC1, or
 			PVRTC1. Other output formats may be supported in the future.
 			PVRTC1. Other output formats may be supported in the future.
 		</p>
 		</p>
+		<p>
+			Transcoding to PVRTC1 (for iOS) requires square power-of-two textures.
+		</p>
 		<p>
 		<p>
 			This loader relies on ES6 Promises and Web Assembly, which are not
 			This loader relies on ES6 Promises and Web Assembly, which are not
 			supported in IE11.
 			supported in IE11.

+ 7 - 1
examples/js/loaders/BasisTextureLoader.js

@@ -167,7 +167,7 @@ THREE.BasisTextureLoader.prototype = {
 
 
 				}
 				}
 
 
-				texture.minFilter = THREE.LinearMipMapLinearFilter;
+				texture.minFilter = mipmaps.length === 1 ? THREE.LinearFilter : THREE.LinearMipMapLinearFilter;
 				texture.magFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;
 				texture.generateMipmaps = false;
 				texture.generateMipmaps = false;
 				texture.needsUpdate = true;
 				texture.needsUpdate = true;
@@ -449,6 +449,12 @@ THREE.BasisTextureLoader.BasisWorker = function () {
 
 
 		}
 		}
 
 
+		if ( basisFile.getHasAlpha() ) {
+
+			console.warn( 'THREE.BasisTextureLoader: Alpha not yet implemented.' );
+
+		}
+
 		var mipmaps = [];
 		var mipmaps = [];
 
 
 		for ( var mip = 0; mip < levels; mip ++ ) {
 		for ( var mip = 0; mip < levels; mip ++ ) {

二进制
examples/textures/compressed/PavingStones.basis


二进制
examples/textures/compressed/kodim20.basis


+ 1 - 1
examples/webgl_loader_texture_basis.html

@@ -51,7 +51,7 @@
 				loader.setTranscoderPath( 'js/libs/basis/' );
 				loader.setTranscoderPath( 'js/libs/basis/' );
 				loader.detectSupport( renderer );
 				loader.detectSupport( renderer );
 
 
-				loader.load( 'textures/compressed/kodim20.basis', function ( texture ) {
+				loader.load( 'textures/compressed/PavingStones.basis', function ( texture ) {
 
 
 					texture.encoding = THREE.sRGBEncoding;
 					texture.encoding = THREE.sRGBEncoding;
 					material.map = texture;
 					material.map = texture;

粤ICP备19079148号