From 14e4b79170e8b5bb0caf0dd5990c978d57b8f64e Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 12 Apr 2011 11:29:56 +0000 Subject: [PATCH] Changed Camera.setViewPort(float,float,float,float) to not call onViewPortChage 4 times. thanks to Lutherion http://jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/possible-bug-with-viewport-on-camera/#post-124630 git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7235 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/renderer/Camera.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engine/src/core/com/jme3/renderer/Camera.java b/engine/src/core/com/jme3/renderer/Camera.java index 5c019a088..5d354fe0d 100644 --- a/engine/src/core/com/jme3/renderer/Camera.java +++ b/engine/src/core/com/jme3/renderer/Camera.java @@ -207,7 +207,6 @@ public class Camera implements Savable, Cloneable { protected Matrix4f projectionMatrix = new Matrix4f(); protected Matrix4f viewProjectionMatrix = new Matrix4f(); private BoundingBox guiBounding = new BoundingBox(); - /** The camera's name. */ protected String name; @@ -913,10 +912,11 @@ public class Camera implements Savable, Cloneable { * @param top the top boundary of the viewport (default: 1) */ public void setViewPort(float left, float right, float bottom, float top) { - setViewPortLeft(left); - setViewPortRight(right); - setViewPortBottom(bottom); - setViewPortTop(top); + this.viewPortLeft = left; + this.viewPortRight = right; + this.viewPortBottom = bottom; + this.viewPortTop = top; + onViewPortChange(); } /** @@ -983,7 +983,7 @@ public class Camera implements Savable, Cloneable { return rVal; } - + public boolean containsGui(BoundingVolume bound) { return guiBounding.intersects(bound); } @@ -1069,15 +1069,15 @@ public class Camera implements Savable, Cloneable { viewportChanged = true; setGuiBounding(); } - + private void setGuiBounding() { - float sx = width*viewPortLeft; - float ex = width*viewPortRight; - float sy = height*viewPortBottom; - float ey = height*viewPortTop; - float xExtent = (ex-sx)/2; - float yExtent = (ey-sy)/2; - guiBounding.setCenter(new Vector3f(sx+xExtent, sy+yExtent, 0)); + float sx = width * viewPortLeft; + float ex = width * viewPortRight; + float sy = height * viewPortBottom; + float ey = height * viewPortTop; + float xExtent = (ex - sx) / 2; + float yExtent = (ey - sy) / 2; + guiBounding.setCenter(new Vector3f(sx + xExtent, sy + yExtent, 0)); guiBounding.setXExtent(xExtent); guiBounding.setYExtent(yExtent); guiBounding.setZExtent(Float.MAX_VALUE);