瀏覽代碼

[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);