Search in sources :

Example 1 with Options

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

Example 2 with Options

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

Aggregations

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