From 611237a9e806b88ac69a47417cd12e834fd348a0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 13 Dec 2018 18:29:59 +0100 Subject: [PATCH] try #2436 @0.5 --- js/libs/fluidbook/fluidbook.3dflip.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.3dflip.js b/js/libs/fluidbook/fluidbook.3dflip.js index 3fd5856b..8d6a8dc4 100644 --- a/js/libs/fluidbook/fluidbook.3dflip.js +++ b/js/libs/fluidbook/fluidbook.3dflip.js @@ -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; } -- 2.39.5