public static void RenderBounds(DrawEventArgs e, WorldView world, IEnumerable <BvhIterator> allResults)
 {
     foreach (var bvhIterator in allResults)
     {
         Object3DControlsLayer.RenderBounds(e, world, bvhIterator.TransformToWorld, bvhIterator.Bvh, bvhIterator.Depth);
     }
 }
        public void Draw(GuiWidget sender, IObject3D item, bool isSelected, DrawEventArgs e, Matrix4X4 itemMaxtrix, WorldView world)
        {
            if (isSelected)
            {
                var center = item.GetAxisAlignedBoundingBox().Center;

                var traceData = item.GetBVHData();

                var xy = traceData.Contains(center);

                var items = traceData.FilterX(p =>
                {
                    var worldToAxis = Matrix4X4.Invert(p.WorldMatrix);

                    var localPoint = Vector3Ex.Transform(center, worldToAxis);
                    return(p.BvhItem.GetAxisAlignedBoundingBox().Contains(localPoint));
                }).ToArray();

                if (items.Any())
                {
                    int i = 0;
                    foreach (var(BvhItem, Matrix) in items)
                    {
                        Object3DControlsLayer.RenderBounds(e, world, Matrix, BvhItem, i++);
                    }
                }
            }
        }
예제 #3
0
        public void Draw(GuiWidget sender, DrawEventArgs e, Matrix4X4 itemMaxtrix, WorldView world)
        {
            // RenderSceneTraceData
            var bvhIterator = new BvhIterator(scene?.GetBVHData(), decentFilter: (x) =>
            {
                var center      = x.Bvh.GetCenter();
                var worldCenter = Vector3Ex.Transform(center, x.TransformToWorld);
                if (worldCenter.Z > 0)
                {
                    return(true);
                }

                return(false);
            });

            Object3DControlsLayer.RenderBounds(e, world, bvhIterator);
        }