use of org.sunflow.core.ImageSampler in project joons-renderer by joonhyublee.
the class SunflowAPI method render.
@Override
public final void render(String optionsName, Display display) {
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");
boolean overridePhotons = opt.getBoolean("override.photons", false);
if (shaderOverrideName.equals("none")) {
scene.setShaderOverride(null, false);
} else {
Shader shader = lookupShader(shaderOverrideName);
if (shader == null) {
UI.printWarning(Module.API, "Unable to find shader \"%s\" 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(Module.API, "Unable to bake instance \"%s\" - 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);
}
Aggregations