diff options
author | John Mayhew | 2012-04-03 16:27:01 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-03 16:27:01 -0700 |
commit | 7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170 (patch) | |
tree | b0f2b79c8624e26327995991077a89b7969ded94 /assets/canvas-runtime.js | |
parent | 18609d375e7aab9cb48c9b3f5b291f85cbd28683 (diff) | |
download | ninja-7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170.tar.gz |
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.
Diffstat (limited to 'assets/canvas-runtime.js')
-rw-r--r-- | assets/canvas-runtime.js | 38 |
1 files changed, 12 insertions, 26 deletions
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 ) | |||
104 | this._initialized = false; | 104 | this._initialized = false; |
105 | 105 | ||
106 | this._useWebGL = false; | 106 | this._useWebGL = false; |
107 | this._assetPath = undefined; | ||
107 | 108 | ||
108 | // view parameters | 109 | // view parameters |
109 | this._fov = 45.0; | 110 | this._fov = 45.0; |
@@ -120,13 +121,17 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
120 | // all "live" materials | 121 | // all "live" materials |
121 | this._materials = []; | 122 | this._materials = []; |
122 | 123 | ||
123 | // provide the mapping for the asset directory | 124 | // provide the mapping for the asset directory |
124 | if (assetPath) | 125 | if (assetPath) |
125 | { | 126 | { |
126 | this._assetPath = assetPath.slice(); | 127 | this._assetPath = assetPath.slice(); |
127 | if (this._assetPath[this._assetPath.length-1] != '/') | 128 | if (this._assetPath[this._assetPath.length-1] != '/') |
128 | this._assetPath += '/'; | 129 | this._assetPath += '/'; |
129 | } | 130 | } |
131 | |||
132 | if(this._assetPath !== undefined) { | ||
133 | RDGE.globals.engine.setAssetPath(this._assetPath); | ||
134 | } | ||
130 | 135 | ||
131 | /////////////////////////////////////////////////////////////////////// | 136 | /////////////////////////////////////////////////////////////////////// |
132 | // accessors | 137 | // accessors |
@@ -366,21 +371,6 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
366 | } | 371 | } |
367 | }; | 372 | }; |
368 | 373 | ||
369 | this.remapAssetFolder = function( url ) | ||
370 | { | ||
371 | // var searchStr = "assets/"; | ||
372 | // var index = url.indexOf( searchStr ); | ||
373 | // var rtnPath = url; | ||
374 | // if (index >= 0) | ||
375 | // { | ||
376 | // rtnPath = url.substr( index + searchStr.length ); | ||
377 | // rtnPath = this._assetPath + rtnPath; | ||
378 | // } | ||
379 | // return rtnPath; | ||
380 | |||
381 | return url; | ||
382 | }; | ||
383 | |||
384 | this.findMaterialNode = function( nodeName, node ) | 374 | this.findMaterialNode = function( nodeName, node ) |
385 | { | 375 | { |
386 | if (node.transformNode) | 376 | if (node.transformNode) |
@@ -1257,7 +1247,6 @@ NinjaCvsRt.RuntimePulseMaterial = function () | |||
1257 | technique.u_resolution.set( res ); | 1247 | technique.u_resolution.set( res ); |
1258 | 1248 | ||
1259 | var wrap = 'REPEAT', mips = true; | 1249 | var wrap = 'REPEAT', mips = true; |
1260 | this._texMap = world.remapAssetFolder( this._texMap ); | ||
1261 | var tex = renderer.getTextureByName(this._texMap, wrap, mips ); | 1250 | var tex = renderer.getTextureByName(this._texMap, wrap, mips ); |
1262 | if (tex) | 1251 | if (tex) |
1263 | technique.u_tex0.set( tex ); | 1252 | technique.u_tex0.set( tex ); |
@@ -1399,19 +1388,16 @@ NinjaCvsRt.RuntimeBumpMetalMaterial = function () | |||
1399 | var wrap = 'REPEAT', mips = true; | 1388 | var wrap = 'REPEAT', mips = true; |
1400 | if (this._diffuseTexture) | 1389 | if (this._diffuseTexture) |
1401 | { | 1390 | { |
1402 | this._diffuseTexture = world.remapAssetFolder( this._diffuseTexture ); | ||
1403 | tex = renderer.getTextureByName(this._diffuseTexture, wrap, mips ); | 1391 | tex = renderer.getTextureByName(this._diffuseTexture, wrap, mips ); |
1404 | if (tex) technique.u_colMap.set( tex ); | 1392 | if (tex) technique.u_colMap.set( tex ); |
1405 | } | 1393 | } |
1406 | if (this._normalTexture) | 1394 | if (this._normalTexture) |
1407 | { | 1395 | { |
1408 | this._normalTexture = world.remapAssetFolder( this._normalTexture ); | ||
1409 | tex = renderer.getTextureByName(this._normalTexture, wrap, mips ); | 1396 | tex = renderer.getTextureByName(this._normalTexture, wrap, mips ); |
1410 | if (tex) technique.u_normalMap.set( tex ); | 1397 | if (tex) technique.u_normalMap.set( tex ); |
1411 | } | 1398 | } |
1412 | if (this._specularTexture) | 1399 | if (this._specularTexture) |
1413 | { | 1400 | { |
1414 | this._specularTexture = world.remapAssetFolder( this._specularTexture ); | ||
1415 | tex = renderer.getTextureByName(this._specularTexture, wrap, mips ); | 1401 | tex = renderer.getTextureByName(this._specularTexture, wrap, mips ); |
1416 | technique.u_glowMap.set( tex ); | 1402 | technique.u_glowMap.set( tex ); |
1417 | } | 1403 | } |