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();
}
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);
}
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);
}
}
Aggregations