OSDN Git Service

OrthographicCamera was off by one pixel in both directions.
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 6 Oct 2013 13:10:48 +0000 (15:10 +0200)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 6 Oct 2013 13:10:48 +0000 (15:10 +0200)
#802

gdx/src/com/badlogic/gdx/graphics/OrthographicCamera.java

index e01a88c..5010399 100644 (file)
@@ -33,8 +33,8 @@ public class OrthographicCamera extends Camera {
        }\r
 \r
        /** Constructs a new OrthographicCamera, using the given viewport width and height. For pixel perfect 2D rendering just supply\r
-        * the screen size, for other unit scales (e.g. meters for box2d) proceed accordingly. The camera will show the region [-viewportWidth/2, -viewportHeight / 2]- [viewportWidth/2, viewportHeight/2]\r
-        * \r
+        * the screen size, for other unit scales (e.g. meters for box2d) proceed accordingly. The camera will show the region\r
+        * [-viewportWidth/2, -(viewportHeight/2-1)] - [(viewportWidth/2-1), viewportHeight/2]\r
         * @param viewportWidth the viewport width\r
         * @param viewportHeight the viewport height */\r
        public OrthographicCamera (float viewportWidth, float viewportHeight) {\r
@@ -45,8 +45,7 @@ public class OrthographicCamera extends Camera {
        }\r
 \r
        /** Constructs a new OrthographicCamera, using the given viewport width and height. This will create a camera useable for\r
-        * iso-metric views. The diamond angle is specifies the angle of a tile viewed isometrically. \r
-        * \r
+        * iso-metric views. The diamond angle is specifies the angle of a tile viewed isometrically.\r
         * @param viewportWidth the viewport width\r
         * @param viewportHeight the viewport height\r
         * @param diamondAngle the angle in degrees */\r
@@ -113,7 +112,7 @@ public class OrthographicCamera extends Camera {
 \r
        @Override\r
        public void update (boolean updateFrustum) {\r
-               projection.setToOrtho(zoom * -viewportWidth / 2, zoom * viewportWidth / 2, zoom * -viewportHeight / 2, zoom\r
+               projection.setToOrtho(zoom * -viewportWidth / 2, zoom * (viewportWidth / 2 - 1), zoom * -(viewportHeight / 2 - 1), zoom\r
                        * viewportHeight / 2, Math.abs(near), Math.abs(far));\r
                view.setToLookAt(position, tmp.set(position).add(direction), up);\r
                combined.set(projection);\r