use of org.jwildfire.create.tina.render.image.RenderHDRImageThread in project JWildfire by thargor6.
the class FlameRenderer method renderHDRImage.
private void renderHDRImage(SimpleHDRImage pHDRImage) {
if (pHDRImage != null) {
int threadCount = prefs.getTinaRenderThreads();
if (threadCount < 1 || pHDRImage.getImageHeight() < 8 * threadCount) {
threadCount = 1;
}
int rowsPerThread = pHDRImage.getImageHeight() / threadCount;
PostDOFBuffer dofBuffer = flame.getCamDOF() > MathLib.EPSILON && flame.getSolidRenderSettings().isSolidRenderingEnabled() ? new PostDOFBuffer(pHDRImage) : null;
List<RenderHDRImageThread> threads = new ArrayList<>();
for (int i = 0; i < threadCount; i++) {
int startRow = i * rowsPerThread;
int endRow = i < threadCount - 1 ? startRow + rowsPerThread : pHDRImage.getImageHeight();
RenderHDRImageThread thread = new RenderHDRImageThread(flame, logDensityFilter, gammaCorrectionFilter, startRow, endRow, pHDRImage, dofBuffer != null ? new PostDOFCalculator(dofBuffer, flame) : null);
threads.add(thread);
if (threadCount > 1) {
new Thread(thread).start();
} else {
thread.run();
}
}
ThreadTools.waitForThreads(threadCount, threads);
if (dofBuffer != null) {
dofBuffer.renderToImage(pHDRImage);
}
}
}
Aggregations