Browse Source

Fix crash when setting alpha cut off to 1

Popov72 4 years ago
parent
commit
0c03409573
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts

+ 3 - 1
src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts

@@ -612,10 +612,12 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         }
         }
 
 
         // Transparency
         // Transparency
+        const alphaTestCutOffString = this.alphaTestCutoff.toString();
+
         defines.setValue("ALPHABLEND", this.useAlphaBlending, true);
         defines.setValue("ALPHABLEND", this.useAlphaBlending, true);
         defines.setValue("ALPHAFROMALBEDO", this.useAlphaFromAlbedoTexture, true);
         defines.setValue("ALPHAFROMALBEDO", this.useAlphaFromAlbedoTexture, true);
         defines.setValue("ALPHATEST", this.useAlphaTest, true);
         defines.setValue("ALPHATEST", this.useAlphaTest, true);
-        defines.setValue("ALPHATESTVALUE", this.alphaTestCutoff, true);
+        defines.setValue("ALPHATESTVALUE", alphaTestCutOffString.indexOf('.') < 0 ? alphaTestCutOffString + "." : alphaTestCutOffString, true);
         defines.setValue("OPACITYRGB", this.opacityRGB, true);
         defines.setValue("OPACITYRGB", this.opacityRGB, true);
 
 
         // Rendering
         // Rendering