aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js73
1 files changed, 42 insertions, 31 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index 2035d2e0..cd673854 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -608,6 +608,7 @@ NinjaCvsRt.RuntimeGeomObj = Object.create(Object.prototype, {
608 case "uber": mat = Object.create(NinjaCvsRt.RuntimeUberMaterial, {}); break; 608 case "uber": mat = Object.create(NinjaCvsRt.RuntimeUberMaterial, {}); break;
609 case "plasma": mat = Object.create(NinjaCvsRt.RuntimePlasmaMaterial, {}); break; 609 case "plasma": mat = Object.create(NinjaCvsRt.RuntimePlasmaMaterial, {}); break;
610 case "water": mat = Object.create(NinjaCvsRt.RuntimeWaterMaterial, {}); break; 610 case "water": mat = Object.create(NinjaCvsRt.RuntimeWaterMaterial, {}); break;
611 case "taper": mat = Object.create(NinjaCvsRt.RuntimeTaperMaterial, {}); break;
611 612
612 case "deform": 613 case "deform":
613 case "paris": 614 case "paris":
@@ -1518,20 +1519,23 @@ NinjaCvsRt.RuntimeTaperMaterial = Object.create(NinjaCvsRt.RuntimeMaterial, {
1518 1519
1519 1520
1520 isAnimated: { value: function() { return true; }}, 1521 isAnimated: { value: function() { return true; }},
1521 1522
1522 importJSON: { 1523 importJSON: {
1523 value: function(jObj) { 1524 value: function(jObj) {
1524 this._tex0 = jObj.tex0; 1525 for (var prop in jObj)
1525 this._tex1 = jObj.tex1; 1526 {
1526 1527 if ((prop != 'material') && (prop != 'name'))
1527 this._speed = jObj.speed; 1528 {
1529 var value = jObj[prop];
1530 this[prop] = value;
1531 }
1532 }
1528 1533
1529 this._limit1 = jObj.limit1; 1534 this._dTime = jObj.dTime;
1530 this._limit2 = jObj.limit2; 1535 }
1531 this._twistAmount = jObj.angle;
1532 }
1533 }, 1536 },
1534 1537
1538
1535 init: { 1539 init: {
1536 value: function(world) { 1540 value: function(world) {
1537 var material = this._materialNode; 1541 var material = this._materialNode;
@@ -1541,15 +1545,18 @@ NinjaCvsRt.RuntimeTaperMaterial = Object.create(NinjaCvsRt.RuntimeMaterial, {
1541 var renderer = RDGE.globals.engine.getContext().renderer; 1545 var renderer = RDGE.globals.engine.getContext().renderer;
1542 if (renderer && technique) 1546 if (renderer && technique)
1543 { 1547 {
1544 var wrap = 'REPEAT', mips = true; 1548// var wrap = 'REPEAT', mips = true;
1545 var tex = renderer.getTextureByName(this._tex0, wrap, mips ); 1549// var tex = renderer.getTextureByName(this._tex0, wrap, mips );
1546 if (tex) technique.u_tex0.set( tex ); 1550// if (tex) technique.u_tex0.set( tex );
1547 tex = renderer.getTextureByName(this._tex1, wrap, mips ); 1551// tex = renderer.getTextureByName(this._tex1, wrap, mips );
1548 if (tex) technique.u_tex1.set( tex ); 1552// if (tex) technique.u_tex1.set( tex );
1549 1553
1550 technique.u_twistAmount.set( [this._angle] ); 1554 technique.u_limit1.set( [this.u_limit1] );
1551 technique.u_limit1.set( [this._limit1] );
1552 technique.u_limit2.set( [this._limit2] ); 1555 technique.u_limit2.set( [this._limit2] );
1556 technique.u_limit3.set( [this._limit3] );
1557 technique.u_minVal.set( [this.u_minVal] );
1558 technique.u_maxVal.set( [this.u_maxVal] );
1559 technique.u_taperAmount.set( [this.u_taperAmount] );
1553 } 1560 }
1554 } 1561 }
1555 } 1562 }
@@ -1560,21 +1567,25 @@ NinjaCvsRt.RuntimeTaperMaterial = Object.create(NinjaCvsRt.RuntimeMaterial, {
1560 update: { 1567 update: {
1561 value: function(time) { 1568 value: function(time) {
1562 1569
1563 var angle = this._angle; 1570 var speed = this.u_speed;
1564 angle += this._dTime * this._speed; 1571 this._dTime += 0.01 * speed;
1565 if (angle > this._twistAmount) 1572
1566 { 1573 if (this._shader && this._shader.colorMe) {
1567 angle = this._twistAmount; 1574 var t3 = this.u_limit3 - this._dTime;
1568 this._dTime = -this._dTime; 1575 if (t3 < 0) {
1569 } 1576 this._dTime = this.u_limit1 - 1.0;
1570 else if (angle < 0.0) 1577 t3 = this.u_limit3 - this._dTime;
1571 { 1578 }
1572 angle = 0; 1579
1573 this._dTime = -this._dTime; 1580 var t1 = this.u_limit1 - this._dTime,
1574 } 1581 t2 = this.u_limit2 - this._dTime;
1575 this._angle = angle; 1582
1576 this._shader.twistMe["u_twistAmount"].set([angle]); 1583
1577 } 1584 this._shader.colorMe["u_limit1"].set([t1]);
1585 this._shader.colorMe["u_limit2"].set([t2]);
1586 this._shader.colorMe["u_limit3"].set([t3]);
1587 }
1588 }
1578 } 1589 }
1579}); 1590});
1580 1591