Search in sources :

Example 16 with Timer

use of org.sunflow.system.Timer in project joons-renderer by joonhyublee.

the class BoundingIntervalHierarchy method build.

@Override
public void build(PrimitiveList primitives) {
    this.primitives = primitives;
    int n = primitives.getNumPrimitives();
    UI.printDetailed(Module.ACCEL, "Getting bounding box ...");
    bounds = primitives.getWorldBounds(null);
    objects = new int[n];
    for (int i = 0; i < n; i++) {
        objects[i] = i;
    }
    UI.printDetailed(Module.ACCEL, "Creating tree ...");
    int initialSize = 3 * (2 * 6 * n + 1);
    IntArray tempTree = new IntArray((initialSize + 3) / 4);
    BuildStats stats = new BuildStats();
    Timer t = new Timer();
    t.start();
    buildHierarchy(tempTree, objects, stats);
    t.end();
    UI.printDetailed(Module.ACCEL, "Trimming tree ...");
    tree = tempTree.trim();
    // display stats
    stats.printStats();
    UI.printDetailed(Module.ACCEL, "  * Creation time:  %s", t);
    UI.printDetailed(Module.ACCEL, "  * Usage of init:  %6.2f%%", (double) (100.0 * tree.length) / initialSize);
    UI.printDetailed(Module.ACCEL, "  * Tree memory:    %s", Memory.sizeof(tree));
    UI.printDetailed(Module.ACCEL, "  * Indices memory: %s", Memory.sizeof(objects));
}
Also used : IntArray(org.sunflow.util.IntArray) Timer(org.sunflow.system.Timer)

Example 17 with Timer

use of org.sunflow.system.Timer in project joons-renderer by joonhyublee.

the class LightServer method build.

boolean build(Options options) {
    // read options
    maxDiffuseDepth = options.getInt("depths.diffuse", maxDiffuseDepth);
    maxReflectionDepth = options.getInt("depths.reflection", maxReflectionDepth);
    maxRefractionDepth = options.getInt("depths.refraction", maxRefractionDepth);
    String giEngineType = options.getString("gi.engine", null);
    giEngine = PluginRegistry.giEnginePlugins.createObject(giEngineType);
    String caustics = options.getString("caustics", null);
    causticPhotonMap = PluginRegistry.causticPhotonMapPlugins.createObject(caustics);
    // validate options
    maxDiffuseDepth = Math.max(0, maxDiffuseDepth);
    maxReflectionDepth = Math.max(0, maxReflectionDepth);
    maxRefractionDepth = Math.max(0, maxRefractionDepth);
    Timer t = new Timer();
    t.start();
    // count total number of light samples
    int numLightSamples = 0;
    for (int i = 0; i < lights.length; i++) {
        numLightSamples += lights[i].getNumSamples();
    }
    // initialize gi engine
    if (giEngine != null) {
        if (!giEngine.init(options, scene)) {
            return false;
        }
    }
    if (!calculatePhotons(causticPhotonMap, "caustic", 0, options)) {
        return false;
    }
    t.end();
    UI.printInfo(Module.LIGHT, "Light Server stats:");
    UI.printInfo(Module.LIGHT, "  * Light sources found: %d", lights.length);
    UI.printInfo(Module.LIGHT, "  * Light samples:       %d", numLightSamples);
    UI.printInfo(Module.LIGHT, "  * Max raytrace depth:");
    UI.printInfo(Module.LIGHT, "      - Diffuse          %d", maxDiffuseDepth);
    UI.printInfo(Module.LIGHT, "      - Reflection       %d", maxReflectionDepth);
    UI.printInfo(Module.LIGHT, "      - Refraction       %d", maxRefractionDepth);
    UI.printInfo(Module.LIGHT, "  * GI engine            %s", giEngineType == null ? "none" : giEngineType);
    UI.printInfo(Module.LIGHT, "  * Caustics:            %s", caustics == null ? "none" : caustics);
    UI.printInfo(Module.LIGHT, "  * Shader override:     %b", shaderOverride);
    UI.printInfo(Module.LIGHT, "  * Photon override:     %b", shaderOverridePhotons);
    UI.printInfo(Module.LIGHT, "  * Build time:          %s", t.toString());
    return true;
}
Also used : Timer(org.sunflow.system.Timer)

Aggregations

Timer (org.sunflow.system.Timer)17 IOException (java.io.IOException)6 File (java.io.File)4 IntArray (org.sunflow.util.IntArray)3 FileNotFoundException (java.io.FileNotFoundException)2 CompileException (org.codehaus.janino.CompileException)2 ParseException (org.codehaus.janino.Parser.ParseException)2 Scanner (org.codehaus.janino.Scanner)2 ScanException (org.codehaus.janino.Scanner.ScanException)2 Color (org.sunflow.image.Color)2 Vector3 (org.sunflow.math.Vector3)2 PropertyVetoException (java.beans.PropertyVetoException)1 EOFException (java.io.EOFException)1 FileInputStream (java.io.FileInputStream)1 FileWriter (java.io.FileWriter)1 StringReader (java.io.StringReader)1 SceneParser (org.sunflow.core.SceneParser)1 ColorSpecificationException (org.sunflow.image.ColorFactory.ColorSpecificationException)1 BoundingBox (org.sunflow.math.BoundingBox)1 Point3 (org.sunflow.math.Point3)1