Beispiel #1
0
        internal static BoundingBox3?Create(Schema2.IVisualNodeContainer container)
        {
            var nodes = Schema2.Node
                        .Flatten(container)
                        .Where(item => item.Mesh != null);

            var final = Empty;

            var points = new List <Vector3>();

            foreach (var n in nodes)
            {
                var bounds = n.Mesh.LocalBounds3;

                if (!bounds.HasValue)
                {
                    continue;
                }

                var xform = n.WorldMatrix;

                var xppp = n.Mesh.LocalBounds3.Value.Points.Select(p => Vector3.Transform(p, xform));

                points.AddRange(xppp);
            }

            return(BoundingBox3.FromPoints(points));
        }
Beispiel #2
0
 public BoundingBox3(BoundingBox3 a, BoundingBox3 b)
 {
     Min = Vector3.Min(a.Min, b.Min);
     Max = Vector3.Max(a.Max, b.Max);
 }