From f83a04cda688cc9680749fffae6c0b9fa0c2087f Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 9 Mar 2012 13:29:01 -0800 Subject: Added asset folder replacement to runtime load. --- assets/CanvasRuntime.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'assets') diff --git a/assets/CanvasRuntime.js b/assets/CanvasRuntime.js index d16613ca..5caf72ee 100644 --- a/assets/CanvasRuntime.js +++ b/assets/CanvasRuntime.js @@ -11,8 +11,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot /////////////////////////////////////////////////////////////////////// function CanvasDataManager() { - this.loadGLData = function(root, valueArray ) + this.loadGLData = function(root, valueArray, assetPath ) { + this._assetPath = assetPath.slice(); + var value = valueArray; var nWorlds = value.length; for (var i=0; i= 0) + { + rtnPath = url.substr( index + searchStr.length ); + rtnPath = this._assetPath + rtnPath; + } + return rtnPath; + } + this.findMaterialNode = function( nodeName, node ) { if (node.transformNode) @@ -1121,7 +1141,7 @@ function RuntimePulseMaterial() this._texMap = this.getPropertyFromString( "texture: ", importStr ); } - this.init = function() + this.init = function( world ) { var material = this._materialNode; if (material) @@ -1136,6 +1156,7 @@ function RuntimePulseMaterial() 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 ); @@ -1284,17 +1305,20 @@ function RuntimeBumpMetalMaterial() 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