Explorar o código

[fxparams] removed VCurveScale

Clement Espeute hai 1 ano
pai
achega
621d130004
Modificáronse 4 ficheiros con 8 adicións e 15 borrados
  1. 3 10
      hrt/prefab/fx/Emitter.hx
  2. 2 4
      hrt/prefab/fx/Evaluator.hx
  3. 3 0
      hrt/prefab/fx/FX.hx
  4. 0 1
      hrt/prefab/fx/Value.hx

+ 3 - 10
hrt/prefab/fx/Emitter.hx

@@ -1558,16 +1558,9 @@ class Emitter extends Object3D {
 				if(b == VOne) return a;
 				switch a {
 					case VConst(va):
-						switch b {
-							case VConst(vb): return VConst(va * vb);
-							case VCurve(cb): return VCurveScale(cb, va);
-							default:
-						}
+						return VMult(a, b);
 					case VCurve(ca):
-						switch b {
-							case VConst(vb): return VCurveScale(ca, vb);
-							default:
-						}
+						return VMult(a, b);
 					case VRandomScale(ri,rscale):
 						switch b {
 							case VCurve(vb): return VAddRandCurve(0, ri, rscale, vb);
@@ -1608,7 +1601,7 @@ class Emitter extends Object3D {
 				var randCurve = getCurve(pname + suffix + ".rand");
 				var randVal : Value = VZero;
 				if(randCurve != null)
-					randVal = VRandom(randIdx++, VCurveScale(randCurve, randProp != null ? randProp : 1.0));
+					randVal = VRandom(randIdx++, VMult(randCurve.makeVal(), VConst(randProp != null ? randProp : 1.0)));
 				else if(randProp != null && randProp != 0.0)
 					randVal = VRandomScale(randIdx++, randProp);
 

+ 2 - 4
hrt/prefab/fx/Evaluator.hx

@@ -48,7 +48,6 @@ class Evaluator {
 					var remappedRand = (rand - min) / (max - min);
 					return a + (b - a) * remappedRand;
 				}
-			case VCurveScale(c, scale): throw "curveScale is deprecated";//return c.getVal(time) * scale;
 			case VRandom(ridx, scale):
 				return getRandom(pidx, ridx) * getFloat(pidx, scale, time);
 			case VRandomScale(ridx, scale):
@@ -68,12 +67,11 @@ class Evaluator {
 		switch(val) {
 			case VOne: return time;
 			case VConst(v): return v * time;
-			case VCurveScale(c, scale): return c.getSum(time) * scale;
 			case VCurve(c): return c.getSum(time);
 			case VAdd(a, b):
 				return getSum(a, time) + getSum(b, time);
-			case VMult(a, b):
-			case VZero:
+			case VMult(a, VConst(b)): return getSum(a, time) * b;
+			case VZero: return 0;
 			default: throw "Not implemented";
 		}
 		return 0.0;

+ 3 - 0
hrt/prefab/fx/FX.hx

@@ -81,6 +81,9 @@ class FXAnimation extends h3d.scene.Object {
 		for (p in params) {
 			evaluator.parameters[p.name] = p.def;
 		}
+		for (a in shaderAnims) {
+			a.setAllParameters(params);
+		}
 	}
 
 	public function setRandSeed(seed: Int) {

+ 0 - 1
hrt/prefab/fx/Value.hx

@@ -7,7 +7,6 @@ enum Value {
 	VCurve(c: Curve);
 	VBlend(a: Value, b: Value, blendVar: String);
 	VRandomBetweenCurves(idx: Int, c: Curve);
-	VCurveScale(c: Curve, scale: Float);
 	VRandom(idx: Int, scale: Value);
 	VRandomScale(idx: Int, scale: Float);
 	VAddRandCurve(cst: Float, ridx: Int, rscale: Float, c: Curve);