From 615be47750fb86c07acd9354da12a76abe6c24e0 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 10 Mar 2012 16:27:48 -0800 Subject: 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. --- assets/descriptor.json | 40 +++++++++++++++++++++++++++++++--------- js/io/system/ninjalibrary.js | 6 ++++-- js/mediators/io-mediator.js | 11 +++++++++-- 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 @@ "files": [ "CanvasRuntime.js", "rdge-compiled.js", - "images/black.png", - "images/blue.png", "images/BoxB2_AO.png", - "images/BoxB2_DM.png", - "images/cubelight.png", "images/grey.png", - "images/material_paint.png", - "images/metal.png", - "images/normalMap.png", - "images/random_normal.png", "images/rocky-diffuse.jpg", + "images/BoxB2_DM.png", + "images/material_paint.png", "images/rocky-normal.jpg", + "images/black.png", + "images/metal.png", "images/rocky-spec.jpg", + "images/blue.png", + "images/normalMap.png", "images/silver.png", + "images/cubelight.png", + "images/random_normal.png", "images/white.png", "shaders/Basic.frag.glsl", + "shaders/TwistVert.vert.glsl", "shaders/Basic.vert.glsl", + "shaders/Water.frag.glsl", + "shaders/Deform.frag.glsl", + "shaders/Water2.frag.glsl", + "shaders/Flag.vert.glsl", + "shaders/ZInvert.frag.glsl", + "shaders/Fly.frag.glsl", "shaders/linearGradient.frag.glsl", + "shaders/Julia.frag.glsl", "shaders/linearGradient.vert.glsl", + "shaders/Keleidoscope.frag.glsl", + "shaders/plasma.frag.glsl", + "shaders/Mandel.frag.glsl", + "shaders/plasma.vert.glsl", + "shaders/Pulse.frag.glsl", + "shaders/radialBlur.frag.glsl", + "shaders/ReliefTunnel.frag.glsl", "shaders/radialGradient.frag.glsl", + "shaders/SquareTunnel.frag.glsl", "shaders/radialGradient.vert.glsl", + "shaders/Star.frag.glsl", "shaders/test_fshader.glsl", + "shaders/Taper.frag.glsl", "shaders/test_fshader_full.glsl", + "shaders/Taper.vert.glsl", "shaders/test_vshader.glsl", + "shaders/Tunnel.frag.glsl", "shaders/ub_fshader.glsl", - "shaders/ub_vshader.glsl" + "shaders/Twist.frag.glsl", + "shaders/ub_vshader.glsl", + "shaders/TwistVert.frag.glsl" ] } \ 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, { // copyLibToCloud: { enumerable: false, - value: function (path, libName) { + value: function (path, libName, callback) { // if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { @@ -91,7 +91,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //Getting contents of library to be copied this.chromeApi.directoryContents(contents[i], function (lib) { //Creating directory structure from subfolders - this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); + this.copyDirectoryToCloud(path, contents[i], path, callback); }.bind(this)); break; } @@ -138,6 +138,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { } }.bind(this)); } + //TODO Add logic for proper callback status(es) + if (callback) callback(true); } }, //////////////////////////////////////////////////////////////////// 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, { if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; - this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName); + this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName, hackRename.bind(this)); + //TODO: Remove, this is copying the library into a static name + function hackRename (status) { + if (status) { + setTimeout(function () { + this.application.ninja.coreIoApi.copyDirectory({sourceUri: template.document.root+rdgeDirName, destUri: template.document.root+'assets'}); + }.bind(this), 3000); + } + } } else { //TODO: Error handle no available library to copy } @@ -431,7 +439,6 @@ function initWebGl (e) {\n\ }\n\ //Creating data manager\n\ cvsDataMngr = new CanvasDataManager();\n\ - g_Engine._assetPath = '"+rdgeDirName+"/';\n\ //Loading data to canvas(es)\n\ cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\ }\ -- cgit v1.2.3