// TODO: Move bounds handling code to separate class, keep this clean public void UpdateBounds() { if (BoundsDirty) { if (Component) { var generator = Component as ChiselGeneratorComponent; if (generator) { SelfBounds = ChiselBoundsUtility.CalculateBounds(generator); } ChildBoundsDirty = true; BoundsDirty = false; } } if (ChildBoundsDirty) { SelfWithChildrenBounds = SelfBounds; // TODO: make this non-iterative for (int i = 0; i < Children.Count; i++) { Children[i].EncapsulateBounds(ref SelfWithChildrenBounds); } ChildBoundsDirty = false; } }
// TODO: Move bounds handling code to separate class, keep this clean public Bounds CalculateBounds(Matrix4x4 transformation) { var gridBounds = new Bounds(); if (Component) { var generator = Component as ChiselGeneratorComponent; if (generator) { SelfBounds = ChiselBoundsUtility.CalculateBounds(generator, transformation); } } // TODO: make this non-iterative for (int i = 0; i < Children.Count; i++) { Children[i].EncapsulateBounds(ref gridBounds, transformation); } return(gridBounds); }