Example #1
0
        public static Sampler MakeSampler(string name, ParamSet parameters, Film film, Camera camera)
        {
            switch (name)
            {
            case "stratified":
            {
                var jitter       = parameters.FindBoolean("jitter", true);
                var xSamples     = parameters.FindInt32("xsamples", 2);
                var ySamples     = parameters.FindInt32("ysamples", 2);
                var sampleExtent = film.SampleExtent;
                return(new StratifiedSampler(sampleExtent, xSamples, ySamples, jitter,
                                             camera.ShutterOpen, camera.ShutterClose));
            }

            default:
                throw new ArgumentException("Unknown sampler: " + name);
            }
        }
Example #2
0
        public static Film MakeFilm(string name, ParamSet parameters, Filter filter)
        {
            switch (name)
            {
            case "image":
            {
                var xres       = parameters.FindInt32("xresolution", 640);
                var yres       = parameters.FindInt32("yresolution", 480);
                var cropWindow = parameters.FindSingleList("cropwindow");
                if (cropWindow.Length == 0)
                {
                    cropWindow = new float[] { 0, 1, 0, 1 }
                }
                ;
                return(new ImageFilm(xres, yres, filter, cropWindow));
            }

            default:
                throw new ArgumentException("Unknown film: " + name);
            }
        }
Example #3
0
        public static SurfaceIntegrator MakeSurfaceIntegrator(string name, ParamSet parameters)
        {
            switch (name)
            {
            case "whitted":
            {
                var maxDepth = parameters.FindInt32("maxdepth", 5);
                return(new WhittedIntegrator(maxDepth));
            }

            default:
                throw new ArgumentException("Unknown surface integrator: " + name);
            }
        }
Example #4
0
 public static AreaLight MakeAreaLight(string name, Transform lightToWorld,
     ParamSet parameters, Shape shape)
 {
     switch (name)
     {
         case "area":
         case "diffuse":
         {
             var l = parameters.FindSpectrum("L", new Spectrum(1.0f));
             var scale = parameters.FindSpectrum("scale", new Spectrum(1.0f));
             var numSamples = parameters.FindInt32("nsamples", 1);
             return new DiffuseAreaLight(lightToWorld, l * scale, numSamples, shape);
         }
         default:
             throw new ArgumentException("Unknown area light: " + name);
     }
 }
Example #5
0
        public static AreaLight MakeAreaLight(string name, Transform lightToWorld,
                                              ParamSet parameters, Shape shape)
        {
            switch (name)
            {
            case "area":
            case "diffuse":
            {
                var l          = parameters.FindSpectrum("L", new Spectrum(1.0f));
                var scale      = parameters.FindSpectrum("scale", new Spectrum(1.0f));
                var numSamples = parameters.FindInt32("nsamples", 1);
                return(new DiffuseAreaLight(lightToWorld, l * scale, numSamples, shape));
            }

            default:
                throw new ArgumentException("Unknown area light: " + name);
            }
        }
Example #6
0
 public static Film MakeFilm(string name, ParamSet parameters, Filter filter)
 {
     switch (name)
     {
         case "image" :
         {
             var xres = parameters.FindInt32("xresolution", 640);
             var yres = parameters.FindInt32("yresolution", 480);
             var cropWindow = parameters.FindSingleList("cropwindow");
             if (cropWindow.Length == 0)
                 cropWindow = new float[] { 0, 1, 0, 1 };
             return new ImageFilm(xres, yres, filter, cropWindow);
         }
         default:
             throw new ArgumentException("Unknown film: " + name);
     }
 }
Example #7
0
 public static SurfaceIntegrator MakeSurfaceIntegrator(string name, ParamSet parameters)
 {
     switch (name)
     {
         case "whitted":
         {
             var maxDepth = parameters.FindInt32("maxdepth", 5);
             return new WhittedIntegrator(maxDepth);
             }
         default:
             throw new ArgumentException("Unknown surface integrator: " + name);
     }
 }
Example #8
0
 public static Sampler MakeSampler(string name, ParamSet parameters, Film film, Camera camera)
 {
     switch (name)
     {
         case "stratified":
         {
             var jitter = parameters.FindBoolean("jitter", true);
             var xSamples = parameters.FindInt32("xsamples", 2);
             var ySamples = parameters.FindInt32("ysamples", 2);
             var sampleExtent = film.SampleExtent;
             return new StratifiedSampler(sampleExtent, xSamples, ySamples, jitter, 
                 camera.ShutterOpen, camera.ShutterClose);
             }
         default:
             throw new ArgumentException("Unknown sampler: " + name);
     }
 }
Example #9
0
 public int FindInt32(string name, int defaultValue)
 {
     return(_geomParams.FindInt32(name, defaultValue));
 }