diff options
-rw-r--r-- | assets/canvas-runtime.js (renamed from assets/CanvasRuntime.js) | 14 | ||||
-rw-r--r-- | assets/descriptor.json | 4 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 28 |
3 files changed, 23 insertions, 23 deletions
diff --git a/assets/CanvasRuntime.js b/assets/canvas-runtime.js index 445050bc..655e52fa 100644 --- a/assets/CanvasRuntime.js +++ b/assets/canvas-runtime.js | |||
@@ -4,6 +4,20 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | /////////////////////////////////////////////////////////////////////// | ||
8 | //Loading webGL/canvas data | ||
9 | function initWebGl (rootElement, directory) { | ||
10 | var cvsDataMngr, ninjaWebGlData = JSON.parse((document.querySelectorAll(['script[data-ninja-webgl]'])[0].innerHTML.replace('(', '')).replace(')', '')); | ||
11 | if (ninjaWebGlData && ninjaWebGlData.data) { | ||
12 | for (var n=0; ninjaWebGlData.data[n]; n++) { | ||
13 | ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]); | ||
14 | } | ||
15 | } | ||
16 | //Creating data manager | ||
17 | cvsDataMngr = new CanvasDataManager(); | ||
18 | //Loading data to canvas(es) | ||
19 | cvsDataMngr.loadGLData(rootElement, ninjaWebGlData.data, directory); | ||
20 | } | ||
7 | 21 | ||
8 | /////////////////////////////////////////////////////////////////////// | 22 | /////////////////////////////////////////////////////////////////////// |
9 | // Class ShapeRuntime | 23 | // Class ShapeRuntime |
diff --git a/assets/descriptor.json b/assets/descriptor.json index 0da58755..af0520dd 100644 --- a/assets/descriptor.json +++ b/assets/descriptor.json | |||
@@ -1,10 +1,10 @@ | |||
1 | { | 1 | { |
2 | "copyright": "This file contains proprietary software owned by Motorola Mobility, Inc. No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder. (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.", | 2 | "copyright": "This file contains proprietary software owned by Motorola Mobility, Inc. No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder. (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.", |
3 | "version": "0.5.1.0", | 3 | "version": "0.0.0.0", |
4 | "root": "/assets/", | 4 | "root": "/assets/", |
5 | "directories": [{"name": "images"}, {"name": "shaders"}], | 5 | "directories": [{"name": "images"}, {"name": "shaders"}], |
6 | "files": [ | 6 | "files": [ |
7 | "CanvasRuntime.js", | 7 | "canvas-runtime.js", |
8 | "rdge-compiled.js", | 8 | "rdge-compiled.js", |
9 | "images/BoxB2_AO.png", | 9 | "images/BoxB2_AO.png", |
10 | "images/grey.png", | 10 | "images/grey.png", |
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 472b3004..d81f4543 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -408,7 +408,7 @@ exports.IoMediator = Montage.create(Component, { | |||
408 | if (!webgllibtag) { | 408 | if (!webgllibtag) { |
409 | webgllibtag = template.document.content.document.createElement('script'); | 409 | webgllibtag = template.document.content.document.createElement('script'); |
410 | webgllibtag.setAttribute('type', 'text/javascript'); | 410 | webgllibtag.setAttribute('type', 'text/javascript'); |
411 | webgllibtag.setAttribute('src', rdgeDirName+'/CanvasRuntime.js'); | 411 | webgllibtag.setAttribute('src', rdgeDirName+'/canvas-runtime.js'); |
412 | webgllibtag.setAttribute('data-ninja-webgl-lib', 'true'); | 412 | webgllibtag.setAttribute('data-ninja-webgl-lib', 'true'); |
413 | template.document.content.document.head.appendChild(webgllibtag); | 413 | template.document.content.document.head.appendChild(webgllibtag); |
414 | } | 414 | } |
@@ -425,31 +425,17 @@ exports.IoMediator = Montage.create(Component, { | |||
425 | webgljstag.setAttribute('data-ninja-webgl-js', 'true'); | 425 | webgljstag.setAttribute('data-ninja-webgl-js', 'true'); |
426 | template.document.content.document.head.appendChild(webgljstag); | 426 | template.document.content.document.head.appendChild(webgljstag); |
427 | } | 427 | } |
428 | |||
429 | ///////////////////////////////////////////////////////////////////////////// | ||
430 | ///////////////////////////////////////////////////////////////////////////// | ||
431 | //TODO: Decide if this should be over-writter or only written on creation | 428 | //TODO: Decide if this should be over-writter or only written on creation |
429 | var rootElement = 'document.body'; //TODO: Set actual root element | ||
432 | webgljstag.innerHTML = "\ | 430 | webgljstag.innerHTML = "\ |
433 | //Loading webGL/canvas data on window load\n\ | 431 | //Loading webGL/canvas data on window load\n\ |
434 | window.addEventListener('load', initWebGl, false);\n\ | 432 | window.addEventListener('load', loadWebGL, false);\n\ |
435 | function initWebGl (e) {\n\ | 433 | function loadWebGL (e) {\n\ |
436 | window.removeEventListener('load', initWebGl, false);\n\ | 434 | window.removeEventListener('load', loadWebGL, false);\n\ |
437 | var cvsDataMngr, ninjaWebGlData = JSON.parse((document.querySelectorAll(['script[data-ninja-webgl]'])[0].innerHTML.replace(\"(\", \"\")).replace(\")\", \"\"));\n\ | 435 | //Calling method to initialize all webGL/canvas(es)\n\ |
438 | if (ninjaWebGlData && ninjaWebGlData.data) {\n\ | 436 | initWebGl("+rootElement+", '"+rdgeDirName+"/');\n\ |
439 | for (var n=0; ninjaWebGlData.data[n]; n++) {\n\ | ||
440 | ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]);\n\ | ||
441 | }\n\ | ||
442 | }\n\ | ||
443 | //Creating data manager\n\ | ||
444 | cvsDataMngr = new CanvasDataManager();\n\ | ||
445 | //Loading data to canvas(es)\n\ | ||
446 | cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\ | ||
447 | }\ | 437 | }\ |
448 | "; | 438 | "; |
449 | ///////////////////////////////////////////////////////////////////////////// | ||
450 | ///////////////////////////////////////////////////////////////////////////// | ||
451 | ///////////////////////////////////////////////////////////////////////////// | ||
452 | |||
453 | //TODO: This data should be saved to a JSON file eventually | 439 | //TODO: This data should be saved to a JSON file eventually |
454 | json = '\n({\n\t"version": "'+rdgeVersion+'",\n\t"directory": "'+rdgeDirName+'/",\n\t"data": ['; | 440 | json = '\n({\n\t"version": "'+rdgeVersion+'",\n\t"directory": "'+rdgeDirName+'/",\n\t"data": ['; |
455 | //Looping through data to create escaped array | 441 | //Looping through data to create escaped array |