drawTreeX method

void drawTreeX(
  1. DebugDraw argDraw,
  2. int node,
  3. int spot,
  4. int height
)

Implementation

void drawTreeX(DebugDraw argDraw, int node, int spot, int height) {
  AABB a = _aabb[node];
  a.getVertices(drawVecs);

  _color.setFromRGBd(
      1.0, (height - spot) * 1.0 / height, (height - spot) * 1.0 / height);
  argDraw.drawPolygon(drawVecs, 4, _color);

  Vector2 textVec =
      argDraw.getViewportTranform().getWorldToScreen(a.upperBound);
  argDraw.drawStringXY(
      textVec.x, textVec.y, "$node-${(spot + 1)}/$height", _color);

  int c1 = _child1[node];
  int c2 = _child2[node];
  if (c1 != NULL_NODE) {
    drawTreeX(argDraw, c1, spot + 1, height);
  }
  if (c2 != NULL_NODE) {
    drawTreeX(argDraw, c2, spot + 1, height);
  }
}