Skip to content

Commit 0c3ac7f

Browse files
committed
Clone current camera position
This allows the plugin to be impervious to changes in the SH3D home viewing angle and will ensure all renders are from the same vantage point.
1 parent 866b139 commit 0c3ac7f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/com/shmuelzon/HomeAssistantFloorPlan/Controller.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public enum Renderer {YAFARAY, SUNFLOW}
3939
public enum Quality {HIGH, LOW}
4040

4141
private Home home;
42+
private Camera camera;
4243
private Map<String, List<HomeLight>> lights;
4344
private Map<String, Map<String, List<HomeLight>>> lightsGroups;
4445
private List<String> lightsNames;
@@ -77,6 +78,7 @@ public StateIcon(String name, Point2d position, String type, String action, Stri
7778

7879
public Controller(Home home) {
7980
this.home = home;
81+
camera = home.getCamera().clone();
8082
propertyChangeSupport = new PropertyChangeSupport(this);
8183
lights = getEnabledLights();
8284
lightsGroups = getLightsGroups(lights);
@@ -330,7 +332,6 @@ private List<HomePieceOfFurniture> getHomeAssistantEntities() {
330332
}
331333

332334
private void build3dProjection() {
333-
Camera camera = home.getCamera();
334335
cameraPosition = new Vector4d(camera.getX(), camera.getZ(), camera.getY(), 0);
335336

336337
Transform3D yawRotation = new Transform3D();
@@ -398,7 +399,7 @@ private BufferedImage renderScene() throws IOException {
398399
rendererToClassName.get(renderer),
399400
home, null, this.quality == Quality.LOW ? AbstractPhotoRenderer.Quality.LOW : AbstractPhotoRenderer.Quality.HIGH);
400401
BufferedImage image = new BufferedImage(renderWidth, renderHeight, BufferedImage.TYPE_INT_RGB);
401-
photoRenderer.render(image, home.getCamera(), null);
402+
photoRenderer.render(image, camera, null);
402403

403404
return image;
404405
}

0 commit comments

Comments
 (0)