Search in sources :

Example 31 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer 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 32 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer 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 33 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer 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)

Example 34 with FlameRenderer

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

the class FlamePanel method getFlameRenderer.

private FlameRenderer getFlameRenderer() {
    if (flameRenderer == null) {
        Flame flame = flameHolder.getFlame();
        if (flame == null) {
            throw new IllegalStateException();
        }
        flameRenderer = new FlameRenderer(flame, prefs, withShowTransparency, false);
    }
    return flameRenderer;
}
Also used : FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) Flame(org.jwildfire.create.tina.base.Flame)

Aggregations

FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)34 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)28 Flame (org.jwildfire.create.tina.base.Flame)27 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)25 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)5 Test (org.junit.Test)4 XForm (org.jwildfire.create.tina.base.XForm)4 XYZPoint (org.jwildfire.create.tina.base.XYZPoint)4 ZigguratRandomGenerator (org.jwildfire.create.tina.random.ZigguratRandomGenerator)4 AbstractRenderThread (org.jwildfire.create.tina.render.AbstractRenderThread)4 DrawFocusPointFlameRenderer (org.jwildfire.create.tina.render.DrawFocusPointFlameRenderer)4 ImageIcon (javax.swing.ImageIcon)3 FlameReader (org.jwildfire.create.tina.io.FlameReader)3 FlamePanelConfig (org.jwildfire.create.tina.swing.flamepanel.FlamePanelConfig)3 File (java.io.File)2 ResolutionProfile (org.jwildfire.base.ResolutionProfile)2 Layer (org.jwildfire.create.tina.base.Layer)2