Package org.jbox2d.callbacks
Class DebugDraw
java.lang.Object
org.jbox2d.callbacks.DebugDraw
- Direct Known Subclasses:
DebugDrawJ2D
Implement this abstract class to allow JBox2d to automatically draw your
physics for debugging purposes. Not intended to replace your own custom
rendering routines!
- Author:
- Daniel Murphy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDraw axis aligned bounding boxesstatic final intDraw center of mass frameprotected intstatic final intDraw dynamic treestatic final intDraw joint connectionsstatic final intDraw pairs of connected objectsstatic final intDraw shapesprotected IViewportTransformstatic final intDraw only the wireframe for drawing performance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendFlags(int flags) voidclearFlags(int flags) abstract voiddrawCircle(Vec2 center, float radius, Color3f color) Draw a circle.voiddrawCircle(Vec2 center, float radius, Vec2 axis, Color3f color) Draws a circle with an axisabstract voiddrawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count) Draw a particle arrayabstract voiddrawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) Draw a particle arrayabstract voidvoiddrawPolygon(Vec2[] vertices, int vertexCount, Color3f color) Draw a closed polygon provided in CCW order.abstract voiddrawSegment(Vec2 p1, Vec2 p2, Color3f color) Draw a line segment.abstract voiddrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color) Draw a solid circle.abstract voiddrawSolidPolygon(Vec2[] vertices, int vertexCount, Color3f color) Draw a solid closed polygon provided in CCW order.abstract voiddrawString(float x, float y, String s, Color3f color) Draw a string.voiddrawString(Vec2 pos, String s, Color3f color) abstract voidDraw a transform.voidflush()Called at the end of drawing a worldintgetFlags()getScreenToWorld(float screenX, float screenY) takes the screen coordinates and returns the world coordinates.getScreenToWorld(Vec2 argScreen) takes the screen coordinates (argScreen) and returns the world coordinatesvoidgetScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld) takes the screen coordinates and puts the corresponding world coordinates in argWorld.voidgetScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld) getWorldToScreen(float worldX, float worldY) Takes the world coordinates and returns the screen coordinates.getWorldToScreen(Vec2 argWorld) takes the world coordinate (argWorld) and returns the screen coordinates.voidgetWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen) Takes the world coordinates and puts the corresponding screen coordinates in argScreen.voidgetWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen) voidsetCamera(float x, float y, float scale) Deprecated.voidsetFlags(int flags) voidsetViewportTransform(IViewportTransform viewportTransform)
-
Field Details
-
shapeBit
public static final int shapeBitDraw shapes- See Also:
-
jointBit
public static final int jointBitDraw joint connections- See Also:
-
aabbBit
public static final int aabbBitDraw axis aligned bounding boxes- See Also:
-
pairBit
public static final int pairBitDraw pairs of connected objects- See Also:
-
centerOfMassBit
public static final int centerOfMassBitDraw center of mass frame- See Also:
-
dynamicTreeBit
public static final int dynamicTreeBitDraw dynamic tree- See Also:
-
wireframeDrawingBit
public static final int wireframeDrawingBitDraw only the wireframe for drawing performance- See Also:
-
drawFlags
protected int drawFlags -
viewportTransform
-
-
Constructor Details
-
DebugDraw
public DebugDraw() -
DebugDraw
-
-
Method Details
-
setViewportTransform
-
setFlags
public void setFlags(int flags) -
getFlags
public int getFlags() -
appendFlags
public void appendFlags(int flags) -
clearFlags
public void clearFlags(int flags) -
drawPolygon
Draw a closed polygon provided in CCW order. This implementation usesdrawSegment(Vec2, Vec2, Color3f)to draw each side of the polygon. -
drawPoint
-
drawSolidPolygon
Draw a solid closed polygon provided in CCW order. -
drawCircle
Draw a circle. -
drawCircle
Draws a circle with an axis -
drawSolidCircle
Draw a solid circle. -
drawSegment
Draw a line segment. -
drawTransform
Draw a transform. Choose your own length scale -
drawString
Draw a string. -
drawParticles
Draw a particle array- Parameters:
colors- Can be null
-
drawParticlesWireframe
public abstract void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count) Draw a particle array- Parameters:
colors- Can be null
-
flush
public void flush()Called at the end of drawing a world -
drawString
-
getViewportTransform
-
setCamera
public void setCamera(float x, float y, float scale) Deprecated.use the viewport transform ingetViewportTransform() -
getScreenToWorldToOut
-
getWorldToScreenToOut
-
getWorldToScreenToOut
Takes the world coordinates and puts the corresponding screen coordinates in argScreen. -
getWorldToScreen
takes the world coordinate (argWorld) and returns the screen coordinates. -
getWorldToScreen
Takes the world coordinates and returns the screen coordinates. -
getScreenToWorldToOut
takes the screen coordinates and puts the corresponding world coordinates in argWorld. -
getScreenToWorld
takes the screen coordinates (argScreen) and returns the world coordinates -
getScreenToWorld
takes the screen coordinates and returns the world coordinates.
-
getViewportTransform()