Search in sources :

Example 26 with RenderInfo

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

the class IFlamesController method refreshBaseFlamePreview.

private void refreshBaseFlamePreview() {
    FlamePanel imgPanel = getBaseFlamePreviewPanel();
    Rectangle bounds = imgPanel.getImageBounds();
    int width = bounds.width;
    int height = bounds.height;
    if (width >= 16 && height >= 16) {
        RenderInfo info = new RenderInfo(width, height, RenderMode.PREVIEW);
        Flame flame = getBaseFlame();
        if (flame != null) {
            double oldSpatialFilterRadius = flame.getSpatialFilterRadius();
            double oldSampleDensity = flame.getSampleDensity();
            try {
                double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
                double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
                flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
                flame.setWidth(info.getImageWidth());
                flame.setHeight(info.getImageHeight());
                FlameRenderer renderer = new FlameRenderer(flame, prefs, false, false);
                renderer.setProgressUpdater(null);
                flame.setSampleDensity(1.0);
                flame.setSpatialFilterRadius(0.0);
                RenderedFlame res = renderer.renderFlame(info);
                imgPanel.setImage(res.getImage());
            } finally {
                flame.setSpatialFilterRadius(oldSpatialFilterRadius);
                flame.setSampleDensity(oldSampleDensity);
            }
        } else {
            imgPanel.setImage(new SimpleImage(width, height));
        }
    } else {
        imgPanel.setImage(new SimpleImage(width, height));
    }
    baseFlamePreviewRootPnl.repaint();
}
Also used : SimpleImage(org.jwildfire.image.SimpleImage) Rectangle(java.awt.Rectangle) FlamePanel(org.jwildfire.create.tina.swing.flamepanel.FlamePanel) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 27 with RenderInfo

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

the class RenderPointCloudThread method doRender.

@Override
protected void doRender() {
    renderer = new FlameRenderer(flame, prefs, flame.isBGTransparency(), false);
    renderer.setProgressUpdater(progressUpdater);
    renderer = new FlameRenderer(flame, prefs, flame.isBGTransparency(), false);
    int width = renderWidth;
    int height = renderHeight;
    RenderInfo info = new RenderInfo(width, height, RenderMode.PRODUCTION);
    double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
    double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
    flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
    flame.setWidth(info.getImageWidth());
    flame.setHeight(info.getImageHeight());
    flame.setSampleDensity(quality);
    renderer.setProgressUpdater(progressUpdater);
    PointCloudRenderInfo renderInfo = new PointCloudRenderInfo(renderWidth, renderHeight, RenderMode.PRODUCTION, zmin, zmax, maxOctreeCellSize);
    renderer.renderPointCloud(renderInfo, outFilePattern);
}
Also used : PointCloudRenderInfo(org.jwildfire.create.tina.render.PointCloudRenderInfo) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) PointCloudRenderInfo(org.jwildfire.create.tina.render.PointCloudRenderInfo) RenderInfo(org.jwildfire.create.tina.render.RenderInfo)

Example 28 with RenderInfo

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

the class TinaInteractiveRendererController method renderButton_clicked.

public void renderButton_clicked() {
    try {
        clearScreen();
        ResolutionProfile resProfile = getResolutionProfile();
        int width = resProfile.getWidth();
        int height = resProfile.getHeight();
        if (quarterSizeButton.isSelected()) {
            width /= 4;
            height /= 4;
        } else if (halveSizeButton.isSelected()) {
            width /= 2;
            height /= 2;
        }
        RenderInfo info = new RenderInfo(width, height, RenderMode.INTERACTIVE);
        Flame flame = getCurrFlame();
        if (!Stereo3dMode.NONE.equals(flame.getStereo3dMode())) {
            throw new Exception("Stereo3d-rendering isn't currently supported in the interactive-renderer. Please use the editor or the batch-renderer to create stereo3d-images");
        }
        double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
        double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
        flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
        flame.setWidth(info.getImageWidth());
        flame.setHeight(info.getImageHeight());
        flame.setSampleDensity(10);
        info.setRenderHDR(prefs.isTinaSaveHDRInIR());
        info.setRenderZBuffer(false);
        if (flame.getBgColorRed() > 0 || flame.getBgColorGreen() > 0 || flame.getBgColorBlue() > 0) {
            image.fillBackground(flame.getBgColorRed(), flame.getBgColorGreen(), flame.getBgColorBlue());
        }
        renderer = new FlameRenderer(flame, prefs, flame.isBGTransparency(), false);
        renderer.registerIterationObserver(this);
        displayUpdater = createDisplayUpdater();
        renderStartTime = System.currentTimeMillis();
        pausedRenderTime = 0;
        lastQuality = 0.0;
        lastQualitySpeed = 0.0;
        lastQualityTime = 0;
        displayUpdater.initRender(prefs.getTinaRenderThreads());
        threads = renderer.startRenderFlame(info);
        for (Thread t : threads.getExecutingThreads()) {
            t.setPriority(Thread.MIN_PRIORITY);
        }
        updateDisplayThread = new UpdateDisplayThread();
        startRenderThread(updateDisplayThread);
        state = State.RENDER;
        enableControls();
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) XYZProjectedPoint(org.jwildfire.create.tina.base.XYZProjectedPoint) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) AbstractRenderThread(org.jwildfire.create.tina.render.AbstractRenderThread)

Aggregations

FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)28 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)28 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)24 Flame (org.jwildfire.create.tina.base.Flame)21 SimpleImage (org.jwildfire.image.SimpleImage)12 Rectangle (java.awt.Rectangle)10 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)9 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)4 DrawFocusPointFlameRenderer (org.jwildfire.create.tina.render.DrawFocusPointFlameRenderer)4 ImageIcon (javax.swing.ImageIcon)3 FlameReader (org.jwildfire.create.tina.io.FlameReader)3 AbstractRenderThread (org.jwildfire.create.tina.render.AbstractRenderThread)3 FlamePanelConfig (org.jwildfire.create.tina.swing.flamepanel.FlamePanelConfig)3 Layer (org.jwildfire.create.tina.base.Layer)2 FlameBGColorHandler (org.jwildfire.create.tina.render.FlameBGColorHandler)2 ImageWriter (org.jwildfire.io.ImageWriter)2 TextTransformer (org.jwildfire.transform.TextTransformer)2 Color (java.awt.Color)1 Point (java.awt.Point)1 File (java.io.File)1