aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-08 16:07:02 -0800
committerJose Antonio Marquez2012-03-08 16:07:02 -0800
commit4bdb951f2dab6d132ed28ab17888cc819ed811ee (patch)
tree4fa0ac486431b1fb39383c3bb3a01a230a73f422 /js/document
parent85f21e020ac281e8e545df1cf269034de99a00b1 (diff)
downloadninja-4bdb951f2dab6d132ed28ab17888cc819ed811ee.tar.gz
Adding I/O functionality to RDGE
Added webGL/Canvas file I/O for Ninja, it also created routine for saving data for runtime, however, the runtime RDGE library needs an update for runtime to work, so right now I/O will only work for Ninja.
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js64
1 files changed, 22 insertions, 42 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 05c7d6c0..46fefd90 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -208,49 +208,29 @@ exports.HTMLDocument = Montage.create(TextDocument, {
208 var elt = this.documentRoot; 208 var elt = this.documentRoot;
209 if (elt) 209 if (elt)
210 { 210 {
211// FOR JOSE: The following commented out lines are what the runtime 211 var nWorlds= value.length;
212// version should execute. 212 for (var i=0; i<nWorlds; i++) {
213// var loadForRuntime = true; 213 var importStr = value[i];
214// if (loadForRuntime) 214 var startIndex = importStr.indexOf("id: ");
215// { 215 if (startIndex >= 0) {
216// var cdm = new CanvasDataManager(); 216 var endIndex = importStr.indexOf("\n", startIndex);
217// cdm.loadGLData(elt, value ); 217 if (endIndex > 0) {
218// } 218 var id = importStr.substring( startIndex+4, endIndex);
219// else 219 if (id) {
220 { 220 var canvas = this.findCanvasWithID(id, elt);
221 var nWorlds= value.length; 221 if (canvas) {
222 for (var i=0; i<nWorlds; i++) 222 if (!canvas.elementModel) {
223 { 223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
224 var importStr = value[i]; 224 }
225 var startIndex = importStr.indexOf( "id: " ); 225 if (canvas.elementModel) {
226 if (startIndex >= 0) 226 if (canvas.elementModel.shapeModel.GLWorld) {
227 { 227 canvas.elementModel.shapeModel.GLWorld.clearTree();
228 var endIndex = importStr.indexOf( "\n", startIndex );
229 if (endIndex > 0)
230 {
231 var id = importStr.substring( startIndex+4, endIndex );
232 if (id)
233 {
234 var canvas = this.findCanvasWithID( id, elt );
235 if (canvas)
236 {
237 if (!canvas.elementModel)
238 {
239 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
240 }
241
242 if (canvas.elementModel)
243 {
244 if (canvas.elementModel.shapeModel.GLWorld)
245 canvas.elementModel.shapeModel.GLWorld.clearTree();
246
247 var index = importStr.indexOf( "webGL: " );
248 var useWebGL = (index >= 0)
249 var world = new GLWorld( canvas, useWebGL );
250 world.import( importStr );
251
252 this.buildShapeModel( canvas.elementModel, world );
253 } 228 }
229 var index = importStr.indexOf( "webGL: " );
230 var useWebGL = (index >= 0)
231 var world = new GLWorld(canvas, useWebGL);
232 world.import( importStr );
233 this.buildShapeModel(canvas.elementModel, world);
254 } 234 }
255 } 235 }
256 } 236 }