浏览代码

Canvas2D rendering issue on Sprite2D and Text2d

Fixing a bug then the rendering was incorrectly considered as successfully done but in fact not due to Shader Effect not yet loaded.
nockawa 9 年之前
父节点
当前提交
510b56f313
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      src/Canvas2d/babylon.sprite2d.ts
  2. 1 1
      src/Canvas2d/babylon.text2d.ts

+ 1 - 1
src/Canvas2d/babylon.sprite2d.ts

@@ -11,7 +11,7 @@
         render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean {
             // Do nothing if the shader is still loading/preparing 
             if (!this.effectsReady) {
-                if ((!this.effect.isReady() || (this.effectInstanced && !this.effectInstanced.isReady()))) {
+                if ((this.effect && (!this.effect.isReady() || (this.effectInstanced && !this.effectInstanced.isReady())))) {
                     return false;
                 }
                 this.effectsReady = true;

+ 1 - 1
src/Canvas2d/babylon.text2d.ts

@@ -11,7 +11,7 @@
         render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean {
             // Do nothing if the shader is still loading/preparing 
             if (!this.effectsReady) {
-                if ((!this.effect.isReady() || (this.effectInstanced && !this.effectInstanced.isReady()))) {
+                if ((this.effect && (!this.effect.isReady() || (this.effectInstanced && !this.effectInstanced.isReady())))) {
                     return false;
                 }
                 this.effectsReady = true;