예제 #1
0
        private List <IHittable> BvhPreprocess()
        {
            Hittables.Clear();
            var planes         = new List <IHittable>();
            var hittablesToBvh = new List <IHittable>();

            foreach (var model in Models)
            {
                if (model is Plane || model is Cylinder)
                {
                    planes.Add(model);
                }
                else
                {
                    hittablesToBvh.AddRange(((IHittable)model).Preprocess());
                }
            }

            Hittables.AddRange(planes);
            if (hittablesToBvh != null && hittablesToBvh.Count > 0)
            {
                var node = new BvhNode(hittablesToBvh, 0, hittablesToBvh.Count);
                Hittables.Add(node);
            }

            return(Hittables);
        }
예제 #2
0
        private List <IHittable> StandardPreprocess()
        {
            Hittables.Clear();
            foreach (var model in Models)
            {
                Hittables.AddRange(((IHittable)model).Preprocess());
            }

            return(Hittables);
        }