]> _ Git - fluidbook-html5.git/commitdiff
try #2436 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Dec 2018 17:29:59 +0000 (18:29 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Dec 2018 17:29:59 +0000 (18:29 +0100)
js/libs/fluidbook/fluidbook.3dflip.js

index 3fd5856b02f3ac07afcb2a9677f27e47f49bf4e8..8d6a8dc44f77f7fc74aff1f61058942c46b939fd 100644 (file)
@@ -60,10 +60,8 @@ Fluidbook3DFlip.prototype = {
             var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
             var rawrenderer = renderer;
 
-            console.log(renderer);
-
             var m = /\((.*)\)/.exec(renderer);
-            if (m.length > 0) {
+            if (m !== null && m.length > 0 && m[1].length > 8) {
                 renderer = m[1];
             }
 
@@ -254,6 +252,10 @@ Fluidbook3DFlip.prototype = {
     },
 
     initThree: function () {
+        if (this.scene !== null) {
+            return;
+        }
+
         this.scene = new THREE.Scene();
         if (this.enableLight) {
             this.scene.add(new THREE.AmbientLight(0xffffff, 1.5));
@@ -518,6 +520,16 @@ Fluidbook3DFlip.prototype = {
     },
 
     texturesLoaded: function (t1, t2, callback) {
+        if (this.textures === undefined || this.textures === null || this.textures.length === 0) {
+            // If textures are not loaded
+            console.warn('Texture object not ready. Waiting');
+            var $this = this;
+            setTimeout(function () {
+                $this.texturesLoaded(t1, t2, callback);
+            }, 500);
+            return;
+        }
+
         if (t1 != null) {
             this.textures[0].map = t1;
         }