瀏覽代碼

Merge pull request #9452 from sebavan/master

Fix #9448 Texture sampling mode in inspector
sebavan 4 年之前
父節點
當前提交
60528ba005

+ 16 - 3
inspector/src/components/actionTabs/tabs/propertyGrids/materials/texturePropertyGridComponent.tsx

@@ -141,9 +141,22 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
         const texture = this.props.texture;
 
         var samplingMode = [
-            { label: "Nearest", value: Texture.NEAREST_NEAREST },
-            { label: "Nearest & linear mip", value: Texture.NEAREST_LINEAR },
-            { label: "Linear", value: Texture.LINEAR_LINEAR_MIPLINEAR },
+            { label: "Nearest", value: Texture.NEAREST_NEAREST }, // 1
+            { label: "Linear", value: Texture.LINEAR_LINEAR }, // 2
+
+            { label: "Linear & linear mip", value: Texture.LINEAR_LINEAR_MIPLINEAR }, // 3
+            { label: "Linear & nearest mip", value: Texture.LINEAR_LINEAR_MIPNEAREST }, // 11
+
+            { label: "Nearest & linear mip", value: Texture.NEAREST_NEAREST_MIPLINEAR }, // 8
+            { label: "Nearest & nearest mip", value: Texture.NEAREST_NEAREST_MIPNEAREST }, // 4
+
+            { label: "Nearest/Linear", value: Texture.NEAREST_LINEAR }, // 7
+            { label: "Nearest/Linear & linear mip", value: Texture.NEAREST_LINEAR_MIPLINEAR }, // 6
+            { label: "Nearest/Linear & nearest mip", value: Texture.NEAREST_LINEAR_MIPNEAREST }, // 5
+
+            { label: "Linear/Nearest", value: Texture.LINEAR_NEAREST }, // 12
+            { label: "Linear/Nearest & linear mip", value: Texture.LINEAR_NEAREST_MIPLINEAR }, // 10
+            { label: "Linear/Nearest & nearest mip", value: Texture.LINEAR_NEAREST_MIPNEAREST }, // 9
         ];
 
         var coordinatesMode = [

+ 5 - 4
inspector/src/textureHelper.ts

@@ -65,12 +65,13 @@ export class TextureHelper {
             effect.setFloat("lod", lod);
         };
 
-        let internalTexture = rtt.getInternalTexture();
+        const rttInternalTexture = rtt.getInternalTexture();
+        const internalTexture = texture.getInternalTexture();
 
-        if (internalTexture) {
+        if (rttInternalTexture && internalTexture) {
             const samplingMode = internalTexture.samplingMode;
             texture.updateSamplingMode(Texture.NEAREST_NEAREST_MIPNEAREST);
-            scene.postProcessManager.directRender([lodPostProcess], internalTexture);
+            scene.postProcessManager.directRender([lodPostProcess], rttInternalTexture);
             texture.updateSamplingMode(samplingMode);
 
             // Read the contents of the framebuffer
@@ -148,7 +149,7 @@ export class TextureHelper {
             resolve(data);
 
             // Unbind
-            engine.unBindFramebuffer(internalTexture);
+            engine.unBindFramebuffer(rttInternalTexture);
         } else {
             reject();
         }