Преглед изворни кода

[render-props] Check if FX is visible before adding it to the renderer

Clément Espeute пре 11 месеци
родитељ
комит
8546c8eda6
1 измењених фајлова са 11 додато и 1 уклоњено
  1. 11 1
      hrt/prefab/RenderProps.hx

+ 11 - 1
hrt/prefab/RenderProps.hx

@@ -80,7 +80,17 @@ class RenderProps extends Object3D {
 			if (scene != null) {
 				var fxAnims = scene.findAll(f -> Std.downcast(f, hrt.prefab.fx.FX.FXAnimation));
 				for (fxAnim in fxAnims) {
-					if (fxAnim.effects == null)
+					var visible = true;
+					var p : h3d.scene.Object = fxAnim;
+					while (p != null) {
+						if (!p.visible) {
+							visible = false;
+							break;
+						}
+						p = p.parent;
+					}
+
+					if (fxAnim.effects == null || visible == false)
 						continue;
 					for (e in fxAnim.effects)
 						renderer.effects.push(cast @:privateAccess e.instance);