import com.badlogic.gdx.graphics.Camera;\r
import com.badlogic.gdx.graphics.Color;\r
import com.badlogic.gdx.graphics.GL10;\r
+import com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer;\r
+import com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer10;\r
+import com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer20;\r
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;\r
import com.badlogic.gdx.math.MathUtils;\r
import com.badlogic.gdx.math.Matrix4;\r
+import com.badlogic.gdx.math.Vector2;\r
+import com.badlogic.gdx.math.Vector3;\r
import com.badlogic.gdx.utils.GdxRuntimeException;\r
\r
/** Renders points, lines, rectangles, filled rectangles and boxes.</p>\r
}\r
\r
/** Draws a line. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. */\r
- public void line (float x, float y, float z, float x2, float y2, float z2) {\r
- if (currType != ShapeType.Line) throw new GdxRuntimeException("Must call begin(ShapeType.Line)");\r
- checkDirty();\r
- checkFlush(2);\r
- renderer.color(color.r, color.g, color.b, color.a);\r
- renderer.vertex(x, y, z);\r
- renderer.color(color.r, color.g, color.b, color.a);\r
- renderer.vertex(x2, y2, z2);\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}.\r
* Lazy method that "just" calls the "other" method and unpacks the Vector3 for you */\r
public final void line (Vector3 v0, Vector3 v1) {\r
- line( v0.x, v0,y, v0.z, v1.x, v1.y, v1.z );\r
+ \r
+ assert v0 != null;\r
+ assert v1 != null;\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 void line (float x, float y, float x2, float y2) {\r
- if (currType != ShapeType.Line) throw new GdxRuntimeException("Must call begin(ShapeType.Line)");\r
- checkDirty();\r
- checkFlush(2);\r
- renderer.color(color.r, color.g, color.b, color.a);\r
- renderer.vertex(x, y, 0);\r
- renderer.color(color.r, color.g, color.b, color.a);\r
- renderer.vertex(x2, y2, 0);\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}.\r
+ * Lazy method that "just" calls the "other" method and unpacks the Vector2 for you */\r
+ public final void line (Vector2 v0, Vector2 v1) {\r
+ \r
+ assert v0 != null;\r
+ assert v1 != null;\r
+ \r
+ line( v0.x, v0.y, 0.0f, v1.x, v1.y, 0.0f, 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}. The line is drawn\r
* with 2 colors interpolated between start & end point.\r
* @param c1 Color at start of the line\r
* @param c2 Color at end of the line */\r
- public void line (float x, float y, float x2, float y2, Color c1, Color c2) {\r
+ public final void line (float x, float y, float x2, float y2, Color c1, Color c2) {\r
+ \r
+ assert c1 != null;\r
+ assert c2 != null;\r
+ \r
+ line( x, y, 0.0f, x2, y2, 0.0f, c1, c2 );\r
+ }\r
+\r
+ /** Draws a line. The {@link ShapeType} passed to begin has to be {@link ShapeType#Line}. The line is drawn\r
+ * with 2 colors interpolated between start & end point.\r
+ * @param c1 Color at start of the line\r
+ * @param c2 Color at end of the line */\r
+ public void line (float x, float y, float z, float x2, float y2, float z2, Color c1, Color c2) {\r
if (currType != ShapeType.Line) throw new GdxRuntimeException("Must call begin(ShapeType.Line)");\r
checkDirty();\r
checkFlush(2);\r
renderer.color(c1.r, c1.g, c1.b, c1.a);\r
- renderer.vertex(x, y, 0);\r
+ renderer.vertex(x, y, z);\r
renderer.color(c2.r, c2.g, c2.b, c2.a);\r
- renderer.vertex(x2, y2, 0);\r
+ renderer.vertex(x2, y2, z2);\r
}\r
\r
public void curve (float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, int segments) {\r