aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-10 16:27:48 -0800
committerJose Antonio Marquez2012-03-10 16:27:48 -0800
commit615be47750fb86c07acd9354da12a76abe6c24e0 (patch)
tree6f180ddb9f631b49271670771144759c39f3c919
parentd8c9578ced2c0dad0a9152ff955511986d9c013d (diff)
downloadninja-615be47750fb86c07acd9354da12a76abe6c24e0.tar.gz
Temp Runtime WebGL Fix
Added a temporary fix to allow for webGL runtime functionality. Copying the desired folder name into a static name. There is a lag in doing this, so obviously now ideal. Need to discuss adding dynamic path-ing during author and runtime.
-rw-r--r--assets/descriptor.json40
-rw-r--r--js/io/system/ninjalibrary.js6
-rw-r--r--js/mediators/io-mediator.js11
3 files changed, 44 insertions, 13 deletions
diff --git a/assets/descriptor.json b/assets/descriptor.json
index 2b955c40..0da58755 100644
--- a/assets/descriptor.json
+++ b/assets/descriptor.json
@@ -6,31 +6,53 @@
6 "files": [ 6 "files": [
7 "CanvasRuntime.js", 7 "CanvasRuntime.js",
8 "rdge-compiled.js", 8 "rdge-compiled.js",
9 "images/black.png",
10 "images/blue.png",
11 "images/BoxB2_AO.png", 9 "images/BoxB2_AO.png",
12 "images/BoxB2_DM.png",
13 "images/cubelight.png",
14 "images/grey.png", 10 "images/grey.png",
15 "images/material_paint.png",
16 "images/metal.png",
17 "images/normalMap.png",
18 "images/random_normal.png",
19 "images/rocky-diffuse.jpg", 11 "images/rocky-diffuse.jpg",
12 "images/BoxB2_DM.png",
13 "images/material_paint.png",
20 "images/rocky-normal.jpg", 14 "images/rocky-normal.jpg",
15 "images/black.png",
16 "images/metal.png",
21 "images/rocky-spec.jpg", 17 "images/rocky-spec.jpg",
18 "images/blue.png",
19 "images/normalMap.png",
22 "images/silver.png", 20 "images/silver.png",
21 "images/cubelight.png",
22 "images/random_normal.png",
23 "images/white.png", 23 "images/white.png",
24 "shaders/Basic.frag.glsl", 24 "shaders/Basic.frag.glsl",
25 "shaders/TwistVert.vert.glsl",
25 "shaders/Basic.vert.glsl", 26 "shaders/Basic.vert.glsl",
27 "shaders/Water.frag.glsl",
28 "shaders/Deform.frag.glsl",
29 "shaders/Water2.frag.glsl",
30 "shaders/Flag.vert.glsl",
31 "shaders/ZInvert.frag.glsl",
32 "shaders/Fly.frag.glsl",
26 "shaders/linearGradient.frag.glsl", 33 "shaders/linearGradient.frag.glsl",
34 "shaders/Julia.frag.glsl",
27 "shaders/linearGradient.vert.glsl", 35 "shaders/linearGradient.vert.glsl",
36 "shaders/Keleidoscope.frag.glsl",
37 "shaders/plasma.frag.glsl",
38 "shaders/Mandel.frag.glsl",
39 "shaders/plasma.vert.glsl",
40 "shaders/Pulse.frag.glsl",
41 "shaders/radialBlur.frag.glsl",
42 "shaders/ReliefTunnel.frag.glsl",
28 "shaders/radialGradient.frag.glsl", 43 "shaders/radialGradient.frag.glsl",
44 "shaders/SquareTunnel.frag.glsl",
29 "shaders/radialGradient.vert.glsl", 45 "shaders/radialGradient.vert.glsl",
46 "shaders/Star.frag.glsl",
30 "shaders/test_fshader.glsl", 47 "shaders/test_fshader.glsl",
48 "shaders/Taper.frag.glsl",
31 "shaders/test_fshader_full.glsl", 49 "shaders/test_fshader_full.glsl",
50 "shaders/Taper.vert.glsl",
32 "shaders/test_vshader.glsl", 51 "shaders/test_vshader.glsl",
52 "shaders/Tunnel.frag.glsl",
33 "shaders/ub_fshader.glsl", 53 "shaders/ub_fshader.glsl",
34 "shaders/ub_vshader.glsl" 54 "shaders/Twist.frag.glsl",
55 "shaders/ub_vshader.glsl",
56 "shaders/TwistVert.frag.glsl"
35 ] 57 ]
36} \ No newline at end of file 58} \ No newline at end of file
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index ff949613..201598fc 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -82,7 +82,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
82 // 82 //
83 copyLibToCloud: { 83 copyLibToCloud: {
84 enumerable: false, 84 enumerable: false,
85 value: function (path, libName) { 85 value: function (path, libName, callback) {
86 // 86 //
87 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { 87 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) {
88 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { 88 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) {
@@ -91,7 +91,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
91 //Getting contents of library to be copied 91 //Getting contents of library to be copied
92 this.chromeApi.directoryContents(contents[i], function (lib) { 92 this.chromeApi.directoryContents(contents[i], function (lib) {
93 //Creating directory structure from subfolders 93 //Creating directory structure from subfolders
94 this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); 94 this.copyDirectoryToCloud(path, contents[i], path, callback);
95 }.bind(this)); 95 }.bind(this));
96 break; 96 break;
97 } 97 }
@@ -138,6 +138,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
138 } 138 }
139 }.bind(this)); 139 }.bind(this));
140 } 140 }
141 //TODO Add logic for proper callback status(es)
142 if (callback) callback(true);
141 } 143 }
142 }, 144 },
143 //////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 11aeb74d..e9661f20 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -355,7 +355,15 @@ exports.IoMediator = Montage.create(Component, {
355 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { 355 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
356 rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); 356 rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase();
357 rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; 357 rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version;
358 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName); 358 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName, hackRename.bind(this));
359 //TODO: Remove, this is copying the library into a static name
360 function hackRename (status) {
361 if (status) {
362 setTimeout(function () {
363 this.application.ninja.coreIoApi.copyDirectory({sourceUri: template.document.root+rdgeDirName, destUri: template.document.root+'assets'});
364 }.bind(this), 3000);
365 }
366 }
359 } else { 367 } else {
360 //TODO: Error handle no available library to copy 368 //TODO: Error handle no available library to copy
361 } 369 }
@@ -431,7 +439,6 @@ function initWebGl (e) {\n\
431 }\n\ 439 }\n\
432 //Creating data manager\n\ 440 //Creating data manager\n\
433 cvsDataMngr = new CanvasDataManager();\n\ 441 cvsDataMngr = new CanvasDataManager();\n\
434 g_Engine._assetPath = '"+rdgeDirName+"/';\n\
435 //Loading data to canvas(es)\n\ 442 //Loading data to canvas(es)\n\
436 cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\ 443 cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\
437}\ 444}\