Jelajahi Sumber

only enable Wrap for POT textures

ncannasse 9 tahun lalu
induk
melakukan
0f3367f21f
1 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 3 4
      tools/fbx/Viewer.hx

+ 3 - 4
tools/fbx/Viewer.hx

@@ -369,6 +369,7 @@ class Viewer extends hxd.App {
 				t.resize(size.width, size.height);
 				t.uploadPixels(new hxd.Pixels(size.width,size.height,pixels,BGRA));
 				mat.mainPass.culling = None;
+				if( !t.flags.has(IsNPOT) ) t.wrap = Repeat;
 			});
 			loader.load(new flash.net.URLRequest(textureName));
 		} else {
@@ -379,6 +380,7 @@ class Viewer extends hxd.App {
 				t.resize(bmp.width, bmp.height);
 				t.uploadBitmap(hxd.BitmapData.fromNative(bmp));
 				mat.mainPass.culling = None;
+				if( !t.flags.has(IsNPOT) ) t.wrap = Repeat;
 			});
 			loader.load(new flash.net.URLRequest(textureName));
 		}
@@ -453,10 +455,7 @@ class Viewer extends hxd.App {
 			for( m in obj.getMaterials() ) {
 				var t = m.mainPass.getShader(h3d.shader.Texture);
 				m.mainPass.culling = None;
-				if( t != null) {
-					t.killAlpha = true;
-					if( !t.texture.flags.has(IsNPOT) ) t.texture.wrap = Repeat;
-				}
+				if( t != null) t.killAlpha = true;
 				if( m.mainPass.blendDst == Zero ) m.mainPass.blend(SrcAlpha, OneMinusSrcAlpha);
 			}