aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/texture.js
diff options
context:
space:
mode:
authorhwc4872012-04-26 16:40:05 -0700
committerhwc4872012-04-26 16:40:05 -0700
commit5a1965bf2ed9a54601ca16fd67555335c510ce08 (patch)
tree7fa2419c8a194e7b0265b58f0f4d10d02a0d66f4 /js/lib/rdge/texture.js
parentee07f71e9e6c9219e02738c77fb038bece2e03b6 (diff)
downloadninja-5a1965bf2ed9a54601ca16fd67555335c510ce08.tar.gz
Update materials to the new texture model.
Create local world for deleted source canvases
Diffstat (limited to 'js/lib/rdge/texture.js')
-rw-r--r--js/lib/rdge/texture.js9
1 files changed, 7 insertions, 2 deletions
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 )
142 { 142 {
143 // get the data from the old world 143 // get the data from the old world
144 var jStr = srcWorld.exportJSON(); 144 var jStr = srcWorld.exportJSON();
145 var index = jStr.indexOf( ';' );
146 if ((jStr[0] === 'v') && (index < 24))
147 jStr = jStr.substr( index+1 );
145 var jObj = JSON.parse( jStr ); 148 var jObj = JSON.parse( jStr );
146 var oldCanvas = srcWorld.getCanvas(); 149 var oldCanvas = srcWorld.getCanvas();
147 150
148 // create a new canvas 151 // create a new canvas
149 this._srcCanvas = NJUtils.makeNJElement("canvas", canvasID, "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); 152 var NJUtils = require("js/lib/NJUtils").NJUtils;
153 this._srcCanvas = NJUtils.makeNJElement("canvas", "texture_internal_canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true);
150 srcCanvas = this._srcCanvas; 154 srcCanvas = this._srcCanvas;
151 srcCanvas.width = oldCanvas.width; 155 srcCanvas.width = oldCanvas.width;
152 srcCanvas.height = oldCanvas.height; 156 srcCanvas.height = oldCanvas.height;
153 157
154 // rebuild the world 158 // rebuild the world
159 var GLWorld = require("js/lib/drawing/world").World;
155 this._srcWorld = new GLWorld( this._srcCanvas, true, true ); 160 this._srcWorld = new GLWorld( this._srcCanvas, true, true );
156 this._srcWorld.importSJON( jObj ); 161 this._srcWorld.importJSON( jObj );
157 162
158 this._isLocal = true; 163 this._isLocal = true;
159 } 164 }