|
Posted by Puybaret
at Feb 3, 2012, 9:25:05 AM
|
Re: Server Side
Nice project!
1. Is it possible to automatically save the rendered photo into a predefined directory on the server (instead of locally on computer)? No, please submit a feature request. Meanwhile if you're able to program, you could inspire yourself from PhotoPanel class and the one below.
2. Is it possible to implement Server Side Rendering of high quality photos? Even if the renderer at the highest quality level doesn't use OpenGL to compute the 3D image, Sweet Home 3D needs Java 3D classes to store the 3D scene. And as soon as you use a Java 3D class in a 3D scene, you're obliged to have at least an opened X11 display if the server is under Linux (on other OS there should be less problem). I guess it's only to check if the display is available in case of need, but as I never tested it myself if there would be other requirements under Linux, I can't tell. If needed, you could test on a server with the following application:
/* * ConsolePhotoGenerator.java * * Sweet Home 3D, Copyright (c) 2010 Emmanuel PUYBARET / eTeks <[email protected]> * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA */ package com.eteks.sweethome3d.utilities;
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.sunflow.system.UI; import org.sunflow.system.ui.ConsoleInterface; import com.eteks.sweethome3d.io.HomeFileRecorder; import com.eteks.sweethome3d.j3d.PhotoRenderer; import com.eteks.sweethome3d.model.Home; import com.eteks.sweethome3d.model.HomeEnvironment; import com.eteks.sweethome3d.model.RecorderException;
/** * Sweet Home 3D Console photo generator. * @author Emmanuel Puybaret */ public class ConsolePhotoGenerator { public static void main(final String [] args) throws RecorderException, IOException { String homeFile = args [0]; String homePhoto = args [1]; Home home = new HomeFileRecorder().readHome(homeFile); HomeEnvironment environment = home.getEnvironment(); PhotoRenderer renderer = new PhotoRenderer(home, environment.getPhotoQuality() == 3 ? PhotoRenderer.Quality.HIGH : PhotoRenderer.Quality.LOW); UI.set(new ConsoleInterface()); BufferedImage image = new BufferedImage( environment.getPhotoWidth(), environment.getPhotoHeight(), BufferedImage.TYPE_INT_ARGB); renderer.render(image, home.getCamera(), null); ImageIO.write(image, homePhoto.substring(homePhoto.lastIndexOf('.') + 1), new File(homePhoto)); } }
By the way, don't forget that Sweet Home 3D is distributed under GNU GPL which doesn't give you the freedom to distribute a derived version under a proprietary license. In this is a problem, please contact me and we'll see how to fix this issue.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
|