Tabnine Logo
DebugDraw
Code IndexAdd Tabnine to your IDE (free)

How to use
DebugDraw
in
org.jbox2d.callbacks

Best Java code snippets using org.jbox2d.callbacks.DebugDraw (Showing top 20 results out of 315)

origin: libgdx/libgdx

 circCenterMoved.set(center).addLocal(liquidOffset);
 center.subLocal(liquidOffset);
 m_debugDraw.drawSegment(center, circCenterMoved, liquidColor);
 return;
 m_debugDraw.drawCircle(center, radius, axis, color);
} else {
 m_debugDraw.drawSolidCircle(center, radius, axis, color);
 m_debugDraw.drawPolygon(vertices, vertexCount, color);
} else {
 m_debugDraw.drawSolidPolygon(vertices, vertexCount, color);
Transform.mulToOutUnsafe(xf, edge.m_vertex1, v1);
Transform.mulToOutUnsafe(xf, edge.m_vertex2, v2);
m_debugDraw.drawSegment(v1, v2, color);
for (int i = 1; i < count; ++i) {
 Transform.mulToOutUnsafe(xf, vertices[i], v2);
 m_debugDraw.drawSegment(v1, v2, color);
 m_debugDraw.drawCircle(v1, 0.05f, color);
 v1.set(v2);
origin: libgdx/libgdx

 public void drawTree(DebugDraw argDraw, DynamicTreeNode node, int spot, int height) {
  node.aabb.getVertices(drawVecs);

  color.set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
  argDraw.drawPolygon(drawVecs, 4, color);

  argDraw.getViewportTranform().getWorldToScreen(node.aabb.upperBound, textVec);
  argDraw.drawString(textVec.x, textVec.y, node.id + "-" + (spot + 1) + "/" + height, color);

  if (node.child1 != null) {
   drawTree(argDraw, node.child1, spot + 1, height);
  }
  if (node.child2 != null) {
   drawTree(argDraw, node.child2, spot + 1, height);
  }
 }
}
origin: libgdx/libgdx

private void drawParticleSystem(ParticleSystem system) {
 boolean wireframe = (m_debugDraw.getFlags() & DebugDraw.e_wireframeDrawingBit) != 0;
 int particleCount = system.getParticleCount();
 if (particleCount != 0) {
  float particleRadius = system.getParticleRadius();
  Vec2[] positionBuffer = system.getParticlePositionBuffer();
  ParticleColor[] colorBuffer = null;
  if (system.m_colorBuffer.data != null) {
   colorBuffer = system.getParticleColorBuffer();
  }
  if (wireframe) {
   m_debugDraw.drawParticlesWireframe(positionBuffer, particleRadius, colorBuffer,
     particleCount);
  } else {
   m_debugDraw.drawParticles(positionBuffer, particleRadius, colorBuffer, particleCount);
  }
 }
}
origin: libgdx/libgdx

int flags = m_debugDraw.getFlags();
boolean wireframe = (flags & DebugDraw.e_wireframeDrawingBit) != 0;
  fixtureA.getAABB(c.getChildIndexA()).getCenterToOut(cA);
  fixtureB.getAABB(c.getChildIndexB()).getCenterToOut(cB);
  m_debugDraw.drawSegment(cA, cB, color);
     vs[2].set(aabb.upperBound.x, aabb.upperBound.y);
     vs[3].set(aabb.lowerBound.x, aabb.upperBound.y);
     m_debugDraw.drawPolygon(vs, 4, color);
  xf.set(b.getTransform());
  xf.p.set(b.getWorldCenter());
  m_debugDraw.drawTransform(xf);
m_debugDraw.flush();
origin: jbox2d/jbox2d

  getDebugDraw().drawPolygon(vecs, 4, c);
getDebugDraw().drawPolygon(vecs, 4, c);
getDebugDraw().drawSegment(m_rayCastInput.p1, m_rayCastInput.p2, c);
getDebugDraw().drawPoint(m_rayCastInput.p1, 6.0f, c1);
getDebugDraw().drawPoint(m_rayCastInput.p2, 6.0f, c2);
  Vec2 p = m_rayCastInput.p2.sub(m_rayCastInput.p1)
      .mulLocal(m_rayActor.fraction).addLocal(m_rayCastInput.p1);
  getDebugDraw().drawPoint(p, 6.0f, cr);
getDebugDraw().drawString(5, 30,
    "(c)reate proxy, (d)estroy proxy, (a)utomate", Color3f.WHITE);
origin: jbox2d/jbox2d

 debugDraw.drawString(camera.getTransform().getExtents().x, 15, title, Color3f.WHITE);
 m_textLine += TEXT_LINE_SPACE;
 debugDraw.drawString(5, m_textLine, "****PAUSED****", Color3f.WHITE);
 m_textLine += TEXT_LINE_SPACE;
    ? DebugDraw.e_wireframeDrawingBit
    : 0;
debugDraw.setFlags(flags);
debugDraw.drawString(5, m_textLine, "Engine Info", color4);
m_textLine += TEXT_LINE_SPACE;
debugDraw.drawString(5, m_textLine, "Framerate: " + (int) model.getCalculatedFps(),
  Color3f.WHITE);
m_textLine += TEXT_LINE_SPACE;
 int particleCount = m_world.getParticleCount();
 int groupCount = m_world.getParticleGroupCount();
 debugDraw.drawString(
   5,
   m_textLine,
 debugDraw.drawString(5, m_textLine, "World mouse position: " + mouseWorld.toString(),
   Color3f.WHITE);
 m_textLine += TEXT_LINE_SPACE;
  debugDraw.drawString(5, m_textLine, s, Color3f.WHITE);
  m_textLine += TEXT_LINE_SPACE;
origin: libgdx/libgdx

/**
 * Draw a closed polygon provided in CCW order. This implementation uses
 * {@link #drawSegment(Vec2, Vec2, Color3f)} to draw each side of the polygon.
 * 
 * @param vertices
 * @param vertexCount
 * @param color
 */
public void drawPolygon(Vec2[] vertices, int vertexCount, Color3f color) {
 if (vertexCount == 1) {
  drawSegment(vertices[0], vertices[0], color);
  return;
 }
 for (int i = 0; i < vertexCount - 1; i += 1) {
  drawSegment(vertices[i], vertices[i + 1], color);
 }
 if (vertexCount > 2) {
  drawSegment(vertices[vertexCount - 1], vertices[0], color);
 }
}
origin: jbox2d/jbox2d

@Override
public synchronized void step(TestbedSettings settings) {
 super.step(settings);
 shape.set(m_points, m_count);
 addTextLine("Press g to generate a new random convex hull");
 getDebugDraw().drawPolygon(shape.m_vertices, shape.m_count, color);
 for (int i = 0; i < m_count; ++i) {
  getDebugDraw().drawPoint(m_points[i], 2.0f, color2);
  getDebugDraw().drawString(m_points[i].add(new Vec2(0.05f, 0.05f)), i + "", Color3f.WHITE);
 }
 assert (shape.validate());
 if (m_auto) {
  generate();
 }
}
origin: jbox2d/jbox2d

void DrawFixture(Fixture fixture) {
 Color3f color = new Color3f(0.95f, 0.95f, 0.6f);
 final Transform xf = fixture.getBody().getTransform();
 switch (fixture.getType()) {
  case CIRCLE: {
   CircleShape circle = (CircleShape) fixture.getShape();
   Vec2 center = Transform.mul(xf, circle.m_p);
   float radius = circle.m_radius;
   debugDraw.drawCircle(center, radius, color);
  }
   break;
  case POLYGON: {
   PolygonShape poly = (PolygonShape) fixture.getShape();
   int vertexCount = poly.m_count;
   assert (vertexCount <= Settings.maxPolygonVertices);
   Vec2 vertices[] = new Vec2[Settings.maxPolygonVertices];
   for (int i = 0; i < vertexCount; ++i) {
    vertices[i] = Transform.mul(xf, poly.m_vertices[i]);
   }
   debugDraw.drawPolygon(vertices, vertexCount, color);
  }
   break;
  default:
   break;
 }
}
origin: libgdx/libgdx

/** Draws a circle with an axis */
public void drawCircle(Vec2 center, float radius, Vec2 axis, Color3f color) {
 drawCircle(center, radius, color);
}
origin: libgdx/libgdx

public void drawString(Vec2 pos, String s, Color3f color) {
 drawString(pos.x, pos.y, s, color);
}
origin: jbox2d/jbox2d

@Override
public void step(TestbedSettings settings) {
 boolean advanceRay = settings.pause == false || settings.singleStep;
 super.step(settings);
 addTextLine("Press 1-5 to drop stuff");
 float L = 25.0f;
 Vec2 point1 = new Vec2(0.0f, 10.0f);
 Vec2 d = new Vec2(L * MathUtils.cos(m_angle), -L * MathUtils.abs(MathUtils.sin(m_angle)));
 Vec2 point2 = point1.add(d);
 callback.m_fixture = null;
 getWorld().raycast(callback, point1, point2);
 if (callback.m_fixture != null) {
  getDebugDraw().drawPoint(callback.m_point, 5.0f, new Color3f(0.4f, 0.9f, 0.4f));
  getDebugDraw().drawSegment(point1, callback.m_point, new Color3f(0.8f, 0.8f, 0.8f));
  Vec2 head = callback.m_normal.mul(.5f).addLocal(callback.m_point);
  getDebugDraw().drawSegment(callback.m_point, head, new Color3f(0.9f, 0.9f, 0.4f));
 } else {
  getDebugDraw().drawSegment(point1, point2, new Color3f(0.8f, 0.8f, 0.8f));
 }
 if (advanceRay) {
  m_angle += 0.25f * MathUtils.PI / 180.0f;
 }
}
origin: jbox2d/jbox2d

    Transform.mulToOutUnsafe(m_transformA, m_polygonA.m_vertices[i], v[i]);
  getDebugDraw().drawPolygon(v, m_polygonA.m_count, color);
  getDebugDraw().drawPolygon(v, m_polygonB.m_count, color);
Vec2 x2 = output.pointB;
getDebugDraw().drawPoint(x1, 4.0f, c1);
getDebugDraw().drawPoint(x2, 4.0f, c2);
origin: org.jbox2d/jbox2d-testbed

 public void mouseWheelMoved(MouseWheelEvent e) {
  DebugDraw d = draw;
  int notches = e.getWheelRotation();
  TestbedTest currTest = model.getCurrTest();
  if (currTest == null) {
   return;
  }
  OBBViewportTransform trans = (OBBViewportTransform) d.getViewportTranform();
  oldCenter.set(model.getCurrTest().getWorldMouse());
  // Change the zoom and clamp it to reasonable values - can't clamp now.
  if (notches < 0) {
   trans.mulByTransform(upScale);
   currTest.setCachedCameraScale(currTest.getCachedCameraScale() * ZOOM_IN_SCALE);
  } else if (notches > 0) {
   trans.mulByTransform(downScale);
   currTest.setCachedCameraScale(currTest.getCachedCameraScale() * ZOOM_OUT_SCALE);
  }
  d.getScreenToWorldToOut(model.getMouse(), newCenter);
  Vec2 transformedMove = oldCenter.subLocal(newCenter);
  d.getViewportTranform().setCenter(
    d.getViewportTranform().getCenter().addLocal(transformedMove));
  currTest.setCachedCameraPos(d.getViewportTranform().getCenter());
 }
});
origin: org.jbox2d/jbox2d-testbed

public void setCamera(Vec2 argPos) {
 model.getDebugDraw().getViewportTranform().setCenter(argPos);
}
origin: jbox2d/jbox2d

int flags = m_debugDraw.getFlags();
boolean wireframe = (flags & DebugDraw.e_wireframeDrawingBit) != 0;
  fixtureA.getAABB(c.getChildIndexA()).getCenterToOut(cA);
  fixtureB.getAABB(c.getChildIndexB()).getCenterToOut(cB);
  m_debugDraw.drawSegment(cA, cB, color);
     vs[2].set(aabb.upperBound.x, aabb.upperBound.y);
     vs[3].set(aabb.lowerBound.x, aabb.upperBound.y);
     m_debugDraw.drawPolygon(vs, 4, color);
  xf.set(b.getTransform());
  xf.p.set(b.getWorldCenter());
  m_debugDraw.drawTransform(xf);
m_debugDraw.flush();
origin: org.jbox2d/jbox2d-testbed

  getDebugDraw().drawPolygon(vecs, 4, c);
getDebugDraw().drawPolygon(vecs, 4, c);
getDebugDraw().drawSegment(m_rayCastInput.p1, m_rayCastInput.p2, c);
getDebugDraw().drawPoint(m_rayCastInput.p1, 6.0f, c1);
getDebugDraw().drawPoint(m_rayCastInput.p2, 6.0f, c2);
  Vec2 p = m_rayCastInput.p2.sub(m_rayCastInput.p1)
      .mulLocal(m_rayActor.fraction).addLocal(m_rayCastInput.p1);
  getDebugDraw().drawPoint(p, 6.0f, cr);
getDebugDraw().drawString(5, m_textLine,
    "(c)reate proxy, (d)estroy proxy, (a)utomate", Color3f.WHITE);
origin: org.jbox2d/jbox2d-testbed

 debugDraw.drawString(5, m_textLine, "****PAUSED****", Color3f.WHITE);
 m_textLine += 15;
  settings.getSetting(TestbedSettings.DrawCOMs).enabled ? DebugDraw.e_centerOfMassBit : 0;
flags += settings.getSetting(TestbedSettings.DrawTree).enabled ? DebugDraw.e_dynamicTreeBit : 0;
debugDraw.setFlags(flags);
 debugDraw.drawString(5, m_textLine, "Engine Info", color4);
 m_textLine += 15;
 debugDraw.drawString(5, m_textLine, "Framerate: " + model.getCalculatedFps(), Color3f.WHITE);
 m_textLine += 15;
 debugDraw.drawString(
   5,
   m_textLine,
     + m_world.getProxyCount(), Color3f.WHITE);
 m_textLine += 15;
 debugDraw.drawString(5, m_textLine, "World mouse position: " + mouseWorld.toString(),
   Color3f.WHITE);
 m_textLine += 15;
  debugDraw.drawString(5, m_textLine, s, Color3f.WHITE);
  m_textLine += 15;
 debugDraw.drawString(5, m_textLine, "Help", color4);
 m_textLine += 15;
 debugDraw.drawString(5, m_textLine, "Click and drag the left mouse button to move objects.",
   Color3f.WHITE);
 m_textLine += 15;
origin: libgdx/libgdx

m_debugDraw.drawSegment(p1, p2, color);
break;
Vec2 s1 = pulley.getGroundAnchorA();
Vec2 s2 = pulley.getGroundAnchorB();
m_debugDraw.drawSegment(s1, p1, color);
m_debugDraw.drawSegment(s2, p2, color);
m_debugDraw.drawSegment(s1, s2, color);
m_debugDraw.drawSegment(x1, p1, color);
m_debugDraw.drawSegment(p1, p2, color);
m_debugDraw.drawSegment(x2, p2, color);
origin: org.jbox2d/jbox2d-testbed

@Override
public synchronized void step(TestbedSettings settings) {
 super.step(settings);
 shape.set(m_points, count);
 addTextLine("Press g to generate a new random convex hull");
 getDebugDraw().drawPolygon(shape.m_vertices, shape.m_count, color);
 for (int i = 0; i < count; ++i) {
  getDebugDraw().drawPoint(m_points[i], 2.0f, color2);
  getDebugDraw().drawString(m_points[i].add(new Vec2(0.05f, 0.05f)), i + "", Color3f.WHITE);
 }
 assert (shape.validate());
 if (m_auto) {
  generate();
 }
}
org.jbox2d.callbacksDebugDraw

Javadoc

Implement this abstract class to allow JBox2d to automatically draw your physics for debugging purposes. Not intended to replace your own custom rendering routines!

Most used methods

  • drawCircle
    Draw a circle.
  • drawPolygon
    Draw a closed polygon provided in CCW order. This implementation uses #drawSegment(Vec2,Vec2,Color3f
  • drawSegment
    Draw a line segment.
  • drawString
    Draw a string.
  • getViewportTranform
  • drawParticles
    Draw a particle array
  • drawParticlesWireframe
    Draw a particle array
  • drawSolidCircle
    Draw a solid circle.
  • drawSolidPolygon
    Draw a solid closed polygon provided in CCW order.
  • drawTransform
    Draw a transform. Choose your own length scale
  • flush
    Called at the end of drawing a world
  • getFlags
  • flush,
  • getFlags,
  • setCamera,
  • setViewportTransform,
  • drawPoint,
  • getScreenToWorldToOut,
  • setFlags

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now