ソースを参照

Merge pull request #6028 from TrevorDev/avoidSettingNullToString

do not let defines:string = null
David Catuhe 6 年 前
コミット
47c8defbb1
1 ファイル変更2 行追加2 行削除
  1. 2 2
      src/Materials/effect.ts

+ 2 - 2
src/Materials/effect.ts

@@ -306,7 +306,7 @@ export class Effect {
             }
             }
         } else {
         } else {
             this._engine = <Engine>engine;
             this._engine = <Engine>engine;
-            this.defines = <string>defines;
+            this.defines = (defines == null ? "" : defines);
             this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);
             this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);
             this._samplers = samplers ? <string[]>samplers.slice() : [];
             this._samplers = samplers ? <string[]>samplers.slice() : [];
             this._attributesNames = (<string[]>attributesNamesOrOptions);
             this._attributesNames = (<string[]>attributesNamesOrOptions);
@@ -651,7 +651,7 @@ export class Effect {
         }
         }
 
 
         // Add multiview setup to top of file when defined
         // Add multiview setup to top of file when defined
-        var hasMultiviewExtension = this.defines && this.defines.indexOf("#define MULTIVIEW\n") !== -1;
+        var hasMultiviewExtension = this.defines.indexOf("#define MULTIVIEW\n") !== -1;
         if (hasMultiviewExtension && !isFragment) {
         if (hasMultiviewExtension && !isFragment) {
             result = "#extension GL_OVR_multiview : require\nlayout (num_views = 2) in;\n" + result;
             result = "#extension GL_OVR_multiview : require\nlayout (num_views = 2) in;\n" + result;
         }
         }