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));
}
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;
}
Aggregations