Fix Typo in mix nodes (was using wrong property for clamp)
Changed clamp to Math.clamp()
This commit is contained in:
parent
ab1eb0758b
commit
471974c226
|
@ -1,6 +1,7 @@
|
||||||
package armory.logicnode;
|
package armory.logicnode;
|
||||||
|
|
||||||
import iron.system.Tween;
|
import iron.system.Tween;
|
||||||
|
import iron.math.Math;
|
||||||
|
|
||||||
class MixNode extends LogicNode {
|
class MixNode extends LogicNode {
|
||||||
|
|
||||||
|
@ -41,11 +42,12 @@ class MixNode extends LogicNode {
|
||||||
|
|
||||||
override function get(from:Int):Dynamic {
|
override function get(from:Int):Dynamic {
|
||||||
if (ease == null) init();
|
if (ease == null) init();
|
||||||
var k:Float = inputs[0].get();
|
var k:Float = inputs[0].get(); //Factor
|
||||||
var v1:Float = inputs[1].get();
|
var v1:Float = inputs[1].get();
|
||||||
var v2:Float = inputs[2].get();
|
var v2:Float = inputs[2].get();
|
||||||
var f = v1 + (v2 - v1) * ease(k);
|
var f = v1 + (v2 - v1) * ease(k);
|
||||||
if (property1 == "true") f = f < 0.0 ? 0.0 : (f > 1.0 ? 1.0 : f);
|
|
||||||
|
if (property2 == "true") f = Math.clamp(f, 0, 1);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package armory.logicnode;
|
||||||
|
|
||||||
import iron.system.Tween;
|
import iron.system.Tween;
|
||||||
import iron.math.Vec4;
|
import iron.math.Vec4;
|
||||||
|
import iron.math.Math;
|
||||||
|
|
||||||
class VectorMixNode extends LogicNode {
|
class VectorMixNode extends LogicNode {
|
||||||
|
|
||||||
|
@ -44,18 +45,15 @@ class VectorMixNode extends LogicNode {
|
||||||
|
|
||||||
override function get(from:Int):Dynamic {
|
override function get(from:Int):Dynamic {
|
||||||
if (ease == null) init();
|
if (ease == null) init();
|
||||||
var k:Float = inputs[0].get();
|
var k:Float = inputs[0].get(); //Factor
|
||||||
var v1:Vec4 = inputs[1].get();
|
var v1:Vec4 = inputs[1].get();
|
||||||
var v2:Vec4 = inputs[2].get();
|
var v2:Vec4 = inputs[2].get();
|
||||||
var f = ease(k);
|
var f = ease(k);
|
||||||
v.x = v1.x + (v2.x - v1.x) * f;
|
v.x = v1.x + (v2.x - v1.x) * f;
|
||||||
v.y = v1.y + (v2.y - v1.y) * f;
|
v.y = v1.y + (v2.y - v1.y) * f;
|
||||||
v.z = v1.z + (v2.z - v1.z) * f;
|
v.z = v1.z + (v2.z - v1.z) * f;
|
||||||
if (property1 == "true") {
|
|
||||||
v.x = v.x < 0.0 ? 0.0 : (v.x > 1.0 ? 1.0 : v.x);
|
if (property2 == "true") v.clamp(0,1);
|
||||||
v.y = v.y < 0.0 ? 0.0 : (v.y > 1.0 ? 1.0 : v.y);
|
|
||||||
v.z = v.z < 0.0 ? 0.0 : (v.z > 1.0 ? 1.0 : v.z);
|
|
||||||
}
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue