use of org.jwildfire.create.tina.render.image.RenderZBufferThread in project JWildfire by thargor6.
the class FlameRenderer method renderZBuffer.
private void renderZBuffer(SimpleGrayImage pGreyImage) {
double zScale = 0.001 * flame.getZBufferScale();
if (pGreyImage != null) {
int threadCount = prefs.getTinaRenderThreads();
if (threadCount < 1 || pGreyImage.getImageHeight() < 8 * threadCount) {
threadCount = 1;
}
int rowsPerThread = pGreyImage.getImageHeight() / threadCount;
List<RenderZBufferThread> threads = new ArrayList<>();
for (int i = 0; i < threadCount; i++) {
int startRow = i * rowsPerThread;
int endRow = i < threadCount - 1 ? startRow + rowsPerThread : pGreyImage.getImageHeight();
RenderZBufferThread thread = new RenderZBufferThread(flame, logDensityFilter, startRow, endRow, pGreyImage, zScale);
threads.add(thread);
if (threadCount > 1) {
new Thread(thread).start();
} else {
thread.run();
}
}
ThreadTools.waitForThreads(threadCount, threads);
}
}
Aggregations