Search in sources :

Example 1 with Tesselatable

use of org.sunflow.core.Tesselatable in project joons-renderer by joonhyublee.

the class SunflowAPI method geometry.

@Override
public final void geometry(String name, String typeName) {
    if (!isIncremental(typeName)) {
        // we are declaring a geometry for the first time
        if (renderObjects.has(name)) {
            UI.printError(Module.API, "Unable to declare geometry \"%s\", name is already in use", name);
            parameterList.clear(true);
            return;
        }
        // check tesselatable first
        if (PluginRegistry.tesselatablePlugins.hasType(typeName)) {
            Tesselatable tesselatable = PluginRegistry.tesselatablePlugins.createObject(typeName);
            if (tesselatable == null) {
                UI.printError(Module.API, "Unable to create tesselatable object of type \"%s\"", typeName);
                return;
            }
            renderObjects.put(name, tesselatable);
        } else {
            PrimitiveList primitives = PluginRegistry.primitivePlugins.createObject(typeName);
            if (primitives == null) {
                UI.printError(Module.API, "Unable to create primitive of type \"%s\"", typeName);
                return;
            }
            renderObjects.put(name, primitives);
        }
    }
    if (lookupGeometry(name) != null) {
        update(name);
    } else {
        UI.printError(Module.API, "Unable to update geometry \"%s\" - geometry object was not found", name);
        parameterList.clear(true);
    }
}
Also used : PrimitiveList(org.sunflow.core.PrimitiveList) Tesselatable(org.sunflow.core.Tesselatable)

Aggregations

PrimitiveList (org.sunflow.core.PrimitiveList)1 Tesselatable (org.sunflow.core.Tesselatable)1