From 5a1965bf2ed9a54601ca16fd67555335c510ce08 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 26 Apr 2012 16:40:05 -0700 Subject: Update materials to the new texture model. Create local world for deleted source canvases --- js/lib/rdge/texture.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'js/lib/rdge/texture.js') diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js index bcbcb4bc..0a7070d3 100644 --- a/js/lib/rdge/texture.js +++ b/js/lib/rdge/texture.js @@ -142,18 +142,23 @@ function Texture( dstWorld, texMapName, wrap, mips ) { // get the data from the old world var jStr = srcWorld.exportJSON(); + var index = jStr.indexOf( ';' ); + if ((jStr[0] === 'v') && (index < 24)) + jStr = jStr.substr( index+1 ); var jObj = JSON.parse( jStr ); var oldCanvas = srcWorld.getCanvas(); // create a new canvas - this._srcCanvas = NJUtils.makeNJElement("canvas", canvasID, "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); + var NJUtils = require("js/lib/NJUtils").NJUtils; + this._srcCanvas = NJUtils.makeNJElement("canvas", "texture_internal_canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); srcCanvas = this._srcCanvas; srcCanvas.width = oldCanvas.width; srcCanvas.height = oldCanvas.height; // rebuild the world + var GLWorld = require("js/lib/drawing/world").World; this._srcWorld = new GLWorld( this._srcCanvas, true, true ); - this._srcWorld.importSJON( jObj ); + this._srcWorld.importJSON( jObj ); this._isLocal = true; } -- cgit v1.2.3