aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js51
1 files changed, 29 insertions, 22 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index 7893786e..32829351 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -121,6 +121,13 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath )
121 // all "live" materials 121 // all "live" materials
122 this._materials = []; 122 this._materials = [];
123 123
124 // provide the mapping for the asset directory
125 if (assetPath) {
126 this._assetPath = assetPath.slice();
127 if (this._assetPath[this._assetPath.length - 1] != '/')
128 this._assetPath += '/';
129 }
130
124 if(this._assetPath !== undefined) { 131 if(this._assetPath !== undefined) {
125 RDGE.globals.engine.setAssetPath(this._assetPath); 132 RDGE.globals.engine.setAssetPath(this._assetPath);
126 } 133 }
@@ -1229,11 +1236,11 @@ NinjaCvsRt.RuntimePulseMaterial = function ()
1229 var material = this._materialNode; 1236 var material = this._materialNode;
1230 if (material) 1237 if (material)
1231 { 1238 {
1232 var technique = material.shaderProgram.default; 1239 var technique = material.shaderProgram["default"];
1233 var renderer = RDGE.globals.engine.getContext().renderer; 1240 var renderer = RDGE.globals.engine.getContext().renderer;
1234 if (renderer && technique) 1241 if (renderer && technique)
1235 { 1242 {
1236 if (this._shader && this._shader.default) 1243 if (this._shader && this._shader["default"])
1237 { 1244 {
1238 var res = [ renderer.vpWidth, renderer.vpHeight ]; 1245 var res = [ renderer.vpWidth, renderer.vpHeight ];
1239 technique.u_resolution.set( res ); 1246 technique.u_resolution.set( res );
@@ -1243,7 +1250,7 @@ NinjaCvsRt.RuntimePulseMaterial = function ()
1243 if (tex) 1250 if (tex)
1244 technique.u_tex0.set( tex ); 1251 technique.u_tex0.set( tex );
1245 1252
1246 this._shader.default.u_time.set( [this._time] ); 1253 this._shader["default"].u_time.set( [this._time] );
1247 } 1254 }
1248 } 1255 }
1249 } 1256 }
@@ -1256,12 +1263,12 @@ NinjaCvsRt.RuntimePulseMaterial = function ()
1256 var material = this._materialNode; 1263 var material = this._materialNode;
1257 if (material) 1264 if (material)
1258 { 1265 {
1259 var technique = material.shaderProgram.default; 1266 var technique = material.shaderProgram["default"];
1260 var renderer = RDGE.globals.engine.getContext().renderer; 1267 var renderer = RDGE.globals.engine.getContext().renderer;
1261 if (renderer && technique) 1268 if (renderer && technique)
1262 { 1269 {
1263 if (this._shader && this._shader.default) 1270 if (this._shader && this._shader["default"])
1264 this._shader.default.u_time.set( [this._time] ); 1271 this._shader["default"].u_time.set( [this._time] );
1265 this._time += this._dTime; 1272 this._time += this._dTime;
1266 if (this._time > 200.0) this._time = 0.0; 1273 if (this._time > 200.0) this._time = 0.0;
1267 } 1274 }
@@ -1289,24 +1296,24 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = function ()
1289 var material = this._materialNode; 1296 var material = this._materialNode;
1290 if (material) 1297 if (material)
1291 { 1298 {
1292 var technique = material.shaderProgram.default; 1299 var technique = material.shaderProgram["default"];
1293 var renderer = RDGE.globals.engine.getContext().renderer; 1300 var renderer = RDGE.globals.engine.getContext().renderer;
1294 if (renderer && technique) 1301 if (renderer && technique)
1295 { 1302 {
1296 if (this._shader && this._shader.default) 1303 if (this._shader && this._shader["default"])
1297 { 1304 {
1298 this._shader.default.u_color1.set( this._color1 ); 1305 this._shader["default"].u_color1.set( this._color1 );
1299 this._shader.default.u_color2.set( this._color2 ); 1306 this._shader["default"].u_color2.set( this._color2 );
1300 this._shader.default.u_color3.set( this._color3 ); 1307 this._shader["default"].u_color3.set( this._color3 );
1301 this._shader.default.u_color4.set( this._color4 ); 1308 this._shader["default"].u_color4.set( this._color4 );
1302 1309
1303 this._shader.default.u_colorStop1.set( [this._colorStop1] ); 1310 this._shader["default"].u_colorStop1.set( [this._colorStop1] );
1304 this._shader.default.u_colorStop2.set( [this._colorStop2] ); 1311 this._shader["default"].u_colorStop2.set( [this._colorStop2] );
1305 this._shader.default.u_colorStop3.set( [this._colorStop3] ); 1312 this._shader["default"].u_colorStop3.set( [this._colorStop3] );
1306 this._shader.default.u_colorStop4.set( [this._colorStop4] ); 1313 this._shader["default"].u_colorStop4.set( [this._colorStop4] );
1307 1314
1308 if (this._angle !== undefined) 1315 if (this._angle !== undefined)
1309 this._shader.default.u_cos_sin_angle.set([Math.cos(this._angle), Math.sin(this._angle)]); 1316 this._shader["default"].u_cos_sin_angle.set([Math.cos(this._angle), Math.sin(this._angle)]);
1310 } 1317 }
1311 } 1318 }
1312 } 1319 }
@@ -1368,11 +1375,11 @@ NinjaCvsRt.RuntimeBumpMetalMaterial = function ()
1368 var material = this._materialNode; 1375 var material = this._materialNode;
1369 if (material) 1376 if (material)
1370 { 1377 {
1371 var technique = material.shaderProgram.default; 1378 var technique = material.shaderProgram["default"];
1372 var renderer = RDGE.globals.engine.getContext().renderer; 1379 var renderer = RDGE.globals.engine.getContext().renderer;
1373 if (renderer && technique) 1380 if (renderer && technique)
1374 { 1381 {
1375 if (this._shader && this._shader.default) 1382 if (this._shader && this._shader["default"])
1376 { 1383 {
1377 technique.u_light0Diff.set( this._lightDiff ); 1384 technique.u_light0Diff.set( this._lightDiff );
1378 1385
@@ -1582,12 +1589,12 @@ NinjaCvsRt.RuntimePlasmaMaterial = function ()
1582 var material = this._materialNode; 1589 var material = this._materialNode;
1583 if (material) 1590 if (material)
1584 { 1591 {
1585 var technique = material.shaderProgram.default; 1592 var technique = material.shaderProgram["default"];
1586 var renderer = RDGE.globals.engine.getContext().renderer; 1593 var renderer = RDGE.globals.engine.getContext().renderer;
1587 if (renderer && technique) 1594 if (renderer && technique)
1588 { 1595 {
1589 if (this._shader && this._shader.default) 1596 if (this._shader && this._shader["default"])
1590 this._shader.default.u_time.set( [this._time] ); 1597 this._shader["default"].u_time.set( [this._time] );
1591 this._time += this._dTime; 1598 this._time += this._dTime;
1592 if (this._time > 200.0) this._time = 0.0; 1599 if (this._time > 200.0) this._time = 0.0;
1593 } 1600 }