OSDN Git Service

Formatting, javadoc.
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 1 Sep 2013 21:06:18 +0000 (23:06 +0200)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 1 Sep 2013 21:07:12 +0000 (23:07 +0200)
gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java
gdx/src/com/badlogic/gdx/math/Intersector.java
gdx/src/com/badlogic/gdx/math/Polygon.java

index c41aedc..d697a2d 100644 (file)
@@ -209,27 +209,23 @@ public class ShapeRenderer {
 \r
        /** Draws a line. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. */\r
        public final void line (float x, float y, float z, float x2, float y2, float z2) {\r
-\r
                line(x, y, z, x2, y2, z2, color, color);\r
        }\r
 \r
        /** Draws a line. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. Lazy method that "just" calls the\r
         * "other" method and unpacks the Vector3 for you */\r
        public final void line (Vector3 v0, Vector3 v1) {\r
-\r
                line(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, color, color);\r
        }\r
 \r
        /** Draws a line in the x/y plane. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. */\r
        public final void line (float x, float y, float x2, float y2) {\r
-\r
                line(x, y, 0.0f, x2, y2, 0.0f, color, color);\r
        }\r
 \r
        /** Draws a line. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. Lazy method that "just" calls the\r
         * "other" method and unpacks the Vector2 for you */\r
        public final void line (Vector2 v0, Vector2 v1) {\r
-\r
                line(v0.x, v0.y, 0.0f, v1.x, v1.y, 0.0f, color, color);\r
        }\r
 \r
@@ -238,7 +234,6 @@ public class ShapeRenderer {
         * @param c1 Color at start of the line\r
         * @param c2 Color at end of the line */\r
        public final void line (float x, float y, float x2, float y2, Color c1, Color c2) {\r
-\r
                line(x, y, 0.0f, x2, y2, 0.0f, c1, c2);\r
        }\r
 \r
@@ -838,6 +833,10 @@ public class ShapeRenderer {
                return currType;\r
        }\r
 \r
+       public ImmediateModeRenderer getRenderer () {\r
+               return renderer;\r
+       }\r
+\r
        public void dispose () {\r
                renderer.dispose();\r
        }\r
index f7d5af7..bb0b5db 100644 (file)
@@ -772,7 +772,7 @@ public final class Intersector {
         * 
         * @param p1 The first polygon.
         * @param p2 The second polygon.
-        * @param mtv A Minimum Translation Vector to fill in the case of a collision (optional).
+        * @param mtv A Minimum Translation Vector to fill in the case of a collision, or null (optional).
         * @return Whether polygons overlap. */
        public static boolean overlapConvexPolygons (Polygon p1, Polygon p2, MinimumTranslationVector mtv) {
                return overlapConvexPolygons(p1.getTransformedVertices(), p2.getTransformedVertices(), mtv);
@@ -783,7 +783,7 @@ public final class Intersector {
         * 
         * @param verts1 Vertices of the first polygon.
         * @param verts2 Vertices of the second polygon.
-        * @param mtv A Minimum Translation Vector to fill in the case of a collision (optional).
+        * @param mtv A Minimum Translation Vector to fill in the case of a collision, or null (optional).
         * @return Whether polygons overlap. */
        public static boolean overlapConvexPolygons (float[] verts1, float[] verts2, MinimumTranslationVector mtv) {
                float overlap = Float.MAX_VALUE;
index e92b8ff..7e6ac63 100644 (file)
@@ -16,8 +16,7 @@
 \r
 package com.badlogic.gdx.math;\r
 \r
-/** Encapsulates a 2D polygon defined by it's vertices relative \r
- * to an origin point (default of 0, 0). */\r
+/** Encapsulates a 2D polygon defined by it's vertices relative to an origin point (default of 0, 0). */\r
 public class Polygon {\r
        private float[] localVertices;\r
        private float[] worldVertices;\r
@@ -27,33 +26,30 @@ public class Polygon {
        private float scaleX = 1, scaleY = 1;\r
        private boolean dirty = true;\r
        private Rectangle bounds;\r
-       \r
+\r
        /** Constructs a new polygon with no vertices. */\r
        public Polygon () {\r
                this.localVertices = new float[0];\r
        }\r
 \r
-       /** Constructs a new polygon from a float array of parts of vertex points. \r
+       /** Constructs a new polygon from a float array of parts of vertex points.\r
         * \r
-        * @param vertices an array where every even element represents the horizontal\r
-        * part of a point, and the following element representing the vertical part\r
+        * @param vertices an array where every even element represents the horizontal part of a point, and the following element\r
+        *           representing the vertical part\r
         * \r
-        * @throws IllegalArgumentException if less than 6 elements, \r
-        * representing 3 points, are provided\r
-        */\r
+        * @throws IllegalArgumentException if less than 6 elements, representing 3 points, are provided */\r
        public Polygon (float[] vertices) {\r
                if (vertices.length < 6) throw new IllegalArgumentException("polygons must contain at least 3 points.");\r
                this.localVertices = vertices;\r
        }\r
 \r
-       /** Returns the polygon's local vertices without scaling or rotation and \r
-        * without being offset by the polygon position. */\r
+       /** Returns the polygon's local vertices without scaling or rotation and without being offset by the polygon position. */\r
        public float[] getVertices () {\r
                return localVertices;\r
        }\r
 \r
-       /** Calculates and returns the vertices of the polygon after scaling, rotation,\r
-        * and positional translations have been applied, as they are position within the world.\r
+       /** Calculates and returns the vertices of the polygon after scaling, rotation, and positional translations have been applied,\r
+        * as they are position within the world.\r
         * \r
         * @return vertices scaled, rotated, and offset by the polygon position. */\r
        public float[] getTransformedVertices () {\r
@@ -111,19 +107,15 @@ public class Polygon {
                this.y = y;\r
                dirty = true;\r
        }\r
-       \r
-       /** Sets the polygon's local vertices relative to the origin point,\r
-        * without any scaling, rotating or translations being applied.\r
+\r
+       /** Sets the polygon's local vertices relative to the origin point, without any scaling, rotating or translations being applied.\r
         * \r
-        * @param vertices float array where every even element represents the\r
-        * x-coordinate of a vertex, and the proceeding element representing the\r
-        * y-coordinate.\r
-        * @throws IllegalArgumentException  if less than 6 elements, \r
-        * representing 3 points, are provided\r
-        */\r
+        * @param vertices float array where every even element represents the x-coordinate of a vertex, and the proceeding element\r
+        *           representing the y-coordinate.\r
+        * @throws IllegalArgumentException if less than 6 elements, representing 3 points, are provided */\r
        public void setVertices (float[] vertices) {\r
                if (vertices.length < 6) throw new IllegalArgumentException("polygons must contain at least 3 points.");\r
-               \r
+\r
                // if the provided vertices are the same length, we can copy them into localVertices\r
                if (localVertices.length == vertices.length) {\r
                        for (int i = 0; i < localVertices.length; i++) {\r
@@ -168,9 +160,7 @@ public class Polygon {
                dirty = true;\r
        }\r
 \r
-       /** Sets the polygon's world vertices to be recalculated when calling \r
-        * {@link #getTransformedVertices() getTransformedVertices}. \r
-        */\r
+       /** Sets the polygon's world vertices to be recalculated when calling {@link #getTransformedVertices() getTransformedVertices}. */\r
        public void dirty () {\r
                dirty = true;\r
        }\r
@@ -196,13 +186,11 @@ public class Polygon {
                return area;\r
        }\r
 \r
-       /** Returns an axis-aligned bounding box of this polygon.  \r
+       /** Returns an axis-aligned bounding box of this polygon.\r
         * \r
-        * Note the returned Rectangle is cached in this polygon, and will\r
-        * be reused if this Polygon is changed.\r
+        * Note the returned Rectangle is cached in this polygon, and will be reused if this Polygon is changed.\r
         * \r
-        * @return this polygon's bounding box {@link Rectangle}\r
-        */\r
+        * @return this polygon's bounding box {@link Rectangle} */\r
        public Rectangle getBoundingRectangle () {\r
                float[] vertices = getTransformedVertices();\r
 \r
@@ -227,7 +215,7 @@ public class Polygon {
 \r
                return bounds;\r
        }\r
-       \r
+\r
        /** Returns whether an x, y pair is contained within the polygon. */\r
        public boolean contains (float x, float y) {\r
                final float[] vertices = getTransformedVertices();\r
@@ -269,7 +257,7 @@ public class Polygon {
                return rotation;\r
        }\r
 \r
-       /** Returns the total horizontal scaling applied to the polygon. */ \r
+       /** Returns the total horizontal scaling applied to the polygon. */\r
        public float getScaleX () {\r
                return scaleX;\r
        }\r