예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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);
     }
 }
예제 #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);
            }
        }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #9
0
 public int FindInt32(string name, int defaultValue)
 {
     return(_geomParams.FindInt32(name, defaultValue));
 }