Exemple #1
0
        public static WhittedIntegrator Create(ParamSet paramSet, Sampler sampler, Camera camera)
        {
            int maxDepth = paramSet.FindOneInt("maxdepth", 5);

            int[]    pb          = paramSet.FindInt("pixelbounds");
            Bounds2I pixelBounds = camera.Film.GetSampleBounds();

            if (pb != null)
            {
                if (pb.Length != 4)
                {
                    //Error("Expected four values for \"pixelbounds\" parameter. Got %d.",
                    //      np);
                }
                else
                {
                    pixelBounds = pixelBounds.Intersect(new Bounds2I(new Point2I(pb[0], pb[2]), new Point2I(pb[1], pb[3])));
                    if (pixelBounds.Area == 0)
                    {
                        //Error("Degenerate \"pixelbounds\" specified.");
                    }
                }
            }
            return(new WhittedIntegrator(maxDepth, camera, sampler, pixelBounds));
        }
Exemple #2
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));
        }