瀏覽代碼

Implement updating of texture sampling filter

Scott Ramsby 7 年之前
父節點
當前提交
0329c5082f
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      src/Engine/babylon.nativeEngineWrapper.ts

+ 8 - 4
src/Engine/babylon.nativeEngineWrapper.ts

@@ -755,7 +755,7 @@
                     texture.height = texture.baseHeight;
                     texture.isReady = true;
         
-                    var filter = this._getSamplingFilter(samplingMode, !noMipmap);
+                    var filter = this._getSamplingFilter(samplingMode);
 
                     this._interop.setTextureSampling(webGLTexture, filter);
 
@@ -786,7 +786,7 @@
         }
 
         // Returns a NativeFilter.XXXX value.
-        private _getSamplingFilter(samplingMode: number, generateMipMaps: boolean): number {
+        private _getSamplingFilter(samplingMode: number): number {
             switch (samplingMode) {
                 case Engine.TEXTURE_BILINEAR_SAMPLINGMODE:
                     return NativeFilter.MINLINEAR_MAGLINEAR_MIPPOINT;
@@ -872,6 +872,10 @@
         }
 
         public updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void {
+            if (texture._webGLTexture) {
+                var filter = this._getSamplingFilter(samplingMode);
+                this._interop.setTextureSampling(texture._webGLTexture, filter);
+            }
             texture.samplingMode = samplingMode;
         }
 
@@ -965,12 +969,12 @@
                 internalTexture = this.emptyTexture;
             }
 
+            this._activeChannel = channel;
+
             if (!internalTexture._webGLTexture) {
                 return false;
             }
 
-            this._activeChannel = channel;
-
             this._interop.setTextureWrapMode(
                 internalTexture._webGLTexture,
                 this._getAddressMode(texture.wrapU),