From 7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 16:27:01 -0700 Subject: Removed the dependence on an "assets" directory for the RDGE runtime. Now Ninja does not need to create duplicate files when it sets up the users Ninja Projects directory for RDGE support. --- assets/canvas-runtime.js | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'assets/canvas-runtime.js') diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 6278fdac..a35f473d 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js @@ -104,6 +104,7 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) this._initialized = false; this._useWebGL = false; + this._assetPath = undefined; // view parameters this._fov = 45.0; @@ -120,13 +121,17 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) // all "live" materials this._materials = []; - // provide the mapping for the asset directory - if (assetPath) - { - this._assetPath = assetPath.slice(); - if (this._assetPath[this._assetPath.length-1] != '/') - this._assetPath += '/'; - } + // provide the mapping for the asset directory + if (assetPath) + { + this._assetPath = assetPath.slice(); + if (this._assetPath[this._assetPath.length-1] != '/') + this._assetPath += '/'; + } + + if(this._assetPath !== undefined) { + RDGE.globals.engine.setAssetPath(this._assetPath); + } /////////////////////////////////////////////////////////////////////// // accessors @@ -366,21 +371,6 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) } }; - this.remapAssetFolder = function( url ) - { -// var searchStr = "assets/"; -// var index = url.indexOf( searchStr ); -// var rtnPath = url; -// if (index >= 0) -// { -// rtnPath = url.substr( index + searchStr.length ); -// rtnPath = this._assetPath + rtnPath; -// } -// return rtnPath; - - return url; - }; - this.findMaterialNode = function( nodeName, node ) { if (node.transformNode) @@ -1257,7 +1247,6 @@ NinjaCvsRt.RuntimePulseMaterial = function () technique.u_resolution.set( res ); var wrap = 'REPEAT', mips = true; - this._texMap = world.remapAssetFolder( this._texMap ); var tex = renderer.getTextureByName(this._texMap, wrap, mips ); if (tex) technique.u_tex0.set( tex ); @@ -1399,19 +1388,16 @@ NinjaCvsRt.RuntimeBumpMetalMaterial = function () var wrap = 'REPEAT', mips = true; if (this._diffuseTexture) { - this._diffuseTexture = world.remapAssetFolder( this._diffuseTexture ); tex = renderer.getTextureByName(this._diffuseTexture, wrap, mips ); if (tex) technique.u_colMap.set( tex ); } if (this._normalTexture) { - this._normalTexture = world.remapAssetFolder( this._normalTexture ); tex = renderer.getTextureByName(this._normalTexture, wrap, mips ); if (tex) technique.u_normalMap.set( tex ); } if (this._specularTexture) { - this._specularTexture = world.remapAssetFolder( this._specularTexture ); tex = renderer.getTextureByName(this._specularTexture, wrap, mips ); technique.u_glowMap.set( tex ); } -- cgit v1.2.3