Beispiel #1
0
        private int BoxZCompare(Hitable a, Hitable b)
        {
            BoundingBox aBox = null;
            BoundingBox bBox = null;

            if (!a.GetBoundingBox(0, 0, ref aBox) || !b.GetBoundingBox(0, 0, ref bBox))
            {
                throw new ArgumentException("No bounding box in BVHNode comparer z");
            }
            return(aBox.Min.Z < bBox.Min.Z ? -1 : 1);
        }
Beispiel #2
0
        public bool AddHitable(Hitable a)
        {
            AABB temp = null;

            if (a.GetBoundingBox(0, 0, ref temp))
            {
                hitable_list.Add(a);
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public override AABB GetBoundingBox(float t0, float t1)
        {
            var box = Hitable.GetBoundingBox(t0, t1);

            if (box == null)
            {
                return(null);
            }

            box = new AABB(box.Min + Displacement, box.Max + Displacement);
            return(box);
        }