/** * Render using the specified options and the specified display. If the * specified options do not exist - defaults will be used. * * @param optionsName name of the {@link RenderObject} which contains the * options * @param display display object */ public void render(string optionsName, IDisplay display) { if (string.IsNullOrEmpty(optionsName)) { optionsName = "::options"; } renderObjects.updateScene(scene); Options opt = lookupOptions(optionsName); if (opt == null) { opt = new Options(); } scene.setCamera(lookupCamera(opt.getstring("camera", null))); // baking string bakingInstanceName = opt.getstring("baking.instance", null); if (bakingInstanceName != null) { Instance bakingInstance = lookupInstance(bakingInstanceName); if (bakingInstance == null) { UI.printError(UI.Module.API, "Unable to bake instance \"{0}\" - not found", bakingInstanceName); return; } scene.setBakingInstance(bakingInstance); } else { scene.setBakingInstance(null); } string samplerName = opt.getstring("sampler", "bucket"); ImageSampler sampler = null; if (samplerName == "none" || samplerName == "null") { sampler = null; } else if (samplerName == "bucket") { sampler = bucketRenderer; } else if (samplerName == "ipr") { sampler = progressiveRenderer; } else if (samplerName == "fast") { sampler = new SimpleRenderer(); } else { UI.printError(UI.Module.API, "Unknown sampler type: {0} - aborting", samplerName); return; } scene.render(opt, sampler, display); }
/** * Render using the specified options and the specified display. If the * specified options do not exist - defaults will be used. * * @param optionsName name of the {@link RenderObject} which contains the * options * @param display display object */ public void render(string optionsName, IDisplay display) { if (string.IsNullOrEmpty(optionsName)) { optionsName = "::options"; } renderObjects.updateScene(scene); Options opt = lookupOptions(optionsName); if (opt == null) { opt = new Options(); } scene.setCamera(lookupCamera(opt.getstring("camera", null))); // shader override String shaderOverrideName = opt.getstring("override.shader", "none"); bool overridePhotons = opt.getbool("override.photons", false); if (shaderOverrideName.Equals("none")) { scene.setShaderOverride(null, false); } else { IShader shader = lookupShader(shaderOverrideName); if (shader == null) { UI.printWarning(UI.Module.API, "Unable to find shader \"{0}\" for override, disabling", shaderOverrideName); } scene.setShaderOverride(shader, overridePhotons); } // baking string bakingInstanceName = opt.getstring("baking.instance", null); if (bakingInstanceName != null) { Instance bakingInstance = lookupInstance(bakingInstanceName); if (bakingInstance == null) { UI.printError(UI.Module.API, "Unable to bake instance \"{0}\" - not found", bakingInstanceName); return; } scene.setBakingInstance(bakingInstance); } else { scene.setBakingInstance(null); } ImageSampler sampler = PluginRegistry.imageSamplerPlugins.createObject(opt.getstring("sampler", "bucket")); scene.render(opt, sampler, display); }