// This method will recompute the Bound without precondition. It will not cascade upwards to parent nodes, because // it is intended to be called recursively. public void BottomUpRecalculateBound() { List <BoundingBox> childBounds = new List <BoundingBox>(); foreach (SceneNode child in mChildren) { ImplicitBoundingBoxNode implicitBVChild = child as ImplicitBoundingBoxNode; if (implicitBVChild != null) { implicitBVChild.BottomUpRecalculateBound(); childBounds.Add(implicitBVChild.Bound); } else { childBounds.AddRange(child.FindExplicitBoundingVolumes()); } } BoundingBox combinedBound = childBounds.First(); foreach (BoundingBox childBox in childBounds.Skip(1)) { combinedBound = BoundingBox.CreateMerged(combinedBound, childBox); } Bound = combinedBound; }
protected override void ActorInitializedHandler(object sender, EventArgs e) { ImplicitBoundingBoxNode implicitBox = SceneGraph as ImplicitBoundingBoxNode; if (implicitBox != null) { implicitBox.BottomUpRecalculateBound(); } // We shouldn't need this data anymore. Heights = null; base.ActorInitializedHandler(sender, e); }