protected override void ApplyDrawNode(DrawNode node) { ContainerDrawNode n = node as ContainerDrawNode; n.MaskingRect = Masking ? ScreenSpaceDrawQuad.AABB : (Rectangle?)null; base.ApplyDrawNode(node); }
internal override DrawNode GenerateDrawNodeSubtree(DrawNode node = null) { ContainerDrawNode cNode = base.GenerateDrawNodeSubtree(node) as ContainerDrawNode; if (children.AliveItems.Count > 0) { if (cNode.Children != null) { var current = children.AliveItems; var target = cNode.Children; int j = 0; for (int i = 0; i < current.Count; i++) { if (!current[i].IsVisible) { continue; } //todo: make this more efficient. if (Game?.ScreenSpaceDrawQuad.FastIntersects(current[i].ScreenSpaceDrawQuad) == false) { continue; } if (j < target.Count && target[j].Drawable == current[i]) { current[i].GenerateDrawNodeSubtree(target[j]); } else { if (j < target.Count) { target.RemoveAt(j); } target.Insert(j, current[i].GenerateDrawNodeSubtree()); } j++; } if (j < target.Count) { target.RemoveRange(j, target.Count - j); } } else { cNode.Children = new List <DrawNode>(children.AliveItems.Count); foreach (Drawable child in children.AliveItems) { //if (Game?.ScreenSpaceDrawQuad.Intersects(child.ScreenSpaceDrawQuad) == false) // continue; if (!child.IsVisible) { continue; } cNode.Children.Add(child.GenerateDrawNodeSubtree()); } } } else { cNode.Children?.Clear(); } return(cNode); }