Browse Source

RendererFX: return rendererFX instance by default in modulate

lviguier 1 tháng trước cách đây
mục cha
commit
0ac2bdbb3d
2 tập tin đã thay đổi với 6 bổ sung6 xóa
  1. 3 5
      hrt/prefab/rfx/ColorGrading.hx
  2. 3 1
      hrt/prefab/rfx/RendererFX.hx

+ 3 - 5
hrt/prefab/rfx/ColorGrading.hx

@@ -112,11 +112,9 @@ class ColorGrading extends RendererFX {
 	}
 
 	override function modulate(t : Float) {
-		if (this.instance == null)
-			this.make();
-
-		cast (this.instance, ColorGrading).intensity = this.intensity * t;
-		return this.instance;
+		var c : ColorGrading = cast super.modulate(t);
+		c.intensity = this.intensity * t;
+		return c.instance;
 	}
 
 	override function transition( r1 : h3d.impl.RendererFX, r2 : h3d.impl.RendererFX, t : Float ) {

+ 3 - 1
hrt/prefab/rfx/RendererFX.hx

@@ -20,7 +20,9 @@ class RendererFX extends Prefab implements h3d.impl.RendererFX {
 	}
 
 	public function modulate( t : Float ) : h3d.impl.RendererFX {
-		return null;
+		if (this.instance == null)
+			this.make();
+		return this.instance;
 	}
 
 	inline function checkEnabled() {