Search in sources :

Example 1 with ImageSampler

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);
}
Also used : Options(org.sunflow.core.Options) Instance(org.sunflow.core.Instance) ImageSampler(org.sunflow.core.ImageSampler) Shader(org.sunflow.core.Shader)

Aggregations

ImageSampler (org.sunflow.core.ImageSampler)1 Instance (org.sunflow.core.Instance)1 Options (org.sunflow.core.Options)1 Shader (org.sunflow.core.Shader)1