Search in sources :

Example 1 with PostDOFCalculator

use of org.jwildfire.create.tina.render.postdof.PostDOFCalculator 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);
        }
    }
}
Also used : PostDOFBuffer(org.jwildfire.create.tina.render.postdof.PostDOFBuffer) ArrayList(java.util.ArrayList) RenderHDRImageThread(org.jwildfire.create.tina.render.image.RenderHDRImageThread) PCPoint(org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint) PostDOFCalculator(org.jwildfire.create.tina.render.postdof.PostDOFCalculator) 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)

Example 2 with PostDOFCalculator

use of org.jwildfire.create.tina.render.postdof.PostDOFCalculator in project JWildfire by thargor6.

the class FlameRenderer method renderImage.

private void renderImage(SimpleImage pImage) {
    if (pImage != null) {
        int threadCount = prefs.getTinaRenderThreads();
        if (threadCount < 1 || pImage.getImageHeight() < 8 * threadCount) {
            threadCount = 1;
        }
        PostDOFBuffer dofBuffer = flame.getCamDOF() > MathLib.EPSILON && flame.getSolidRenderSettings().isSolidRenderingEnabled() ? new PostDOFBuffer(pImage) : null;
        int rowsPerThread = pImage.getImageHeight() / threadCount;
        List<RenderImageThread> threads = new ArrayList<RenderImageThread>();
        for (int i = 0; i < threadCount; i++) {
            int startRow = i * rowsPerThread;
            int endRow = i < threadCount - 1 ? startRow + rowsPerThread : pImage.getImageHeight();
            RenderImageThread thread = new RenderImageThread(flame, logDensityFilter, gammaCorrectionFilter, startRow, endRow, pImage, 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(pImage);
        }
    }
}
Also used : PostDOFBuffer(org.jwildfire.create.tina.render.postdof.PostDOFBuffer) RenderImageThread(org.jwildfire.create.tina.render.image.RenderImageThread) ArrayList(java.util.ArrayList) PCPoint(org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint) PostDOFCalculator(org.jwildfire.create.tina.render.postdof.PostDOFCalculator) 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)2 PCPoint (org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint)2 PostFilterImageThread (org.jwildfire.create.tina.render.image.PostFilterImageThread)2 RenderHDRImageThread (org.jwildfire.create.tina.render.image.RenderHDRImageThread)2 RenderImageSimpleScaledThread (org.jwildfire.create.tina.render.image.RenderImageSimpleScaledThread)2 RenderImageSimpleThread (org.jwildfire.create.tina.render.image.RenderImageSimpleThread)2 RenderImageThread (org.jwildfire.create.tina.render.image.RenderImageThread)2 RenderZBufferThread (org.jwildfire.create.tina.render.image.RenderZBufferThread)2 PostDOFBuffer (org.jwildfire.create.tina.render.postdof.PostDOFBuffer)2 PostDOFCalculator (org.jwildfire.create.tina.render.postdof.PostDOFCalculator)2