예제 #1
0
        public void trace(Ray r)
        {
            if (left != null)
            {
                int    f_d, f_n;
                double d_l, d_r;
                bool   h_l = Custom.Intersect.rayBoxIntersectDist(r.pos, r.dir, left.bounds, out d_l, out f_d, out f_n);
                bool   h_r = Custom.Intersect.rayBoxIntersectDist(r.pos, r.dir, right.bounds, out d_r, out f_d, out f_n);

                if (h_l && h_r)
                {
                    if (d_l < d_r)
                    {
                        left.trace(r);
                        if (d_r < r.hit_dist)
                        {
                            right.trace(r);
                        }
                    }
                    else
                    {
                        right.trace(r);
                        if (d_l < r.hit_dist)
                        {
                            left.trace(r);
                        }
                    }
                }
                else if (h_l)
                {
                    left.trace(r);
                }
                else if (h_r)
                {
                    right.trace(r);
                }
            }
            else
            {
                foreach (var o in list)
                {
                    o.trace(r);
                }
            }
        }
예제 #2
0
        public override void trace(Ray r)
        {
            int    f_d, f_n;
            double d_l;
            bool   h_l = Custom.Intersect.rayBoxIntersectDist(r.pos, r.dir, tree.bounds, out d_l, out f_d, out f_n);

            if (h_l && d_l >= 0)
            {
                tree.trace(r);
            }
        }