示例#1
0
        private double TestRay(Ray ray, Scene scene)
        {
            ISect isect = MinIntersection(ray, scene);

            if (ISect.IsNull(isect))
            {
                return(0);
            }
            return(isect.Dist);
        }
示例#2
0
        private Color TraceRay(Ray ray, Scene scene, int depth)
        {
            ISect isect = MinIntersection(ray, scene);

            if (ISect.IsNull(isect))
            {
                return(Color.Background);
            }
            return(Shade(isect, scene, depth));
        }
示例#3
0
        private ISect MinIntersection(Ray ray, Scene scene)
        {
            ISect min = ISect.Null;

            foreach (SceneObject obj in scene.Things)
            {
                ISect isect = obj.Intersect(ray);
                if (!ISect.IsNull(isect))
                {
                    if (ISect.IsNull(min) || min.Dist > isect.Dist)
                    {
                        min = isect;
                    }
                }
            }
            return(min);
        }