Search in sources :

Example 1 with RenderZBufferThread

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);
    }
}
Also used : RenderZBufferThread(org.jwildfire.create.tina.render.image.RenderZBufferThread) ArrayList(java.util.ArrayList) PCPoint(org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint) RenderImageThread(org.jwildfire.create.tina.render.image.RenderImageThread) RenderHDRImageThread(org.jwildfire.create.tina.render.image.RenderHDRImageThread) RenderImageSimpleScaledThread(org.jwildfire.create.tina.render.image.RenderImageSimpleScaledThread) RenderImageSimpleThread(org.jwildfire.create.tina.render.image.RenderImageSimpleThread) PostFilterImageThread(org.jwildfire.create.tina.render.image.PostFilterImageThread) RenderZBufferThread(org.jwildfire.create.tina.render.image.RenderZBufferThread)

Aggregations

ArrayList (java.util.ArrayList)1 PCPoint (org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint)1 PostFilterImageThread (org.jwildfire.create.tina.render.image.PostFilterImageThread)1 RenderHDRImageThread (org.jwildfire.create.tina.render.image.RenderHDRImageThread)1 RenderImageSimpleScaledThread (org.jwildfire.create.tina.render.image.RenderImageSimpleScaledThread)1 RenderImageSimpleThread (org.jwildfire.create.tina.render.image.RenderImageSimpleThread)1 RenderImageThread (org.jwildfire.create.tina.render.image.RenderImageThread)1 RenderZBufferThread (org.jwildfire.create.tina.render.image.RenderZBufferThread)1