Forráskód Böngészése

Merge pull request #9807 from Popov72/fix-nme-reflectionblock-gencode

NME: Add missing parameters when dumping code for Texture and Reflection blocks
sebavan 4 éve
szülő
commit
39596ca3cf

+ 3 - 2
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -454,9 +454,10 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         let codeString: string;
 
         if (this.texture.isCube) {
-            codeString = `${this._codeVariableName}.texture = new BABYLON.CubeTexture("${this.texture.name}");\r\n`;
+            const forcedExtension = (this.texture as CubeTexture).forcedExtension;
+            codeString = `${this._codeVariableName}.texture = new BABYLON.CubeTexture("${this.texture.name}", undefined, undefined, ${this.texture.noMipmap}, null, undefined, undefined, undefined, ${this.texture._prefiltered}, ${forcedExtension ? "\"" + forcedExtension + "\"" : "null"});\r\n`;
         } else {
-            codeString = `${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}");\r\n`;
+            codeString = `${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null);\r\n`;
         }
         codeString += `${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`;
 

+ 2 - 1
src/Materials/Node/Blocks/Dual/textureBlock.ts

@@ -442,7 +442,7 @@ export class TextureBlock extends NodeMaterialBlock {
             return "";
         }
 
-        var codeString = `${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null);\r\n`;
+        var codeString = `${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null, ${this.texture.noMipmap}, ${this.texture.invertY});\r\n`;
         codeString += `${this._codeVariableName}.texture.wrapU = ${this.texture.wrapU};\r\n`;
         codeString += `${this._codeVariableName}.texture.wrapV = ${this.texture.wrapV};\r\n`;
         codeString += `${this._codeVariableName}.texture.uAng = ${this.texture.uAng};\r\n`;
@@ -452,6 +452,7 @@ export class TextureBlock extends NodeMaterialBlock {
         codeString += `${this._codeVariableName}.texture.vOffset = ${this.texture.vOffset};\r\n`;
         codeString += `${this._codeVariableName}.texture.uScale = ${this.texture.uScale};\r\n`;
         codeString += `${this._codeVariableName}.texture.vScale = ${this.texture.vScale};\r\n`;
+        codeString += `${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`;
         codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\r\n`;
         codeString += `${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\r\n`;
 

+ 7 - 0
src/Materials/Textures/cubeTexture.ts

@@ -95,6 +95,13 @@ export class CubeTexture extends BaseTexture {
     @serialize("forcedExtension")
     protected _forcedExtension: Nullable<string> = null;
 
+    /**
+     * Gets the forced extension (if any)
+     */
+    public get forcedExtension(): Nullable<string> {
+        return this._forcedExtension;
+    }
+
     @serialize("extensions")
     private _extensions: Nullable<string[]> = null;