use of org.jwildfire.create.tina.base.raster.PointCloudPLYWriter in project JWildfire by thargor6.
the class FlameRenderer method renderPointCloud.
public void renderPointCloud(PointCloudRenderInfo pPointCloudRenderInfo, String pFilename) {
if (!flame.isRenderable())
throw new RuntimeException("Point clouds can not be created of empty flames");
renderInfo = pPointCloudRenderInfo.createRenderInfo();
progressDisplayPhaseCount = 1;
progressDisplayPhase = 0;
double zmin = pPointCloudRenderInfo.getZmin() < pPointCloudRenderInfo.getZmax() ? pPointCloudRenderInfo.getZmin() : pPointCloudRenderInfo.getZmax();
double zmax = pPointCloudRenderInfo.getZmin() < pPointCloudRenderInfo.getZmax() ? pPointCloudRenderInfo.getZmax() : pPointCloudRenderInfo.getZmin();
Flame currFlame = flame.makeCopy();
prepareFlameForPointCloudRendering(currFlame);
initRasterSizes(pPointCloudRenderInfo.getImageWidth(), pPointCloudRenderInfo.getImageHeight());
RasterPointCloud pcraster = new RasterPointCloud(zmin, zmax, pPointCloudRenderInfo.getMaxOctreeCellSize());
raster = pcraster;
raster.allocRaster(flame, rasterWidth, rasterHeight, flame.getSpatialOversampling(), flame.getSampleDensity());
List<List<RenderPacket>> renderFlames = new ArrayList<List<RenderPacket>>();
for (int t = 0; t < prefs.getTinaRenderThreads(); t++) {
renderFlames.add(createRenderPackets(flame, flame.getFrame()));
}
iterate(0, 1, renderFlames, null);
raster.finalizeRaster();
List<PCPoint> points = pcraster.getGeneratedPoints();
if (points != null && !points.isEmpty()) {
if (Tools.getFileExt(pFilename).isEmpty()) {
pFilename = pFilename + "." + Tools.FILEEXT_PLY;
}
if (Tools.FILEEXT_PLY.equalsIgnoreCase(Tools.getFileExt(pFilename))) {
new PointCloudPLYWriter().writePLY(points, pFilename);
} else if (Tools.FILEEXT_OBJ.equalsIgnoreCase(Tools.getFileExt(pFilename))) {
new PointCloudOBJWriter().writeOBJ(points, pFilename);
} else {
throw new RuntimeException("Unvalid file extension <" + Tools.getFileExt(pFilename) + ">");
}
}
}
Aggregations