public static Film MakeFilm(PbrtOptions options, string name, ParamSet paramSet, Filter filter) { Film film = null; switch (name) { case "image": film = Film.Create(options, paramSet, filter); break; default: //Warning("Film \"%s\" unknown.", name.c_str()); break; } paramSet.ReportUnused(); return(film); }
public static Primitive MakeAccelerator(string name, IEnumerable <Primitive> prims, ParamSet paramSet) { Primitive accel = null; switch (name) { case "bvh": accel = BvhAccelerator.Create(prims, paramSet); break; //case "kdtree": // accel = CreateKdTreeAccelerator(prims, paramSet); // break; default: //Warning("Accelerator \"%s\" unknown.", name.c_str()); break; } paramSet.ReportUnused(); return(accel); }
public static Film Create(PbrtOptions options, ParamSet paramSet, Filter filter) { string filename; if (options.ImageFile != "") { filename = options.ImageFile; string paramsFilename = paramSet.FindOneString("filename", ""); if (paramsFilename != "") { //Warning( // "Output filename supplied on command line, \"%s\" is overriding filename provided in scene description file, \"%s\".", //PbrtOptions.imageFile.c_str(), paramsFilename.c_str()); } } else { filename = paramSet.FindOneString("filename", "pbrt.exr"); } int xres = paramSet.FindOneInt("xresolution", 1280); int yres = paramSet.FindOneInt("yresolution", 720); if (options.QuickRender) { xres = Math.Max(1, xres / 4); } if (options.QuickRender) { yres = Math.Max(1, yres / 4); } Bounds2D crop; int cwi; double[] cr = paramSet.FindFloat("cropwindow"); if (cr != null && cr.Length == 4) { double minx = PbrtMath.Clamp(Math.Min(cr[0], cr[1]), 0.0, 1.0); double maxx = PbrtMath.Clamp(Math.Max(cr[0], cr[1]), 0.0, 1.0); double miny = PbrtMath.Clamp(Math.Min(cr[2], cr[3]), 0.0, 1.0); double maxy = PbrtMath.Clamp(Math.Max(cr[2], cr[3]), 0.0, 1.0); crop = new Bounds2D(new Point2D(minx, miny), new Point2D(maxx, maxy)); } else if (cr != null) { throw new InvalidOperationException(); //Error("%d values supplied for \"cropwindow\". Expected 4.", cwi); } else { crop = new Bounds2D(new Point2D(PbrtMath.Clamp(options.CropWindow[0, 0], 0.0, 1.0), PbrtMath.Clamp(options.CropWindow[1, 0], 0.0, 1.0)), new Point2D(PbrtMath.Clamp(options.CropWindow[0, 1], 0.0, 1.0), PbrtMath.Clamp(options.CropWindow[1, 1], 0.0, 1.0))); } double scale = paramSet.FindOneFloat("scale", 1.0); double diagonal = paramSet.FindOneFloat("diagonal", 35.0); double maxSampleLuminance = paramSet.FindOneFloat("maxsampleluminance", double.PositiveInfinity); return(new Film(new Point2I(xres, yres), crop, filter, diagonal, filename, scale, maxSampleLuminance)); }