use of org.sunflow.core.Options 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);
}
use of org.sunflow.core.Options in project joons-renderer by joonhyublee.
the class SunflowAPI method options.
@Override
public final void options(String name) {
if (lookupOptions(name) == null) {
if (renderObjects.has(name)) {
UI.printError(Module.API, "Unable to declare options \"%s\", name is already in use", name);
parameterList.clear(true);
return;
}
renderObjects.put(name, new Options());
}
assert lookupOptions(name) != null;
update(name);
}
Aggregations