예제 #1
0
        public static PathIntegrator Create(ParamSet paramSet, Sampler sampler, Camera camera)
        {
            int      maxDepth    = paramSet.FindOneInt("maxdepth", 5);
            Bounds2I pixelBounds = camera.Film.GetSampleBounds();

            int[] pb = paramSet.FindInt("pixelbounds");
            if (pb.Length > 0)
            {
                if (pb.Length != 4)
                {
                    throw new InvalidOperationException();
                }

                pixelBounds = pixelBounds.Intersect(new Bounds2I(new Point2I(pb[0], pb[2]), new Point2I(pb[1], pb[3])));
                if (pixelBounds.Area == 0.0)
                {
                    throw new InvalidOperationException("degenerate pixelbounds specified");
                }
            }

            double rrThreshold   = paramSet.FindOneDouble("rrthreshold", 1.0);
            string lightStrategy = paramSet.FindOneString("lightsamplestrategy", "spatial");

            return(new PathIntegrator(maxDepth, camera, sampler, pixelBounds, rrThreshold, lightStrategy));
        }