ソースを参照

Merge pull request #1028 from sebavan/GridFix

Fix effect creation based on defines cache
David Catuhe 9 年 前
コミット
b91185d88c

+ 1 - 3
materialsLibrary/dist/babylon.gridMaterial.js

@@ -59,8 +59,6 @@ var BABYLON;
             this._gridControl = new BABYLON.Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);
             this._defines = new GRIDMaterialDefines();
             this._cachedDefines = new GRIDMaterialDefines();
-            // Forces cache to be different on first creation.
-            this._cachedDefines.TRANSPARENT = true;
         }
         /**
          * Returns wehter or not the grid requires alpha blending.
@@ -98,7 +96,7 @@ var BABYLON;
                 this._defines.TRANSPARENT = true;
             }
             // Get correct effect      
-            if (!this._defines.isEqual(this._cachedDefines)) {
+            if (!this._effect || !this._defines.isEqual(this._cachedDefines)) {
                 this._defines.cloneTo(this._cachedDefines);
                 scene.resetCachedMaterial();
                 // Attributes

ファイルの差分が大きいため隠しています
+ 1 - 1
materialsLibrary/dist/babylon.gridMaterial.min.js


+ 2 - 6
materialsLibrary/materials/grid/babylon.gridmaterial.ts

@@ -56,7 +56,7 @@ module BABYLON {
         
         private _renderId: number;
         private _defines = new GRIDMaterialDefines();
-        private _cachedDefines: GRIDMaterialDefines = new GRIDMaterialDefines();
+        private _cachedDefines = new GRIDMaterialDefines();
         
         /**
          * constructor
@@ -65,9 +65,6 @@ module BABYLON {
          */
         constructor(name: string, scene: Scene) {
             super(name, scene);
-            
-            // Forces cache to be different on first creation.
-            this._cachedDefines.TRANSPARENT = true;
         }
         
         /**
@@ -116,9 +113,8 @@ module BABYLON {
             }
 
             // Get correct effect      
-            if (!this._defines.isEqual(this._cachedDefines)) {
+            if (!this._effect || !this._defines.isEqual(this._cachedDefines)) {
                 this._defines.cloneTo(this._cachedDefines);
-
                 scene.resetCachedMaterial();
 
                 // Attributes